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 2 - 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 and percentage of marks of all students sorted by honours subject, and then order by percentage of marks?

A - select first_name, last name, honours_subject, percentage_of_marks from students order by honours_subject, percentage_of_marks;

B - select first_name, last name, honours_subject, percentage_of_marks order by percentage_of_marks desc from students;

C - select first_name, last name, percentage_of_marks from students order by percentage_of_marks desc;

D - select first_name, last name, percentage_of_marks from students order by percentage_of_marks, honours_subject;

Answer : A

Q 3 - For some particular assignment, you need to compare two values, if both are equal, the result would be null, and if the values are not equal then the first value should be returned. Which function should you use?

A - NVL

B - NVL2

C - NULLIF

D - COALESCE

Answer : C

Q 7 - Which statement allows conditional update, or insertion of data into a table simultaneously?

A - INSERT statement

B - MERGE statement

C - UPDATE statement

D - None of the above

Answer : B

Answer : D

Q 9 - Which of the following code will create an index named

stu_marks_ind on the columns student_code and percentage_of_marks of the STUDENTS table.

Now which will delete the index stu_marks_ind.

Which of the following code will delete an index stu_marks_ind on the columns student_code and percentage_of_marks of the STUDENTS table?

A - drop index stu_marks_ind;

B - delete index stu_marks_ind;

C - drop stu_marks_ind;

D - drop index stu_marks_ind on students;

Answer : A

Answer : D

sql_questions_answers.htm
Advertisements