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 all the students with honours_subject ‘Eng01’?

A - select student_code, first_name, last_name from students where honours_subject = ‘Eng01’;

B - select student_code, first_name, last_name from students where honours_subject is ‘Eng01’;

C - select student_code, first_name, last_name where honours_subject = ‘Eng01’

    from students;

D - select student_code, first_name, last_name from students;

Answer : A

Q 2 - What is returned by SUBSTR(‘TUTORIALS POINT’, -1, 1)?

A - T

B - NULL

C - 0

D - N

Answer : A

Q 3 - Consider the following schema −

HONOURS_SUBJECT(subject_code, subject_name, department_head);
LOCATIONS(subject_code, department_name, location_id, city);

Which query will perform a natural join between the HONOURS_SUBJECT table and the LOCATIONS table?

A - select subject_code, subject_name, location_id, city from honours_subject cross join locations;

B - select subject_code, subject_name, location_id, city from honours_subject join locations;

C - select subject_code, subject_name, location_id, city from honours_subject outer join locations;

D - select subject_code, subject_name, location_id, city from honours_subject natural join locations;

Answer : D

Answer : A

Q 9 - Which of the following minimal code would create a sequence named loc_seq as a primary key of the LOCATIONS table?

A - create sequence loc_seq;

B - create sequence loc_seq on locations;

C - create loc_seq;

D - None of the above.

Answer : A

sql_questions_answers.htm
Advertisements