CampusX Live - SQL Interview Questions For Data Science
CampusX Live - SQL Interview Questions For Data Science
● Common Questions
1. Write a query to add multiple cols in a table
2. Write a query to add/delete multiple cols in a table
3. Write a query to find out the 2nd highest value in a table
4. Find max value without using ORDER BY
5. Find managers of all employees
6. Use of wild cards
7. If else based questions
8. Find category-wise top value
9. Find/delete all the duplicate values
10. Joining tables
● Theory Questions
1. SQL Vs NoSQL Databases
2. Tables required for many to many relationship
3. Draw schema design for swiggy.
4. Types of Joins -> Union Vs Union All
5. OLAP Vs OLTP [Normalized Vs Denormalized Data]
6. Database keys
7. Types of normalization
8. What are indexes in Databases and what are it’s types
9. What are transactions in databases? Explain ACID
properties.
10. Define
a. Views
b. Stored Procedures
● Case Study
1. You are building an application like tinder, consider the
following scenarios:
● There will be multiple users
● Users can right swipe each other to send dating
request
● Users can send any number of requests to other
users
Convert the above business scenario to database
tables
Write a query to print the name and details of all
the users to whom a particular user has sent
request.
Write a query to find the name of the user who has
sent 2nd most number of requests, also print the
count.
Homework - Find the name of the user who has
received min number of requests
Find all the matches for a particular user
Homework - Find all the unique couples
2. Swiggy Case Study
a. Find customers who have never ordered
b. Average Price/dish
c. Find top restautant in terms of number of orders for
a given month
d. restaurants with monthly sales > x for a particular
month
e. Show all orders with order details for a particular
customer in a particular date range
f. Customer -> favorite food
g. Find the restaurant with max repeat customers
h. Find most loyal customers for all
restaurant[Homework]
i. Month over month revenue growth of a
restaurant/swiggy
j. Most Paired Products