HomeInterview QuestionsSql Interview Questions

Sql Interview Questions

232 real Sql questions asked in live technical interviews — each with a model answer. Updated weekly.

🎤 Auto-captured by Assisting AI during live interviews

These Sql interview questions were captured from real interviews by candidates using Assisting AI. Each links to a full model answer. For real-time help during your own interview, get Assisting AI from ₹500/day.

What is the difference between UNION and UNION ALL, and when would you use each?🟡 Medium · Conceptual · Asked 47×What would your inner query look like?🟡 Medium · Conceptual · Asked 23×If we join two tables with an inner join, how many records will result? How many combinations will be produced?🟡 Medium · Conceptual · Asked 12×Which joins have you used?🟢 Easy · Conceptual · Asked 2×Given the EMPLOYEE table, write a query to retrieve each employee’s name along with their manager’s name.🟡 Medium · Coding · Asked 2×Write a query to find the second highest salary.🟢 Easy · Coding · Asked 2×Write a simple SQL query to find customers who placed orders on three consecutive days.🟡 Medium · Coding · Asked 2×What is the difference between one-to-one and one-to-many relationships?🟢 Easy · Conceptual · Asked 2×For example, how can we use a CTE to simplify joins between tables?🟡 Medium · Conceptual · Asked 1×What is the difference between inner join and outer join?🟢 Easy · Conceptual · Asked 1×What is the output of the ROW_NUMBER() function in SQL?🟢 Easy · Conceptual · Asked 1×How do you calculate a running total, such as a running salary, where the first entry is 1000 rupees and the second is 3000 rupees, accumulating over time?🟡 Medium · Coding · Asked 1×For each employee, generate a new column that contains the running total of salaries.🟡 Medium · Coding · Asked 1×Add a new column called running salary to the dataset, computing the cumulative sum of salaries.🟡 Medium · Coding · Asked 1×Write a SQL query to retrieve the revenue for the previous year.🟡 Medium · Coding · Asked 1×Write an SQL query that, given a table with columns id, year, and revenue, returns for each row the previous year's revenue and the revenue difference.🟡 Medium · Coding · Asked 1×Using a window function, how would you find duplicate rows in a table using SQL?🟡 Medium · Coding · Asked 1×How do you fetch the second highest value in a table using a subquery?🟡 Medium · Coding · Asked 1×What is the count of records in the given tables?🟢 Easy · Conceptual · Asked 1×How many records are returned by the SQL join?🟢 Easy · Conceptual · Asked 1×Write an SQL query to select the top 10 users by order.🟢 Easy · Coding · Asked 1×Suppose you're given a dataset with 10 million rows and you need to perform a complex query that involves aggregating data from multiple tables. How would you optimize the query for better performance?🟡 Medium · Conceptual · Asked 1×Suppose you have a dataset with 10 million rows and need to run a complex query that aggregates data from multiple tables. How would you optimize the query for better performance?🟡 Medium · Conceptual · Asked 1×Suppose you're given a dataset with 100 million rows and you need to perform a complex join operation between two tables. How would you optimize the join operation for better performance?🟡 Medium · Conceptual · Asked 1×Write an SQL query that displays each employee’s name along with their manager’s name using a self‑join on the Employee table.🟡 Medium · Coding · Asked 1×Write an SQL query that returns the top two highest‑paid employees from each department.🟡 Medium · Coding · Asked 1×Write an SQL query that finds the employee(s) who earn the maximum salary in each department.🟡 Medium · Coding · Asked 1×Write an SQL query that lists all departments where the average salary is greater than 60,000.🟡 Medium · Coding · Asked 1×Write an SQL query that joins the Employee and Department tables to display employee name, department name, and salary, and then uses a window function to rank employees by salary within each department.🟡 Medium · Coding · Asked 1×Write an SQL query to display Employee Name, Department Name, and Salary, and another query to find the third highest salary from the Employee table.🟡 Medium · Coding · Asked 1×Write an SQL query to count the number of employees in each department.🟢 Easy · Coding · Asked 1×Write an SQL query to retrieve all employees whose salary exceeds the company's average salary.🟡 Medium · Coding · Asked 1×Write an SQL query to find the second highest distinct salary in the Employee table.🟡 Medium · Coding · Asked 1×Write an SQL query to find the second highest distinct salary from the employee table.🟡 Medium · Coding · Asked 1×Which columns would you select for partitioning if you want to perform partitioning on a particular table?🟡 Medium · Conceptual · Asked 1×How can a slow query be optimized to fetch results fast?🟡 Medium · Conceptual · Asked 1×Write a simple SQL query to fetch the third highest salary from the employee table.🟡 Medium · Coding · Asked 1×Let me give an SQL query; write code for it.🟡 Medium · Coding · Asked 1×If I use DELETE, is it possible to roll back?🟢 Easy · Conceptual · Asked 1×What is the difference between TRUNCATE and DELETE?🟢 Easy · Conceptual · Asked 1×Is a GROUP BY statement valid if there are no aggregate functions?🟢 Easy · Conceptual · Asked 1×Suppose there are many columns based on column X. I will be using GROUP BY on only two columns, even though there are 10 more columns. Is it a choice to use all columns for GROUP BY?🟡 Medium · Conceptual · Asked 1×On which column would you use GROUP BY?🟢 Easy · Conceptual · Asked 1×Is it possible to implement without GROUP BY?🟢 Easy · Conceptual · Asked 1×How do you use GROUP BY?🟢 Easy · Conceptual · Asked 1×How can I count the number of times each employee ID appears in a dataset?🟡 Medium · Coding · Asked 1×What queries are needed to create a Spark session?🟢 Easy · Conceptual · Asked 1×Write a Spark query to process the following data.🟡 Medium · Coding · Asked 1×Can you explain transaction isolation levels?🟢 Easy · Conceptual · Asked 1×Can you explain clustered and non-clustered indexes and how they are created?🟢 Easy · Conceptual · Asked 1×How do you optimize slow running SQL queries?🟡 Medium · Conceptual · Asked 1×Explain different types of joins in SQL.🟢 Easy · Conceptual · Asked 1×Find the top three products in each category.🟡 Medium · Coding · Asked 1×Write a pseudo SQL query to copy data from one table to another. Data is provided for reference.🟡 Medium · Coding · Asked 1×Given an orders table, an order_items table, and a products table, write a query to find products that were never sold.🟡 Medium · Coding · Asked 1×Write an SQL query to select the top 10 users by order count.🟢 Easy · Coding · Asked 1×How do you calculate the difference between two dates in SQL, for example between a higher date and a birth date?🟢 Easy · Conceptual · Asked 1×Can a foreign key have NULL and duplicate values?🟢 Easy · Conceptual · Asked 1×How do you calculate the difference between two dates in SQL? For example, if you want to calculate the difference between a hire date and a birth date, how would you do that?🟢 Easy · Conceptual · Asked 1×Are we not checking whether the first date is 25/26 and 26/27 are consecutive? We are not checking date consecutiveness anywhere in the query. Even the name has streaks for CD; we are not checking for consecutive tasks. Can we add a check for consecutive dates?🟡 Medium · Conceptual · Asked 1×Row numbers are used, but they don't check for consecutive purchases. The number only indicates whether there are more than three purchases. How can we modify this to check for consecutive purchases?🟡 Medium · Coding · Asked 1×Customer ID 1 meets the criteria because they made purchases on 25th Jan, 26th Jan, and 27th Jan – three consecutive days. Customer ID 2 does not meet the criteria because, although they made more than three purchases, the dates are not consecutive. Write an SQL query to find customer IDs of customers who have made purchases on at least three consecutive days.🟡 Medium · Coding · Asked 1×Given a list of customer purchase dates, identify customers who have not made a purchase on three consecutive dates.🟡 Medium · Coding · Asked 1×How do you optimize a data model to improve query performance, for example, reducing a query that currently takes minutes to run?🟡 Medium · Conceptual · Asked 1×Earlier we discussed the silver layer, where we mainly write data cleansing logic using PySpark. I'm curious: would you still use Databricks notebooks and PySpark commands to create the gold layer? Are you familiar with dbt and can you execute dbt using traditional SQL templates?🟡 Medium · Conceptual · Asked 1×Why can an INNER JOIN return fewer rows than either of the joined tables?🟢 Easy · Conceptual · Asked 1×Show the model syntax inside a dbt model. Is the SQL syntax to create a view for product?🟢 Easy · Coding · Asked 1×What is the difference between LAG and LEAD functions?🟢 Easy · Conceptual · Asked 1×Write a DELETE statement to remove duplicate records from a product table, keeping only one record for product ID 101.🟡 Medium · Coding · Asked 1×Are you familiar with window functions? Can you explain any window function you have used in real time?🟡 Medium · Conceptual · Asked 1×Assume you have a product table. How would you schedule a daily refresh at 5:00 UTC?🟡 Medium · Conceptual · Asked 1×Can you write an SQL statement to schedule a job that creates a task?🟡 Medium · Coding · Asked 1×Can you write a query to determine whether a table is permanent or temporary?🟡 Medium · Coding · Asked 1×How do you get the correct data sequence?🟢 Easy · Conceptual · Asked 1×Find out the time employees spend in the office for a day.🟡 Medium · Coding · Asked 1×Given the following customer data: Id | Email 1 | john.jones@xmail.com 2 | tracey.smith@newmail.com 3 | amy.sanders@royalmail.com 4 | rachel@gmail.com Create firstname and lastname columns with each value capitalized.🟢 Easy · Coding · Asked 1×Scenario: we have a massive sales table and a smaller product table. The join is taking too long. What would you do?🟡 Medium · Debugging · Asked 1×How do you find both the second highest and second lowest values in a dataset?🟡 Medium · Coding · Asked 1×Can you get a single dense rank?🟢 Easy · Conceptual · Asked 1×Provide the item with the second highest and second lowest sales. Also provide the most viable product, defined as the product with the lowest return rate and highest sales.🟡 Medium · Coding · Asked 1×Can you provide the second highest and second lowest sales items? Also, can you give the most viable product, defined as having the lowest return rate and highest sales?🟡 Medium · Coding · Asked 1×Do you identify slow running queries?🟡 Medium · Conceptual · Asked 1×Can you explain rank, dense rank, and row number?🟡 Medium · Conceptual · Asked 1×Can you tell the difference between rank, dense rank, and row number?🟡 Medium · Conceptual · Asked 1×Explain the result of joining two tables: Table1 has one column with 3 records: 1, 1, NULL. Table2 has one column with 2 records: 1, NULL. What will be the result of a LEFT JOIN and an INNER JOIN?🟡 Medium · Conceptual · Asked 1×Explain joins in SQL.🟢 Easy · Conceptual · Asked 1×Can you rewrite the query?🟡 Medium · Coding · Asked 1×Would you validate that changes improved performance? Would you check EXPLAIN ANALYZE?🟡 Medium · Conceptual · Asked 1×What specific indexes would you create for an optimized version to support those joins and filters?🟡 Medium · Conceptual · Asked 1×Can you rewrite the query in a more optimized way, removing any inefficient correlated subqueries?🟡 Medium · Coding · Asked 1×Can you tell me the types of joins in SQL?🟢 Easy · Conceptual · Asked 1×How confident are you in SQL? Rate yourself on a scale of 1 to 5.🟢 Easy · Behavioral · Asked 1×Write a query to print the matches played between teams in a round‑robin tournament.🟡 Medium · Coding · Asked 1×What would be the output of a left join? Suppose the master table is A and the other table is B. If we perform a left join, what would be the output?🟡 Medium · Conceptual · Asked 1×If you perform an inner join, many rows will become?🟢 Easy · Conceptual · Asked 1×In a query, many rows will come from which type of join?🟢 Easy · Conceptual · Asked 1×What are the types of joins? Write the output of each join.🟡 Medium · Conceptual · Asked 1×Given two tables A and B, can you write the number of rows that would result from an inner join, a left join, and an outer join?🟡 Medium · Conceptual · Asked 1×What are the types of joins in SQL?🟢 Easy · Conceptual · Asked 1×Given a table SCORE(ball INTEGER, score INTEGER) with ball numbers and scores, write a SQL query to calculate the average score per over.🟡 Medium · Coding · Asked 1×We have a table called score with two columns: ball (ball number) and score (score made on that ball). How would you calculate the average score per over?🟡 Medium · Coding · Asked 1×Can you explain the difference between the DENSE_RANK and ROW_NUMBER window functions?🟡 Medium · Conceptual · Asked 1×Are you familiar with SQL window functions?🟢 Easy · Conceptual · Asked 1×Let's have a scenario: let's say a database is experiencing performance bottlenecks. How would you optimize it to work better?🟡 Medium · Conceptual · Asked 1×To contain all 10 teams, each must play every other team at home and away. Can you write a query to do this?🟡 Medium · Coding · Asked 1×I want to create a prediction table that lists each of the 10 teams playing every other team at home and away. How can I generate this table?🟡 Medium · Coding · Asked 1×Let's go to SQL. Suppose a table has duplicate rows. How would you remove the duplicates?🟢 Easy · Coding · Asked 1×Do you have experience with Trino? Can you test Trino?🟡 Medium · Conceptual · Asked 1×Can you explain how you optimize SQL code when the client does not want to disturb existing data?🟡 Medium · Conceptual · Asked 1×Do you have experience with stored procedures?🟢 Easy · Conceptual · Asked 1×Explain the following SQL MERGE statement.🟡 Medium · Conceptual · Asked 1×Write a SQL MERGE statement that updates records when they match, inserts new records when they don't, and deletes records that are not present in the source.🟡 Medium · Coding · Asked 1×Do you have experience writing Python and SQL?🟢 Easy · Other · Asked 1×We have a parent-child relationship table with foreign key and primary key constraints. How would you delete a specific row in the child table?🟡 Medium · Conceptual · Asked 1×Can you delete data from a child table if it is not deleted from the parent table?🟡 Medium · Conceptual · Asked 1×In which SQL databases have you had hands‑on experience?🟢 Easy · Behavioral · Asked 1×Write a query to retrieve employees whose salary is greater than 50,000, sorted by salary in descending order.🟡 Medium · Coding · Asked 1×Write a Snowflake stored procedure that uses a CASE statement to classify employees as 'High', 'Medium', or 'Low' based on their salary, and explain the benefits of using a cloud-based data warehouse.🟡 Medium · Coding · Asked 1×Write an SQL query that returns the employee name and the manager name for each employee.🟢 Easy · Coding · Asked 1×Write an SQL query to count the number of employees reporting to each manager.🟡 Medium · Coding · Asked 1×Can you talk about optimizing slow SQL queries?🟡 Medium · Conceptual · Asked 1×Can you walk through a complex SQL query you have written recently in your career?🟡 Medium · Conceptual · Asked 1×Write a query to retrieve unique records based on first name using the DISTINCT function.🟢 Easy · Coding · Asked 1×Find the top 3 highest salaries in each department.🟡 Medium · Coding · Asked 1×How do you display only two columns from an entire section?🟢 Easy · Conceptual · Asked 1×Write five SQL queries.🟡 Medium · Coding · Asked 1×What are query optimization techniques?🟡 Medium · Conceptual · Asked 1×Write a stored procedure that returns the department name and the second highest salary.🟡 Medium · Coding · Asked 1×Write a stored procedure that takes a department ID as input and returns the department name, employee name, and the second highest salary for that department.🟡 Medium · Coding · Asked 1×Retrieve employees who receive the second highest salary within their department.🟡 Medium · Coding · Asked 1×Write a stored procedure that accepts a department ID and returns the employee name, department name, and salary.🟢 Easy · Coding · Asked 1×Retrieve the second highest salary along with the department name.🟡 Medium · Coding · Asked 1×List employees grouped by department who receive the second half of their salary.🟡 Medium · Coding · Asked 1×Does the employee table have columns employee id and employee name?🟢 Easy · Conceptual · Asked 1×What is a stored procedure?🟢 Easy · Conceptual · Asked 1×How would you find the second highest paid employee in each department?🟡 Medium · Coding · Asked 1×Suppose you have two tables, Employee and Department. Verbally explain how you would find the highest paid employee in each department.🟡 Medium · Coding · Asked 1×How do you optimize a slow-running query?🟡 Medium · Conceptual · Asked 1×What is the result of a join between table1 and table2?🟢 Easy · Conceptual · Asked 1×Can you explain the difference between COALESCE and NULL?🟡 Medium · Conceptual · Asked 1×What is the difference between a normal view and a materialized view?🟢 Easy · Conceptual · Asked 1×How would you analyze attendance trends to determine if more people attend the office on weekdays versus holidays, given that attendance counts are greater than 50?🟡 Medium · Coding · Asked 1×Write a SQL query that can view attendance for approximately 100 employees in the system.🟡 Medium · Coding · Asked 1×Given an employee with ID 1 who was present on January 1st, absent on January 2nd, and present on January 3rd, how would you calculate his attendance percentage over this period?🟡 Medium · Conceptual · Asked 1×Do we need an employee ID in the employee table?🟡 Medium · Conceptual · Asked 1×Can you give a brief overview of Python's SQL capabilities?🟢 Easy · Conceptual · Asked 1×When writing queries, what sort key strategy would you use?🟡 Medium · Conceptual · Asked 1×What would be the first step to check whether a query is getting executed?🟢 Easy · Debugging · Asked 1×We have a query that normally runs for 4 minutes but is currently running for 30 minutes. What would you do?🟡 Medium · Debugging · Asked 1×Briefly explain row number, rank, and dense rank.🟡 Medium · Conceptual · Asked 1×How can we retrieve the size of a table in Redshift, for example when the table is about one gigabyte, and what options should we consider?🟡 Medium · Conceptual · Asked 1×Have you worked on Redshift? For example, an audit table with certain fields.🟢 Easy · Conceptual · Asked 1×Provide code for dense rank and row number.🟡 Medium · Coding · Asked 1×Can you write an SQL snippet to output data from a dataset?🟡 Medium · Coding · Asked 1×Explain the differences between ROW_NUMBER, RANK, and DENSE_RANK window functions.🟡 Medium · Conceptual · Asked 1×What is the difference between window functions and aggregate functions?🟡 Medium · Conceptual · Asked 1×Could you explain the difference between COUNT(*) and COUNT(1)?🟢 Easy · Conceptual · Asked 1×What is the difference between normal views and materialized views?🟢 Easy · Conceptual · Asked 1×Can you again tell me what the execution plan for a query is?🟡 Medium · Conceptual · Asked 1×Suppose a query was running, and suddenly it starts taking a long time to execute. What could have gone wrong with the query source?🟡 Medium · Debugging · Asked 1×When is GROUP BY not needed when using COUNT(*)?🟡 Medium · Conceptual · Asked 1×If we are using aggregation, do we need a HAVING clause?🟡 Medium · Conceptual · Asked 1×What is the GROUP BY clause and why do we use it?🟢 Easy · Conceptual · Asked 1×When filtering results by context, for what purpose do we use aggregation?🟡 Medium · Conceptual · Asked 1×Why do we use aggregation functions in SQL queries?🟢 Easy · Conceptual · Asked 1×What is the number of rows in the customer table?🟢 Easy · Conceptual · Asked 1×What is the total number of customers?🟢 Easy · Conceptual · Asked 1×What is the count of rows in the stats table?🟢 Easy · Conceptual · Asked 1×How can we return two rows in the result set while only referencing one row?🟡 Medium · Conceptual · Asked 1×Which row will be returned in the result set?🟢 Easy · Conceptual · Asked 1×Will the query execute? Which query?🟡 Medium · Conceptual · Asked 1×Is it okay if we don't use GROUP BY?🟢 Easy · Conceptual · Asked 1×Why do we use GROUP BY?🟢 Easy · Conceptual · Asked 1×What is the correct syntax of a query?🟢 Easy · Conceptual · Asked 1×Show an example of incorrect SQL syntax and provide the corrected version.🟡 Medium · Coding · Asked 1×What are the steps of query execution?🟡 Medium · Conceptual · Asked 1×Explain the following SQL query: SELECT customer_name, COUNT(*) FROM customerTable WHERE CITY_Name LIKE '%Pu%'🟢 Easy · Conceptual · Asked 1×Given a table sales(emp_id, sale_date, amount), rank employees by total sales, compute a running total per employee, and find the top performer per month.🟡 Medium · Coding · Asked 1×These are two tables: all_system_orders and new_system_orders. Data has been transferred; how would you validate that the data has been correctly imported? Write queries to validate the data.🟡 Medium · Coding · Asked 1×Given scenarios, write queries to validate data.🟡 Medium · Coding · Asked 1×List the top 3 departments by revenue.🟡 Medium · Coding · Asked 1×Which department ranks third in revenue?🟡 Medium · Coding · Asked 1×Calculate the average billing commission by department.🟡 Medium · Coding · Asked 1×For each month, compute the patient visit rate, revenue requirement, and average billing per patient.🔴 Hard · Coding · Asked 1×How do you drop the entire structure of a table?🟢 Easy · Conceptual · Asked 1×If you want to update one column in a table, what command will you use?🟢 Easy · Conceptual · Asked 1×Are you able to write queries?🟢 Easy · Conceptual · Asked 1×What is the difference between ORDER BY and GROUP BY?🟢 Easy · Conceptual · Asked 1×He was asking about inner join, left join, right join, and full outer join. What will be the output of table A and table B?🟡 Medium · Conceptual · Asked 1×Given the following table schemas: TableA: id values 1, 1, 2, 3, 4 TableB: id values 1, 2, 2, 4 What are the results of an inner join, left join, right join, and full outer join on the id column?🟡 Medium · Conceptual · Asked 1×Given the following tables: TableA: | id | |----| | 1 | | 1 | | 2 | | 3 | | 4 | TableB: | id | |----| | 1 | | 2 | | 3 | | 4 | How many records would result from an inner join and from a left join on the id column?🟢 Easy · Conceptual · Asked 1×Can you tell the difference between an inner join and an outer join?🟢 Easy · Conceptual · Asked 1×What are the different types of joins in SQL?🟢 Easy · Conceptual · Asked 1×Do you know how to perform joins in SQL?🟢 Easy · Conceptual · Asked 1×What does the BETWEEN clause do?🟢 Easy · Conceptual · Asked 1×What is the difference between DELETE and TRUNCATE?🟡 Medium · Conceptual · Asked 1×What does TRUNCATE do?🟢 Easy · Conceptual · Asked 1×What does the DELETE operation do?🟢 Easy · Conceptual · Asked 1×Can you explain the difference between the WHERE and HAVING clauses in SQL?🟡 Medium · Conceptual · Asked 1×Write a SELECT query to retrieve each customer ID and the total number of orders from the orders table.🟡 Medium · Coding · Asked 1×For each customer ID, return the total number of orders they placed in 2025 where the order number is greater than 5.🟡 Medium · Coding · Asked 1×Write a SQL query that returns each customer ID and the total number of orders they placed in the year 2025, but only for customers who placed more than five orders.🟡 Medium · Coding · Asked 1×Write a SQL query that returns each customer ID and the total number of orders they placed during the year 2025, including only customers whose total orders exceed five.🟡 Medium · Coding · Asked 1×For each customer ID, write a SQL query that returns the total number of orders they placed in 2025, but only if that total is greater than five.🟡 Medium · Coding · Asked 1×Write a SQL query that returns each customer ID and the total number of orders they placed in 2025, accounting for customers who may place multiple orders on the same day.🟡 Medium · Coding · Asked 1×Given a table where a business has multiple customers, write a SQL query that returns each customer ID and the total number of orders they placed in 2025, filtering only customers with more than five orders.🟡 Medium · Coding · Asked 1×Can you tell what a primary key is?🟢 Easy · Conceptual · Asked 1×Have you used unique constraints in SQL?🟢 Easy · Behavioral · Asked 1×Can you tell what a view in SQL is?🟢 Easy · Conceptual · Asked 1×In your primary skills, which languages do you use—Python, SQL, PySpark, AWS—and how would you rate yourself out of 10?🟢 Easy · Behavioral · Asked 1×Do you understand the tech stack? You have experience with Python, SQL, PySpark, and AWS. Is there anything else you'd like to add?🟢 Easy · Conceptual · Asked 1×Are you confident with SQL? Would you rate yourself out of five?🟢 Easy · Behavioral · Asked 1×In the last record I don't have an accepted date; how does an inner join work?🟡 Medium · Conceptual · Asked 1×We have three successful records. If we ignore one sent record, will the total count be four?🟡 Medium · Conceptual · Asked 1×In a SQL join, if we ignore the last record because it hasn't joined, will we get only three records for gate 4?🟡 Medium · Conceptual · Asked 1×If we have 3 accepted records and 4 sent records, and we perform an inner join between the sent and accepted tables, what will be the result?🟢 Easy · Conceptual · Asked 1×In a left join, does the join key matter? If the wrong join key is used, will it produce incorrect data?🟢 Easy · Conceptual · Asked 1×Why might a join fail when the data types of the join columns differ? The join key should match the current join key.🟡 Medium · Conceptual · Asked 1×Why am I using an inner join?🟢 Easy · Conceptual · Asked 1×Which key would you use to join tables?🟢 Easy · Conceptual · Asked 1×How do you perform an inner join on a key?🟢 Easy · Conceptual · Asked 1×What does an inner join return?🟢 Easy · Conceptual · Asked 1×Which join would you use to retrieve all records from one table and matching records from another?🟢 Easy · Conceptual · Asked 1×Explain the differences between inner, outer, left, and cross joins.🟢 Easy · Conceptual · Asked 1×When using an inner join, we get three successful counts instead of the total count. Will we then get the count?🟡 Medium · Conceptual · Asked 1×But in the last record I don't have a sent record or a reciprocal accepted record; how will an inner join work?🟡 Medium · Conceptual · Asked 1×Can you provide code that uses a left join?🟢 Easy · Coding · Asked 1×Calculate the friend acceptance rate for each date when friend requests were sent. A request is sent if action = 'sent' and accepted if action = 'accepted'. If a request is not accepted, there is no record of it being accepted in the table. The output should only include dates where requests were sent and at least one of them was accepted (acceptance can occur on any date after the request is sent).🟡 Medium · Coding · Asked 1×How do you order rows when calculating a cumulative sum in SQL?🟡 Medium · Conceptual · Asked 1×Column names should be kept in double quotes.🟢 Easy · Conceptual · Asked 1×If a column represents a transaction, how do you display the transaction type when the value equals 'withdrawal' or 'deposit'?🟡 Medium · Conceptual · Asked 1×If you want to add an additional column, how do you display it conditionally and calculate its value?🟡 Medium · Conceptual · Asked 1×

🎤 Get Sql questions answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500

Browse Other Topics