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 the distinct honours subjects in the STUDENTS table?

A - select honours_subject from students;

B - select distinct honours_subject from students;

C - select all honours_subject from students;

D - select * from students;

Answer : B

Q 2 - Which of the following is not a character manipulation function?

A - concat

B - substr

C - instr

D - coalesce

Answer : D

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 4 - Which of the following functions can be used on both numeric as well as non-numeric data?

A - COUNT

B - AVG

C - STDDEV

D - VARIANCE

Answer : A

Q 5 - You want to calculate the minimum percentage of marks obtained under each honours group students, where the minimum marks is more than the minimum marks in economics department. Under which clause should the subquery be?

A - WHERE clause

B - FROM clause

C - HAVING clause

D - None of the above.

Answer : C

Q 7 - Consider the following schema −

LOCATIONS(subject_code, department_name, location_id, city);

Which code snippet will alter the table LOCATIONS and change the datatype of the column CITY to varchar2(30)?

A - ALTER TABLE locations MODIFY COLUMN (city varchar2(30));

B - MODIFY TABLE locations ADD (city varchar2(30));

C - ALTER TABLE locations MODIFY (city varchar2(30));

D - None of the above.

Answer : C

Answer : C


sql_questions_answers.htm

Advertisements