SQL Online Quiz


Advertisements

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 the distinct honours subjects in the STUDENTS table?

A - select honours_subject from students;

B - select distinct honours_subject from students;

C - select all honours_subject from students;

D - select * from students;

Answer : B

Q 2 - What is returned by ROUND(789.8389, 2)?

A - 789.84

B - 789.83

C - 78

D - 789.00

Answer : A

Answer : D

Q 5 - You want to calculate the minimum percentage of marks obtained under each honours group students, where the minimum marks is more than the minimum marks in economics department. Under which clause should the subquery be?

A - WHERE clause

B - FROM clause

C - HAVING clause

D - None of the above.

Answer : C

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 8 - 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 code will create a simple view named all_marks_english that contains the names and percentage of marks of the students in the honours_subject ‘Eng01’?

A - create view all_marks_english as select first_name, last_name, percentage_of_marks from students where honours_subject = ‘Eng01’;

B - create view all_marks_english as ( first_name, last_name, percentage_of_marks from students where honours_subject = ‘Eng01’);

C - select view all_marks_english as select first_name, last_name, percentage_of_marks from students where honours_subject = ‘Eng01’;

D - None of the above.

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

Q 10 - Which of the following is a system privilege?

A - Creating new users

B - Removing users

C - Removing tables

D - All of the above.

Answer : D

sql_questions_answers.htm
Advertisements