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 - What is returned by MOD(1000,30)?

A - 33

B - 30

C - 3

D - 10

Answer : D

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

LOCATIONS(subject_code, department_name, location_id, city);

Which code snippet will alter the table LOCATIONS and add a column named Address, with datatype VARCHAR2(100)?

A - ALTER TABLE locations ADD (address varchar2(100));

B - ALTER TABLE locations ADD COLUMN(address varchar2(100));

C - MODIFY TABLE locations ADD COLUMN (address varchar2(100));

D - None of the above.

Answer : A

Q 8 - Which of the following code will successfully delete the table LOCATIONS from the database?

A - DROP TABLE locations;

B - DELETE TABLE locations;

C - TRUNCATE TABLE locations;

D - None of the above.

Answer : A

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

Q 10 - Which of the following code would allocate the privileges of creating tables and view to the role named student_admin?

A - grant create table, create view to student_admin;

B - grant to student_admin create table, create view;

C - grant role student_admin create table, create view;

D - None of the above.

Answer : A

sql_questions_answers.htm
Advertisements