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

Answer : C

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 - 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 will correctly list the average percentage of marks in each honours subject, when the average is more than 50 percent?

A - select honours_subject, avg(percentage_of_marks) from students where avg(percentage_of_marks) > 50.0 group by honours_subject;

B - select honours_subject, avg(percentage_of_marks) from students having avg(percentage_of_marks) > 50.0 group by honours_subject;

C - select honours_subject, avg(percentage_of_marks) from students group by honours_subject having avg(percentage_of_marks) > 50.0;

D - None of the above.

Answer : B

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 retrieve data from the view all_marks_english, created in the previous question?

A - select view all_marks_english;

B - select from all_marks_english;

C - retrieve from all_marks_english;

D - select * from all_marks_english;

Answer : D

Q 10 - Which of the following code would grant the role student_admin to a user named william?

A - grant student_admin to william;

B - grant to william student_admin;

C - grant william student_admin;

D - None of the above.

Answer : A

sql_questions_answers.htm
Advertisements