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 1 - Consider the following schema −

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

Which of the following query would display names of all the students whose email ids are not provided?

A - select first_name, last name from students where email = 0;

B - select first_name, last name from students where email = ‘ ‘;

C - select first_name, last name from students where email is null;

D - select first_name, last name from students where email = ‘null’;

Answer : C

Q 2 - What is returned by TRUNC(789.8389, 2)?

A - 789.84

B - 789.83

C - 78

D - 789.00

Answer : B

Q 4 - Which of the following is not a group function?

A - SUM

B - NVL

C - COUNT

D - MIN

Answer : B

Q 5 - Consider the following schema −

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

Which of the following query will correctly list the average percentage of marks in each honours subject, when the average is more than 50 percent?

A - select honours_subject, avg(percentage_of_marks) from students where avg(percentage_of_marks) > 50.0 group by honours_subject;

B - select honours_subject, avg(percentage_of_marks) from students having avg(percentage_of_marks) > 50.0 group by honours_subject;

C - select honours_subject, avg(percentage_of_marks) from students group by honours_subject having avg(percentage_of_marks) > 50.0;

D - None of the above.

Answer : B

Q 6 - Which of the following comparison operators could be used in a multiple row query?

A - IN operator

B - ANY operator

C - ALL operator

D - All of the above

Answer : D

Q 9 - Which of the following code will delete a view named all_marks_english?

A - delete view all_marks_english;

B - drop view all_marks_english;

C - delete all_marks_english;

D - drop all_marks_english;

Answer : B

Q 10 - Which of the following code would grant the role student_admin to a user named william?

A - grant student_admin to william;

B - grant to william student_admin;

C - grant william student_admin;

D - None of the above.

Answer : A

sql_questions_answers.htm
Advertisements