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 all the students whose first name starts with the character ‘A’?

A - select first_name from students where first_name like ‘A%’;

B - select first_name from students where first_name like ‘%A’;

C - select first_name from students where first_name like ‘%A%’;

D - select first_name from students where first_name like ‘A’;

Answer : A

Q 3 - For some particular assignment, you need to compare two values, if both are equal, the result would be null, and if the values are not equal then the first value should be returned. Which function should you use?

A - NVL

B - NVL2

C - NULLIF

D - COALESCE

Answer : C

Answer : A

Answer : A

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 statement is used to modify a sequence?

A - ALTER SEQUENCE

B - SELECT SEQUENCE

C - DROP SEQUENCE

D - None of the above.

Answer : A

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