Informatics Practices
What will returned by the given query ?
SELECT Truncate(15.79, -1), Truncate(15.79, 0), Truncate(15.79, 1);
- 15 15 15.7
- 10 15.7 15.9
- 10 15 15.7
- 10 10 15.9
SQL Queries
2 Likes
Answer
10 15 15.7
Reason — The TRUNCATE
function in SQL truncates a number to a specified position. In the given query, Truncate(15.79, -1)
truncates 15.79 to the nearest multiple of 10, yielding 10. Truncate(15.79, 0)
truncates 15.79 to a whole number, giving 15. Finally, Truncate(15.79, 1)
truncates 15.79 to one decimal place, resulting in 15.7. Thus, the output of the query is 10, 15, and 15.7, making option 3 as the correct answer.
Answered By
2 Likes
Related Questions
What will be returned by the given query ?
SELECT Round(153.669, 2);
- 153.6
- 153.66
- 153.67
- 153.7
What will be returned by the given query ?
SELECT Sign(26);
- 1
- -1
- 0
- none of these
What will be returned by the given query ?
SELECT month('2020-05-11');
- 5
- 11
- May
- November
Which of the following are correct aggregate functions in SQL ?
- AVERAGE()
- MAX()
- COUNT()
- TOTAL()