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 where the second letter in the first name is ‘i’?

A - select first_name from students where first_name like ‘_i%’;

B - select first_name from students where first_name like ‘%i_’;

C - select first_name from students where first_name like ‘%i%’;

D - select first_name from students where first_name like ‘_i_’;

Answer : A

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

A - TUTORIAL

B - POINT

C - TUTORIALS

D - UTORIALS

Answer : C

Q 3 - Consider the following schema −

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

Select the right query for retrieving records from the tables HONOURS_SUBJECT and LOCATIONS with the USING clause

A - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h join location l using(subject_code);

B - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h natural join location l using(subject_code);

C - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h, location l using(subject_code);

D - None of the above.

Answer : A

Q 6 - In which of the following cases a DML statement is not executed?

A - When existing rows are modified

B - When some rows are deleted

C - When a table is deleted

D - All of the above

Answer : C

Q 7 - Consider the following schema −

LOCATIONS(subject_code, department_name, location_id, city);

Which code snippet will alter the table LOCATIONS and delete the column named CITY?

A - MODIFY TABLE locations DROP (city varchar2(30));

B - ALTER TABLE locations DROP COLUMN city;

C - ALTER TABLE locations DROP (city);

D - None of the above.

Answer : B

Q 9 - Which of the following code will retrieve data from the view all_marks_english, created in the previous question?

A - select view all_marks_english;

B - select from all_marks_english;

C - retrieve from all_marks_english;

D - select * from all_marks_english;

Answer : D

Answer : D

sql_questions_answers.htm
Advertisements