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

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

Which query will display the names and honours subjects of all students and if a student has not yet been given a honours subject yet, then it should display ‘No Honours Yet’.

A - select first_name, last name, nvl(honours_subject, ‘No Honours Yet’) from students;

B - select first_name, last name, nvl2(honours_subject, ‘No Honours Yet’) from students;

C - select first_name, last name, honours_subject, from students;

D - select first_name, last name, nullif(honours_subject, ‘No Honours Yet’) from students;

Answer : A

Answer : D

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 9 - Which of the following code will delete a view named all_marks_english?

A - delete view all_marks_english;

B - drop view all_marks_english;

C - delete all_marks_english;

D - drop all_marks_english;

Answer : B

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