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 2 - 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 names and percentage of marks of all students sorted by honours subject, and then order by percentage of marks?

A - select first_name, last name, honours_subject, percentage_of_marks from students order by honours_subject, percentage_of_marks;

B - select first_name, last name, honours_subject, percentage_of_marks order by percentage_of_marks desc from students;

C - select first_name, last name, percentage_of_marks from students order by percentage_of_marks desc;

D - select first_name, last name, percentage_of_marks from students order by percentage_of_marks, honours_subject;

Answer : A

Q 4 - Which of the following is not a group function?

A - SUM

B - NVL

C - COUNT

D - MIN

Answer : B

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 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 - 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 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 statement is used for allocating system privileges to the users?

A - CREATE

B - GRANT

C - REVOKE

D - ROLE

Answer : B


sql_questions_answers.htm

Advertisements