SQL Interview Questions: 15 to Practice Before Your First Tech Interview

If you're preparing for a first developer or data job, SQL interview questions are worth your time. A lot of software stores its data in a database, and SQL is the standard language for working with that data. Below are 15 questions to practice, grouped from basic to intermediate, with short plain-English answers you can build on.

Before you start

The MySQL documentation explains that the SQL in "MySQL" stands for "Structured Query Language," a standardized language used to access databases. It also says MySQL databases are relational, meaning a relational database "stores data in separate tables rather than putting all the data in one big storeroom." (MySQL docs)

Keep that picture in mind: tables, rows and columns, and the relationships between tables. The questions below keep coming back to it.

Basic SQL interview questions

1. What is SQL? A language for working with data in relational databases: reading it, adding it, changing it and deleting it.

2. What does SELECT do? The MySQL manual puts it simply: "SELECT is used to retrieve rows selected from one or more tables." (MySQL docs)

3. What's the difference between WHERE and HAVING? WHERE filters rows before they're grouped. HAVING filters groups after GROUP BY runs.

4. What is a primary key? A column, or set of columns, that uniquely identifies each row in a table.

5. What is a foreign key? A column that points to the primary key of another table, linking the two.

6. What does ORDER BY do? Sorts the results, ascending by default, or descending with DESC.

Intermediate SQL interview questions

7. What is a JOIN? A way to combine rows from two or more tables based on a related column. The MySQL manual has a full page on JOIN syntax. (MySQL docs)

8. INNER JOIN vs LEFT JOIN? An INNER JOIN returns only rows with a match in both tables. A LEFT JOIN returns every row from the left table, with empty values where the right table has no match.

9. What does GROUP BY do? Groups rows that share a value so you can summarize them with functions like COUNT, SUM or AVG.

10. What's the difference between COUNT() and COUNT(column)? COUNT() counts rows. COUNT(column) counts rows where that column isn't NULL.

11. What is NULL? A missing or unknown value. It isn't zero and it isn't an empty string, and you test for it with IS NULL.

12. What is a subquery? A query inside another query, often used to filter by a value you calculate first.

13. What is an index? A structure that helps the database find rows faster, in exchange for extra storage and slower writes.

14. DELETE vs TRUNCATE? DELETE removes rows you choose and can use WHERE. TRUNCATE empties the whole table.

15. How would you find duplicate rows? GROUP BY the columns that should be unique, then use HAVING COUNT(*) > 1.

Want structured SQL practice with live instruction? Check your eligibility.

How to practice

  • Build a small database. An equipment or inventory tracker with three related tables gives you something real to query.
  • Write each answer as a query. Don't just memorize definitions. Run the JOIN, the GROUP BY and the subquery yourself.
  • Say it out loud. If you can explain an answer plainly, you own it. Practice until each one comes out clean.
  • Learn the tradeoffs. Be ready to say why you'd add an index, or why a LEFT JOIN fits better than an INNER JOIN.

Why veteran habits fit SQL

If you've tracked personnel, supplies or maintenance records in a structured system, you already think in rows, columns and relationships. SQL gives that habit a formal language, and that kind of discipline transfers.

For the database side of the VetBoss path, see our MySQL certification post. If you're also learning Python, see Python certification. For where SQL fits in a developer career, see how to become a software engineer.

Where VetBoss fits

Step Into Tech is VetBoss's AI Engineer path, in two stages. Stage 1, Full Stack Developer, covers HTML and CSS, JavaScript, Python, React JS, Certified GPT and MySQL, in live instructor-led classes with hands-on projects. Stage 2 is the AI half of the path, and it has a waiting list right now. See Step Into Tech.

Your next step

SQL questions get easier with every query you write. If you want a guided path that includes MySQL, let's talk.

Book an eligibility call, or call 855-VET-BOSS (855-838-2677).

Previous
Previous

Python vs C++: Which Should You Learn First?

Next
Next

1D7X1: What Air Force Cyber Defense Operations Specialists Do