🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.It's shorter
  2. B.To avoid integer division, which drops the decimal part
  3. C.100 is not allowed in SQL
  4. 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 →