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

Answer : C

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 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 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 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

Q 10 - Which of the following is not a developer’s privilege?

A - CREATE USER

B - CREATE TABLE

C - CREATE VIEW

D - CREATE SEQUENCE

Answer : A

sql_questions_answers.htm
Advertisements