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.

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 where the second letter in the first name is ‘i’?

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

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

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

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

Answer : A

Q 2 - What is returned by SUBSTR(‘TUTORIALS POINT’, 1, 9)?

A - TUTORIAL

B - POINT

C - TUTORIALS

D - UTORIALS

Answer : C

Q 3 - Consider the following schema −

HONOURS_SUBJECT(subject_code, subject_name, department_head);
LOCATIONS(subject_code, department_name, location_id, city);

Which query will perform a natural join between the HONOURS_SUBJECT table and the LOCATIONS table?

A - select subject_code, subject_name, location_id, city from honours_subject cross join locations;

B - select subject_code, subject_name, location_id, city from honours_subject join locations;

C - select subject_code, subject_name, location_id, city from honours_subject outer join locations;

D - select subject_code, subject_name, location_id, city from honours_subject natural join locations;

Answer : D

Q 5 - A subquery can be placed in which of the SQL clauses?

A - The WHERE clause

B - The HAVING clause

C - The FROM clause

D - All of the above.

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

Answer : D

Q 10 - Which of the following statements allows William to change his database user account password to bill?

A - create user william identified by bill;

B - alter user william identified by bill

C - create user william password bill;

D - alter user william password bill;

Answer : B

sql_questions_answers.htm
Advertisements