← Quiz: SQL Interview Queries: all 10 questions
Quiz: SQL Interview Queries · Question 4 of 10
Why write 100.0 SUM(x) / total instead of 100 SUM(x) / total?
Why write 100.0 * SUM(x) / total instead of 100 * SUM(x) / total?
- A.It's shorter
- B.To avoid integer division, which drops the decimal part
- C.100 is not allowed in SQL
- D.It makes the query run faster
Answer & explanation
Correct answer: To avoid integer division, which drops the decimal part
Using a decimal number makes the division decimal in every database.
Can you get the rest right without peeking?
Take the timed Quiz: SQL Interview Queries quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →