SQL is the bread and butter of an analyst. You can’t survive in the Data Science industry with a grip on this ‘easy-looking’ query language. I have been interviewed for more than 30 companies in the past 3-4 years. SQL rounds are mostly a rapid fire round where you either keep on answering all the answers or start missing them after a threshold.
This is one of those rounds in which you can impress the interviewer. Recently, I have been taking interviews and I can assure you that most of the logics asked in the interviews are repeated, no upto some extent, but completely repeated 😛
Following is the point charter:-
5 correct – SQL God, You are going to nail 9/10 SQL interviews
4 correct – Really Good, clearing the SQL rounds should not be a problem
3 correct – Ummm..Dicey, you should be able to crack a few rounds
2 correct – You need at least 2-3 weeks before you start applying
1 correct – Padh lo Beta, sochna bhi nai apply krne ka
0 correct – Try an MBA/MS in Analytics/SBI PO/UPSC
Please comment your answer or send it directly to me over Linkedin
Q1. Suppose there is a Movie Theatre with 26 rows(A,B,C..Z) and in each row you have 6 seats. The structure of table is given below
| Date | Row_No | Seat_No | Occupied | Name |
| 04-Apr-20 | A | A1 | Yes | Kuchi Bhi |
| 04-Apr-20 | A | A2 | Yes | Kuchi Bhi |
| 04-Apr-20 | A | A3 | No | |
| 04-Apr-20 | A | A4 | No | |
| 04-Apr-20 | A | A5 | No | |
| 04-Apr-20 | A | A6 | No | |
| 04-Apr-20 | B | B1 | Yes | Kuchi Bhi |
| 04-Apr-20 | B | B2 | No | |
| 04-Apr-20 | B | B3 | No | |
| 04-Apr-20 | B | B4 | Yes | Kuch Bhi |
| 04-Apr-20 | B | B5 | No | |
| 04-Apr-20 | B | B6 | Yes | Kuchi Bhi |
First, let me know all the starting seats where the number of consecutive vacant seats is 2 (B2 here)
Secondly, write a generalised approach to solve for any number of vacant seats. Basically, you need to create a table with two columns,
1. Seat_No
2. Number of consecutive vacant seats
Q2. There are multiple ways to get the 3rd highest salary, write down at least three. This question is important because the moment you tell the interviewer the first way, he/she will ask to solve the same in any other way
Hint –
1. Naive Approach
2. Inner Query
3. Ranking
Q3. I don’t remember any interview which doesn’t have this question
| Table A | Table B | |
| 1 | 1 | |
| 1 | 1 | |
| 1 | 1 | |
| 1 | ||
| 1 |
There are two tables, column name in Table A is X and in Table B is Y
How many rows will the resultant have, if you do:-
a. inner join
b. left join
c. right join
d. outer join
e. cross join
Justify your answer
Q4. I own 5 restaurants in Bangalore, following is the table of business, get me the date on which each of these restaurant crossed a total revenue of Rs.10,000
| Restaurant | Date | Revenue |
| Bangalore Mandrian | 01/04/20 | 5000 |
| Bangalore Mandrian | 02/04/20 | 4000 |
| Bangalore Mandrian | 03/04/20 | 3000 |
| Bangalore Mandrian | 04/04/20 | 6000 |
| Boondock Bistro | 01/04/20 | 7000 |
| Boondock Bistro | 02/04/20 | 3000 |
| Boondock Bistro | 03/04/20 | 5000 |
| Oliver’s | 02/04/20 | 11000 |
| Oliver’s | 03/04/20 | 8000 |
| Oliver’s | 04/04/20 | 9000 |
| Whitefiled Social | 02/04/20 | 10000 |
| Punjabi By Nature | 03/04/20 | 8000 |
Q5. There is a table with employee and manager information, the schema is given below. Write a query to get the EmployeeName and ManagerName.
Hint – Consider the edge cases, i.e. your query should cater the Manager Name of the CEO as well
You can access – 300+ Data Science Interview Questions covering SQL,R,Python,Case Studies, Guesstimates, Statistics, and Machine Learning Questions in the embedded link.
Keep Learning 🙂
The Data Monk
The Data Monk services
We are well known for our interview books and have 70+ e-book across Amazon and The Data Monk e-shop page . Following are best-seller combo packs and services that we are providing as of now
- YouTube channel covering all the interview-related important topics in SQL, Python, MS Excel, Machine Learning Algorithm, Statistics, and Direct Interview Questions
Link – The Data Monk Youtube Channel - Website – ~2000 completed solved Interview questions in SQL, Python, ML, and Case Study
Link – The Data Monk website - E-book shop – We have 70+ e-books available on our website and 3 bundles covering 2000+ solved interview questions. Do check it out
Link – The Data E-shop Page - Instagram Page – It covers only Most asked Questions and concepts (100+ posts). We have 100+ most asked interview topics explained in simple terms
Link – The Data Monk Instagram page - Mock Interviews/Career Guidance/Mentorship/Resume Making
Book a slot on Top Mate
The Data Monk e-books
We know that each domain requires a different type of preparation, so we have divided our books in the same way:
1. 2200 Interview Questions to become Full Stack Analytics Professional – 2200 Most Asked Interview Questions
2.Data Scientist and Machine Learning Engineer -> 23 e-books covering all the ML Algorithms Interview Questions
3. 30 Days Analytics Course – Most Asked Interview Questions from 30 crucial topics
You can check out all the other e-books on our e-shop page – Do not miss it
For any information related to courses or e-books, please send an email to nitinkamal132@gmail.com
Want 2,200+ More Questions Like This?
The Data Monk has compiled the most comprehensive analytics interview question bank — SQL, Python, ML, Statistics & Case Studies. Built by 50+ experts from Amazon, Flipkart & OYO.