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.
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 - 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
Q 4 - 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 ON clause
Answer : A
Q 5 - Which of the following is not true about the COUNT function?
A - COUNT(*) returns the number of rows in the table.
B - COUNT(exp) returns the number of rows with non-null values for the exp.
C - COUNT(DISTINCT exp) returns the number of unique, non-null values in the column.
Answer : D
Q 6 - In which of the following cases a DML statement is not executed?
A - When existing rows are modified
Answer : C
Q 7 - Which of the following is not true about the database objects?
A - Indexes improve performance of queries.
B - Views give alternative names to objects.
Answer : B
Q 8 - Which of the following is not true about simple views?
A - They derive data from one table.
B - They contain no functions or grouping.
C - You cannot perform DML operations through a simple view.
Answer : C
Q 9 - Which of the following is not true about a sequence?
A - They are used for generating sequential numbers.
B - Sequences are created by the CREATE SEQUENCE statement.
Answer : C
Q 10 - Which of the following is not a developer’s privilege?