- SQL Tutorial
- SQL - Home
- SQL - Overview
- SQL - RDBMS Concepts
- SQL - Databases
- SQL - Syntax
- SQL - Data Types
- SQL - Operators
- SQL - Expressions
- SQL Database
- SQL - Create Database
- SQL - Drop Database
- SQL - Select Database
- SQL - Rename Database
- SQL - Show Database
- SQL - Backup Database
- SQL Table
- SQL - Create Table
- SQL - Show Tables
- SQL - Rename Table
- SQL - Truncate Table
- SQL - Clone Tables
- SQL - Temporary Tables
- SQL - Alter Tables
- SQL - Drop Table
- SQL - Delete Table
- SQL - Constraints
- SQL Queries
- SQL - Insert Query
- SQL - Select Query
- SQL - Select Into
- SQL - Insert Into Select
- SQL - Update Query
- SQL - Delete Query
- SQL - Sorting Results
- SQL Views
- SQL - Create Views
- SQL - Update Views
- SQL - Drop Views
- SQL - Rename Views
- SQL Operators and Clauses
- SQL - Where Clause
- SQL - Top Clause
- SQL - Distinct Clause
- SQL - Order By Clause
- SQL - Group By Clause
- SQL - Having Clause
- SQL - AND & OR
- SQL - BOOLEAN (BIT) Operator
- SQL - LIKE Operator
- SQL - IN Operator
- SQL - ANY, ALL Operators
- SQL - EXISTS Operator
- SQL - CASE
- SQL - NOT Operator
- SQL - NOT EQUAL
- SQL - IS NULL
- SQL - IS NOT NULL
- SQL - NOT NULL
- SQL - BETWEEN Operator
- SQL - UNION Operator
- SQL - UNION vs UNION ALL
- SQL - INTERSECT Operator
- SQL - EXCEPT Operator
- SQL - Aliases
- SQL Joins
- SQL - Using Joins
- SQL - Inner Join
- SQL - Left Join
- SQL - Right Join
- SQL - Cross Join
- SQL - Full Join
- SQL - Self Join
- SQL - Delete Join
- SQL - Update Join
- SQL - Left Join vs Right Join
- SQL - Union vs Join
- SQL Keys
- SQL - Unique Key
- SQL - Primary Key
- SQL - Foreign Key
- SQL - Composite Key
- SQL - Alternate Key
- SQL Indexes
- SQL - Indexes
- SQL - Create Index
- SQL - Drop Index
- SQL - Show Indexes
- SQL - Unique Index
- SQL - Clustered Index
- SQL - Non-Clustered Index
- Advanced SQL
- SQL - Wildcards
- SQL - Comments
- SQL - Injection
- SQL - Hosting
- SQL - Min & Max
- SQL - Null Functions
- SQL - Check Constraint
- SQL - Default Constraint
- SQL - Stored Procedures
- SQL - NULL Values
- SQL - Transactions
- SQL - Sub Queries
- SQL - Handling Duplicates
- SQL - Using Sequences
- SQL - Auto Increment
- SQL - Date & Time
- SQL - Cursors
- SQL - Common Table Expression
- SQL - Group By vs Order By
- SQL - IN vs EXISTS
- SQL - Database Tuning
- SQL Function Reference
- SQL - Date Functions
- SQL - String Functions
- SQL - Aggregate Functions
- SQL - Numeric Functions
- SQL - Text & Image Functions
- SQL - Statistical Functions
- SQL - Logical Functions
- SQL - Cursor Functions
- SQL - JSON Functions
- SQL - Conversion Functions
- SQL - Datatype Functions
- SQL Useful Resources
- SQL - Questions and Answers
- SQL - Quick Guide
- SQL - Useful Functions
- SQL - Useful Resources
- SQL - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
SQL Mock Test
This section presents you various set of Mock Tests related to SQL Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
SQL Mock Test I
Q 1 - Which of the following is not true about SQL statements?
A - SQL statements are not case sensitive.
B - SQL statements can be written on one or more lines.
Answer : D
Q 2 - 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 full name of a student, with a column heading "Name"
A - select first_name, last_name as “Name” from students;
B - select Name from students;
Answer : C
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 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;
Answer : B
Q 4 - 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 with honours_subject ‘Eng01’?
A - select student_code, first_name, last_name from students where honours_subject = ‘Eng01’;
B - select student_code, first_name, last_name from students where honours_subject is ‘Eng01’;
C - select student_code, first_name, last_name where honours_subject = ‘Eng01’ from students;
D - select student_code, first_name, last_name from students;
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 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 6 - 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 7 - 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 names of all the students whose email ids are not provided?
A - select first_name, last name from students where email = 0;
B - select first_name, last name from students where email = ‘ ‘;
C - select first_name, last name from students where email is null;
D - select first_name, last name from students where email = ‘null’;
Answer : C
Q 8 - 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 names of all the students whose honours subject is English and percentage of marks more than 80, or honours subject is Spanish and percentage of marks more than 80?
Answer : A
Q 9 - 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 names of all the students whose honours subject is English, or honours subject is Spanish and percentage of marks more than 80?
Answer : B
Q 10 - 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 names of all students in descending order of percentage of marks?
A - select first_name, last name, percentage_of_marks from students order by percentage_of_marks;
Answer : C
Q 11 - 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 names and percentage of marks of all students sorted by honours subject, and then order by percentage of marks?
Answer : A
Q 12 - 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 correctly display the students’ first name, last name, honours subject and date of birth, born between July 1st 1996, and 30th June 1999.
Answer : D
Q 13 - Which of the following is not true about single row functions?
A - They operate on single rows only and return one result per row.
B - They accept arguments that could be a column or any expression.
Answer : C
Q 14 - Which of the following is not a character manipulation function?
Answer : D
Answer : A
Q 16 - What is returned by SUBSTR(‘TUTORIALS POINT’, 1, 9)?
Answer : C
Q 21 - 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 22 - You want to calculate the tax payable by the employees of an organization. If the employee gets a commission, then the tax would be calculated on commission plus salary, if the employee does not get any commission, then the tax would be calculated on salary only. Which function should you use for calculating tax?
Answer : B
Q 23 - For some particular assignment, you need to compare two values, if both are equal, the result would be null, and if the values are not equal then the first value should be returned. Which function should you use?
Answer : C
Q 24 - Which of the following is not true about the COALESCE function?
A - It takes multiple alternate values.
B - It returns the first non-null expression in the parameter list.
C - It returns the first value in the parameter list if it is null.
Answer : C
Q 25 - Which of the following is true about Cartesian Products?
A - A Cartesian product is formed when a join condition is omitted.
B - A Cartesian product is formed when a join condition is valid.
C - Some rows in the first table are joined to all rows in the second table.
D - All rows in the first table are joined to some rows in the second table.
Answer : A
Answer Sheet
Question Number | Answer Key |
---|---|
1 | D |
2 | C |
3 | B |
4 | A |
5 | A |
6 | A |
7 | C |
8 | A |
9 | B |
10 | C |
11 | A |
12 | D |
13 | C |
14 | D |
15 | A |
16 | C |
17 | A |
18 | A |
19 | B |
20 | D |
21 | A |
22 | B |
23 | C |
24 | C |
25 | A |