SQL Interview Questions 2026

Published July 22, 2026 · Updated July 22, 2026

28 SQL interview questions from General, Adobe, Canva, Deloitte. All difficulty levels, all roles. Upvoted by engineers who were asked them.

28 questions
Companies: General, Adobe, Canva, Deloitte
1452 upvotes

SQL Questions by Company

General (9)

General Medium Scenario round 5–8 YearsSnowflakeSQL

A production table was accidentally deleted 2 hours ago. How would you recover the data using Snowflake Time Travel?

↑ 79 upvotes · 57 engineers asked this · Data Engineer
General Hard Scenario round 5–8 YearsSnowflakeSQL

A critical table was dropped 10 days ago and the Time Travel retention period has expired. What recovery options are available? Explain how Fail-safe works and its limitations.

↑ 61 upvotes · 44 engineers asked this · Data Engineer
General Medium Scenario round 5–8 YearsSnowflakeSQL

Your team needs a test environment containing production data without duplicating storage costs. How would you use Zero Copy Cloning and what are its benefits and limitations?

↑ 72 upvotes · 51 engineers asked this · Data Engineer
General Hard Scenario round 5–8 YearsSnowflakeSQLPython

Snowpipe is ingesting duplicate records from cloud storage. How would you detect, prevent, and remediate duplicate data in Snowflake?

↑ 83 upvotes · 59 engineers asked this · Data Engineer
General Hard Scenario round 5–8 YearsSnowflakeSQLPython

A query that previously completed in 2 minutes now takes 20 minutes. Describe your systematic approach to troubleshooting and optimizing performance in Snowflake.

↑ 91 upvotes · 65 engineers asked this · Data Engineer
General Medium Scenario round 5–8 YearsSnowflakeSQL

Compare Snowpipe and COPY INTO. When would you choose one over the other?

↑ 68 upvotes · 49 engineers asked this · Data Engineer
General Medium Scenario round 5–8 YearsSnowflakeSQL

Compare Time Travel and Fail-safe in Snowflake. What are the key differences and use cases for each?

↑ 64 upvotes · 46 engineers asked this · Data Engineer
General Medium Scenario round 5–8 YearsSnowflakeSQL

Compare Temporary, Transient, and Permanent tables in Snowflake. When would each table type be appropriate?

↑ 71 upvotes · 52 engineers asked this · Data Engineer
General Medium Scenario round 5–8 YearsSnowflakeSQL

Compare Streams and Tasks in Snowflake. How do they work together to support Change Data Capture (CDC) workflows?

↑ 77 upvotes · 55 engineers asked this · Data Engineer

Adobe (1)

Adobe Hard Technical round 4–7 YearsSnowflakeSQL

Your Snowflake query is slow even with a large warehouse. How do you investigate and optimize it?

↑ 107 upvotes · 84 engineers asked this · Data Engineer

Canva (1)

Canva Hard Scenario round 5–8 YearsSnowflakeSQL

You have a 10TB Snowflake table queried daily by 50 analysts with very different filter patterns. How do you optimize it?

↑ 113 upvotes · 89 engineers asked this · Data Engineer

Deloitte (2)

Deloitte Medium Technical round 2–5 YearsSnowflakeSQL

What is Time Travel in Snowflake and how does it differ from Fail-Safe?

↑ 81 upvotes · 64 engineers asked this · Data Engineer
Deloitte Medium Technical round 2-5 yearsSQL

Write a query to find customers who have placed orders in every month of the current year, given an Orders table with customer_id and order_date.

↑ 23 upvotes · 14 engineers asked this · Senior SDE

Airbnb (2)

Airbnb Hard System Design round 3-7 yearsSystem DesignSQLDistributed Systems

Design the booking system for a home-rental marketplace, ensuring two guests can never double-book the same property for overlapping dates under concurrent requests.

↑ 48 upvotes · 22 engineers asked this · Senior SDE
Airbnb Medium Technical round 2-5 yearsSQL

Write a query to find hosts whose average review rating dropped by more than 0.5 stars comparing their most recent 10 reviews to their prior 10 reviews.

↑ 34 upvotes · 25 engineers asked this · Data Engineer

Stripe (2)

Stripe Hard Technical round 3-7 yearsSecuritySystem DesignSQL

Explain idempotency keys in a payments API. What specific failure mode do they prevent, and how would you design the storage layer for them so they don't become a bottleneck?

↑ 40 upvotes · 20 engineers asked this · Senior SDE
Stripe Hard System Design round 4-8 yearsSystem DesignSQL

Design a double-entry ledger system for tracking money movement between accounts. Why is this pattern preferred over simply updating a balance column, especially for auditability?

↑ 33 upvotes · 12 engineers asked this · Senior SDE

LinkedIn (1)

LinkedIn Medium Technical round 2-5 yearsSQL

Write a query to find the top 3 skills most commonly shared between pairs of connected users, given a UserSkills table and a Connections table.

↑ 28 upvotes · 17 engineers asked this · Data Engineer

Salesforce (2)

Salesforce Hard System Design round 4-8 yearsSQLSystem Design

Design a multi-tenant database architecture for a CRM SaaS product with 100,000 customers, where each customer's data must be strictly isolated but the schema is largely shared. Compare separate databases per tenant vs. shared schema with a tenant_id column.

↑ 35 upvotes · 14 engineers asked this · Senior SDE
Salesforce Medium Technical round 2-5 yearsSQL

Write a query to find customers who placed an order in each of the last 3 consecutive months, using an Orders table with customer_id and order_date.

↑ 30 upvotes · 19 engineers asked this · Senior SDE

Atlassian (1)

Atlassian Medium Technical round 2-6 yearsSQLSystem Design

Design the data model for a Kanban board (like Trello/Jira) supporting boards, columns, and cards, where cards can be reordered within and across columns efficiently without renumbering every card on each move.

↑ 26 upvotes · 13 engineers asked this · Senior SDE

Oracle (1)

Oracle Hard Technical round 3-7 yearsSQL

A query that joins 4 tables and runs fine on a 1M-row test database takes 40 seconds in production on 500M rows. Walk through your approach to diagnosing and fixing it.

↑ 37 upvotes · 24 engineers asked this · Senior SDE

Cognizant (5)

Cognizant Easy Technical round 0-3 yearsSQL

Explain the difference between INNER JOIN, LEFT JOIN, and FULL OUTER JOIN with a simple example of Orders and Customers tables.

↑ 30 upvotes · 22 engineers asked this · Developer
Cognizant Medium Technical round 2-5 yearsSQL

A SELECT query filtering on a non-indexed column takes 8 seconds on a 10 million row table. Would adding an index always help? What's the trade-off of adding too many indexes?

↑ 26 upvotes · 15 engineers asked this · Developer
Cognizant Medium Technical round 1-4 yearsSQL

What problem does database normalization (1NF, 2NF, 3NF) actually solve? Give an example of an update anomaly in an unnormalized table.

↑ 21 upvotes · 12 engineers asked this · Developer
Cognizant Hard Technical round 2-6 yearsSQL

Write a query to find, for each department, the employee with the second-highest salary, using window functions instead of a correlated subquery.

↑ 33 upvotes · 25 engineers asked this · Developer
Cognizant Medium Technical round 2-5 yearsSQL

How would you find out why a specific SQL query is slow before making any changes to it?

↑ 19 upvotes · 8 engineers asked this · Developer

Grab (1)

Grab Medium Technical round 2-5 yearsSQL

Write a query to find, for each city, the percentage of rides that were cancelled within 2 minutes of being booked, given a Rides table with city, booked_at, and cancelled_at.

↑ 22 upvotes · 13 engineers asked this · Data Engineer

Practice these questions with AI feedback

Get instant grading on your answers, identify your weak areas, and generate a personalised 14-day study plan — all free.

Build my study plan →

SQL questions at each company

General SQL Cognizant SQL

Frequently asked questions

A production table was accidentally deleted 2 hours ago. How would you recover the data using Snowflake Time Travel?
A production table was accidentally deleted 2 hours ago. How would you recover the data using Snowflake Time Travel?
A critical table was dropped 10 days ago and the Time Travel retention period has expired. What recovery options are available? Explain how Fail-safe works and its limitations.
A critical table was dropped 10 days ago and the Time Travel retention period has expired. What recovery options are available? Explain how Fail-safe works and its limitations.
Your team needs a test environment containing production data without duplicating storage costs. How would you use Zero Copy Cloning and what are its benefits and limitations?
Your team needs a test environment containing production data without duplicating storage costs. How would you use Zero Copy Cloning and what are its benefits and limitations?
Snowpipe is ingesting duplicate records from cloud storage. How would you detect, prevent, and remediate duplicate data in Snowflake?
Snowpipe is ingesting duplicate records from cloud storage. How would you detect, prevent, and remediate duplicate data in Snowflake?
A query that previously completed in 2 minutes now takes 20 minutes. Describe your systematic approach to troubleshooting and optimizing performance in Snowflake.
A query that previously completed in 2 minutes now takes 20 minutes. Describe your systematic approach to troubleshooting and optimizing performance in Snowflake.