SQL Tricky Interview Questions Preparation Course

This course contains tricky and nasty SQL interview questions that an interviewer asks. It is a compilation of advanced SQL

Given an Employee table with Manager_ID as column, print First name, Manager ID and Level of employees in Organization Structure?

Answer: In Oracle, we can CONNECT BY clause for this. The starting point will be the employee who does not

Write a query to create an empty table from an existing table?

Answer: An empty table is a table with same structure as the given table. But it does not contain records.

Write a SQL query to maximum Zipcode from a table without using MAX or MIN aggregate functions.

Consider Zipcode_list table with column Zipcode ZIPCODE 7500 7525 7550 7600 7575 Answer: Point to be noted is that the

Given a list of student names and grade. Write a query to print a comma separated list of student names in a grade.

Students Grade | Name 1 | John 1 | George 1 | Jane 2 | Smith 2 | Anne 2

What is the difference between Correlated and Un-correlated Sub query?

When we write a subquery in such a way that inner subquery and outer main query are interdependent, then we

Which SQL feature can be used to view data in a table sequentially?

In this question, we need to clarify with interviewer if it is about SEQUENCE based on some value in data

Write SQL Query to get Student Name and number of Students in same grade.

Given Student Table ID | Name | Grade 1 | George | 1 2 | Smith | 2 Answer: We

Write SQL Query to get the list of grades with total score more than average score.

Consider Student and Grade tables Student: ID, name, grade_ID, score Grade: ID, grade_num Answer: We can use WITH clause to