0% found this document useful (0 votes)
15 views3 pages

SQL Data Engineer Interview Questions

The document outlines key SQL interview questions for data engineer roles, focusing on concepts such as JOIN types, duplicate record handling, indexes, and stored procedures. It also covers data normalization, window functions, and optimization techniques for SQL queries. Each question includes a brief explanation or example to clarify the concepts.

Uploaded by

barasancynthia
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

SQL Data Engineer Interview Questions

The document outlines key SQL interview questions for data engineer roles, focusing on concepts such as JOIN types, duplicate record handling, indexes, and stored procedures. It also covers data normalization, window functions, and optimization techniques for SQL queries. Each question includes a brief explanation or example to clarify the concepts.

Uploaded by

barasancynthia
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Interview Questions for Data Engineer Roles

(Banking / BI)

1. What is the difference between INNER JOIN, LEFT JOIN, and FULL JOIN?

INNER JOIN returns only records that match in both tables.

LEFT JOIN returns all records from the left table and matching records from the right table.

FULL JOIN returns all records from both tables whether there is a match or not.

2. How do you find duplicate records in a table?

You can use GROUP BY with HAVING:

SELECT column_name, COUNT(*)

FROM table_name

GROUP BY column_name

HAVING COUNT(*) > 1;

This query identifies values that appear more than once.

3. What is an index and why is it important?

An index is a database structure that improves the speed of data retrieval operations.

Indexes are useful for columns that are frequently used in WHERE clauses, joins, or sorting.

However, too many indexes can slow down insert and update operations.

4. What is the difference between WHERE and HAVING?

WHERE filters rows before aggregation occurs.

HAVING filters groups after aggregation has already been performed.

Example:

WHERE filters individual records.

HAVING filters aggregated results like SUM or COUNT.


5. How do you remove duplicate rows from a table?

One common approach is using ROW_NUMBER():

DELETE FROM table_name

WHERE row_id NOT IN (

SELECT MIN(row_id)

FROM table_name

GROUP BY column1, column2

);

This keeps one record and removes duplicates.

6. What is a stored procedure?

A stored procedure is a set of SQL statements stored in the database that can be executed
repeatedly.

It improves performance, ensures reusability, and enhances security by controlling access to data
operations.

7. What is the difference between DELETE, TRUNCATE, and DROP?

DELETE removes rows from a table and can include a WHERE clause.

TRUNCATE removes all rows from a table very quickly and cannot use WHERE.

DROP deletes the entire table structure from the database.

8. What is normalization?

Normalization is the process of organizing data in a database to reduce redundancy and improve
data integrity.

It involves splitting data into multiple related tables based on defined relationships.

9. What is a window function?

Window functions perform calculations across a set of rows related to the current row.

Examples include ROW_NUMBER(), RANK(), and SUM() OVER().

They are commonly used for ranking, running totals, and analytics queries.
10. How do you optimize SQL queries when working with large datasets?

Optimization techniques include:

- Creating indexes on frequently used columns

- Avoiding SELECT *

- Reducing unnecessary joins

- Using query execution plans

- Filtering data early using WHERE clauses

You might also like