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 TRUNC(789.8389, 2)?

A - 789.84

B - 789.83

C - 78

D - 789.00

Answer : B

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

Answer : D

Q 9 - Which of the following code will create an index named

stu_marks_ind on the columns student_code and percentage_of_marks of the STUDENTS table.

Now which will delete the index stu_marks_ind.

Which of the following code will delete an index stu_marks_ind on the columns student_code and percentage_of_marks of the STUDENTS table?

A - drop index stu_marks_ind;

B - delete index stu_marks_ind;

C - drop stu_marks_ind;

D - drop index stu_marks_ind on students;

Answer : A

sql_questions_answers.htm
Advertisements