SQL Online Quiz



Following quiz provides Multiple Choice Questions (MCQs) related to SQL. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 3 - You want to calculate the tax payable by the employees of an organization. If the employee gets a commission, then the tax would be calculated on commission plus salary, if the employee does not get any commission, then the tax would be calculated on salary only. Which function should you use for calculating tax?

A - NVL

B - NVL2

C - NULLIF

D - COALESCE

Answer : B

Q 5 - You want to calculate the sum of commissions earned by the employees of an organisation. If an employee doesn’t receive any commission, it should be calculated as zero. Which will be the right query to achieve this?

A - select sum(nvl(commission, 0)) from employees;

B - select sum(commission, 0) from employees;

C - select nvl(sum(commission), 0) from employees;

D - None of the above.

Answer : A

Answer : A

Q 8 - Which of the following code will remove all the rows from the table LOCATIONS?

A - DROP TABLE locations;

B - DELETE TABLE locations;

C - TRUNCATE TABLE locations;

D - None of the above.

Answer : C

Answer : C

Answer : D

sql_questions_answers.htm
Advertisements