SQL Interview Questions

SQL Fundamentals

General information about SQL

  • What is SQL?
  • What are the different flavors of SQL?
  • What is a primary key?

Relational Databases and how they work?

  • What are the top RDBMS engines?
  • How is an RDBMS different from a No-SQL database?

SQL commands and their example

  • What do DDL, DCL, and DML stand for?
  • Give examples of commands for each.

Data types and how SQL handles it 

  • What are the common data types in SQL?
  • Does an SQLite database support date time objects?

Attribute constraints

  • What are attribute constraints, and explain them?

Types of Joins

  • What is the difference between inner join and left outer join?
  • What is the difference between UNION and UNION ALL?

Aggregation and Rollup functions

  • When should one use a CTE over a subquery?
  • What are window functions?

Knowledge of various SQL functions

  • What is the difference between WHERE and HAVING? Examples of where one should use one over the other
  • What does the COALESCE function do?

SQL Basic

  • using SUM(), COUNT(), AVG(), MIN(), MAX() and other aggregate functions
  • GROUP BY
  • CASE WHEN statement
  • WHERE and HAVING
  • JOINs
  • UNION and UNION all

SQL Aggregation

  • subqueries
  • joins and self-joins
  • window functions
  • CTEs
  • GROUP BY extensions (ROLLUP, CUBE, GROUPING SETS)

SQL Open Ended Questions

It is your responsibility to understand your data and determine which calculations provide the answers you need. For instance, you may need to assess whether a product launch was successful, a new calling procedure reduced costs, or new vehicles enhanced user satisfaction. Defining metrics for “success,” “savings,” or “improvement” will be essential in making these evaluations.

Data Transformation

ETL

  • Data Definition Language (DDL) keywords
  • Data Manipulation Language (DML) keywords
  • Data Control Language (DCL) keywords
  • Transaction Control Language (TCL) keywords
  • SQL constraints
  • JOINs
  • indexes
  • transactions
  • views
  • user-defined functions
  • stored procedures
  • triggers
  • variables
  • query optimization

Database Modeling

These SQL interview questions aim to assess your expertise in database design and modeling. But what does that entail? It means demonstrating the ability to design and build a database from the ground up based on business processes and requirements. This requires a strong understanding of both technical concepts and business operations. You’ll collaborate with both technical and non-technical colleagues, so you must grasp their business needs while ensuring a robust and efficient technical implementation. Ideally, this process follows a structured series of steps to achieve the best results.

  1. defining the database purpose
  2. collecting and defining users’ requirements
  3. creating a conceptual model
  4. creating the logical model
  5. creating the physical model