KnowledgeBoat Logo

Informatics Practices

What will returned by the given query ?

SELECT Truncate(15.79, -1), Truncate(15.79, 0), Truncate(15.79, 1);
  1. 15 15 15.7
  2. 10 15.7 15.9
  3. 10 15 15.7
  4. 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