MLStackMLSCCafé
 
 
Sign in with GoogleSign in with Google. Opens in new tab
Master Your ML & AIAI Interview
2103 Curated Machine Learning, Data Science, AI & LLMs Interview Questions
Answered To Get Your Next Six-Figure Job Offer
👨‍💻 Having Full-Stack & Coding Interview? Check  FullStack.Cafe - 3877 Full-Stack, Coding & System Design Questions and AnswersHaving Full-Stack & Coding Interview? Check 👨‍💻 FullStack.Cafe - 3877 Full-Stack, Coding & System Design Questions and Answers

Top 52 SQL Interview Questions

Entry Junior Mid Senior Expert
Sign in with GoogleSign in with Google. Opens in new tab
Learning Progress:

SQL Theoretical Questions

Q1:   

Define a temp table

  
Add to PDF   Entry 
Q2:   

What is PRIMARY KEY?

  
Add to PDF   Entry 
Q3:   

What is a VIEW?

  
Add to PDF   Entry 
Q4:   

What is DEFAULT?

  
Add to PDF   Junior 
Q5:   

What is FOREIGN KEY?

  
Add to PDF   Junior 
Q6:   

What is Normalisation?

  Related To: Databases
Add to PDF   Junior 
Q7:   

What is the difference between Data Definition Language (DDL) and Data Manipulation Language (DML)?

  
Add to PDF   Junior 
Q8:   

What is the difference between TRUNCATE and DELETE?

  Related To: MySQL
Add to PDF   Junior 
Q9:   

What is the difference between WHERE clause and HAVING clause?

  
 Add to PDF   Mid 
Q10:   

What are the difference between Clustered and a Non-clustered index?

  Related To: Databases
 Add to PDF   Mid 
Q11:   

How does a Hash index work?

  
 Add to PDF   Mid 
Q12:   

What is the difference between INNER JOIN and OUTER JOIN?

  
 Add to PDF   Mid 
Q13:   

What is Collation?

  
 Add to PDF   Mid 
Q14:   

What's the difference between a Primary Key and a Unique Key?

  Related To: Databases
 Add to PDF   Mid 
Q15:   

How can View be used to provide security layer for your app?

  Related To: MySQL
 Add to PDF   Mid 
Q16:   

What is the difference between INNER JOIN, OUTER JOIN, FULL OUTER JOIN?

  
 Add to PDF   Mid 
Q17:   

What is the difference between JOIN and UNION?

  
 Add to PDF   Mid 
Q18:   

Discuss INNER JOIN ON vs WHERE clause (with multiple FROM tables)

  
 Add to PDF   Mid 
Q19:   

Describe the difference between truncate and delete

  
 Add to PDF   Mid 
Q20:   

What is Denormalization?

  Related To: Databases
 Add to PDF   Mid 
Q21:   

What is the difference between UNION and UNION ALL?

  
 Add to PDF   Mid 
Q22:   

Define ACID Properties

  Related To: Databases
 Add to PDF   Mid 
Q23:   

How a database index can help performance?

  Related To: Databases
 Add to PDF   Mid 
Q24:   

What is faster, one big query or many small queries?

  Related To: MySQL
 Add to PDF   Senior 
Q25:   

What is the cost of having a database index?

  Related To: Databases
 Add to PDF   Senior 
Q26:   

What is an execution plan, and how do you use it to optimize a slow query?

  
 Add to PDF   Senior 
Q27:   

Explain the difference between Exclusive Lock and Update Lock

  Related To: Databases
 Add to PDF   Senior 
Q28:   

How does B-trees Index work?

  Related To: Databases
 Add to PDF   Senior 
Q29:   

How would you implement Linear Regression Function in SQL?

  Related To: Linear Regression
 Add to PDF   Senior 
Q30:   

What is the difference among UNION, MINUS and INTERSECT?

  
 Add to PDF   Senior 
Q31:   

Name some disadvantages of a Hash index

  Related To: Databases
 Add to PDF   Expert 
Q32:   

What is the difference between B-Tree, R-Tree and Hash indexing?

  Related To: Databases
 Add to PDF   Expert 
Q33:   

How does database Indexing work?

  Related To: Databases
 Add to PDF   Expert 
Q34:   

What are some other types of Indexes (vs B-Trees)?

  Related To: Databases
 Add to PDF   Expert 
Q35:   

What is Optimistic Locking and Pessimistic Locking?

  Related To: Databases
 Add to PDF   Expert 

SQL Practical Challenges

Q1:   

What is a Common Table Expression (WITH / CTE), and when would you use it?

  
 Add to PDF   Junior 
Q2:   

Rising Temperature Challenge

  
 Add to PDF   Junior 
Q3:   

How to select first 5 records from a table?

  
  Add to PDF   Mid 
Q4:   

Duplicate Emails Challenge

  
  Add to PDF   Mid 
Q5:   

How would you find the second highest salary in a table?

  
  Add to PDF   Mid 
Q6:   

What is the difference between EXISTS and IN?

  
  Add to PDF   Mid 
Q7:   

What is the difference between ROW_NUMBER(), RANK(), and DENSE_RANK()?

  
  Add to PDF   Mid 
Q8:   

Find duplicate values in a SQL table

  Related To: MySQL
  Add to PDF   Mid 
Q9:   

How can we transpose a table using SQL (changing rows to column or vice-versa)?

  
  Add to PDF   Senior 
Q10:   

How to generate row number in SQL without ROWNUM

  
  Add to PDF   Senior 
Q11:   

Department Highest Salary Challenge

  
  Add to PDF   Senior 
Q12:   

Trips and Users Challenge

  
  Add to PDF   Senior 
Q13:   

What would happen without an Index?

  
  Add to PDF   Senior 
Q14:   

How does TRUNCATE and DELETE operations effect Identity?

  Related To: T-SQL
  Add to PDF   Senior 
Q15:   

Delete duplicate values in a SQL table

  
  Add to PDF   Senior 
Q16:   

How can I do an UPDATE statement with JOIN in SQL?

  
  Add to PDF   Senior 
Q17:   

Select first row in each GROUP BY group (greatest-n-per-group problem)?

  
  Add to PDF   Expert 
 

Prepare for AI developer and engineer interviews with 19 answered OpenClaw questions covering Gateway architecture, channels, agent workspaces, memory, MCP, model failover, multi-agent routing, security, sandboxing, approvals, and remote operations....

Prepare for AI agent developer interviews with 15 Model Context Protocol (MCP) questions covering tools, resources, prompts, JSON-RPC, transports, roots, sampling, security, and practical MCP server design....

Amazone runs the internet as we know it. Amazon Web Services (AWS) offers a comprehensive suite of machine learning (ML) services that cater to various needs and expertise levels. Follow along and learn the 23 most common AWS machine-learning intervi...

Azure Machine Learning (Azure ML) is a cloud-based service for creating and managing machine learning solutions. It’s designed to scale, distribute, and deploy machine learning models to the cloud. Follow along and learn the 23 most common Azure Mach...
Hadoop is an open-source big data processing framework. It leverages distributed computing to store and process large datasets in a fault-tolerant manner. According to recent reports, Apache Hadoop is one of the most sought-after big data skills with...
Apache Spark is a unified analytics engine for large-scale data processing. It is built to handle various use cases in big data analytics, including data processing, machine learning, and graph processing. Follow along and learn the 23 most common an...
Scala is a powerful language with functional programming capabilities that can be a good choice for data science, especially in big data and distributed computing scenarios. As an example, Apache Spark, a popular distributed data processing framework...
PyTorch popularity as a Deep Learning framework of choice is on the rise. As of December 2022, 62% of the academic papers were implemented in PyTorch whereas only 4% were for TensorFlow. Follow along and prepare effectively with these key 30 PyTorch ...
The use of Artificial Intelligence (AI) in machine learning and data science enabled advancements in areas such as natural language processing, computer vision, recommendation systems, fraud detection, predictive analytics, and personalized medicine....
Optimization algorithms are extensively used in training machine learning models. Data engineers employ algorithms like gradient descent, stochastic gradient descent, and variants (e.g., Adam, RMSprop) to optimize the model parameters and minimize th...