Beginner-Friendly DBMS, SQL, and PLSQL Interview Questions

Basic SQL Interview Questions Flashcards | Ace Your Tech Interview - Flashcards

Basic SQL Interview Questions to Build a Strong Foundation

If you're just starting your database journey or preparing for your first tech interview, mastering the basic SQL interview questions is a crucial step. SQL remains one of the most widely used languages for data querying and manipulation, and interviewers expect you to demonstrate a strong understanding of database fundamentals. This page offers a curated list of basic SQL questions for interview prep—perfect for beginners or anyone revisiting the fundamentals.

What to Expect in Basic DBMS and SQL Interview Questions

Many entry-level interviews start with basic DBMS interview questions that test your understanding of relational databases, normalization, keys, and indexing. You’ll then encounter foundational basic SQL interview questions covering:

  • • SELECT, INSERT, UPDATE, DELETE operations
  • • Filtering with WHERE, LIKE, and BETWEEN
  • • Joins: INNER, LEFT, RIGHT, and FULL
  • • Aggregate functions like COUNT, SUM, AVG
  • • GROUP BY and HAVING clauses
  • • Primary keys vs. foreign keys

These questions are essential for roles involving data analysis, backend development, or database administration.

SQL & PL/SQL Interview Questions You Should Know

While SQL is used for querying and managing data, PL/SQL (Procedural Language/SQL) adds procedural programming capabilities. Our deck also includes SQL PL/SQL interview questions, helping you bridge the gap between simple queries and more advanced database logic. Expect questions such as:

  • • Writing stored procedures and triggers
  • • Handling exceptions in PL/SQL
  • • Using cursors and control structures
  • • Understanding packages and functions

In addition, we cover some of the most popular SQL interview questions asked across tech companies—ensuring you’re prepared not just to answer questions, but to demonstrate your ability to think in SQL.

Whether you're reviewing basic SQL questions for interview prep or diving into SQL PL/SQL interview questions, this deck gives you a solid base to build on. Get started and turn your database knowledge into interview confidence.

Showing 50 of 50 flashcards

Difficulty: EASY

Type: Other

Can you use WHERE and HAVING in the same query?

Yes. WHERE filters before grouping

Difficulty: EASY

Type: Other

How can you insert using SELECT from another table?

INSERT INTO B SELECT ... FROM A;

Difficulty: EASY

Type: Other

How do you retrieve only the `name` and `age` columns from a table called `Persons`?

SELECT name

Difficulty: EASY

Type: Other

How do you select all columns from the table `Employees`?

SELECT * FROM Employees

Difficulty: EASY

Type: Other

How do you sort query results by the `Salary` column in descending order?

Add an `ORDER BY Salary DESC` clause to the SELECT query.

Difficulty: EASY

Type: Other

How do you use a subquery with IN?

Use IN with a subquery returning a list.

Difficulty: EASY

Type: Other

What happens if you run UPDATE without a WHERE clause?

All rows in the table are updated.

Difficulty: EASY

Type: Other

What if a subquery returns multiple rows with =?

It causes an error; use IN instead.

Difficulty: EASY

Type: Other

What is a JOIN in SQL and why would you use one?

It combines rows from two or more tables using a related column.

Difficulty: EASY

Type: Other

What is a LEFT JOIN?

Returns all rows from the left table and matched rows from the right.

Difficulty: EASY

Type: Other

What is a subquery in SQL?

A query nested inside another query.

Difficulty: EASY

Type: Other

What is an INNER JOIN?

Returns only the rows with matching keys in both tables.

Difficulty: EASY

Type: Other

What is the default sort order if you don't specify ASC or DESC in an ORDER BY clause?

Ascending (ASC) order is the default.

Difficulty: EASY

Type: Other

What is the difference between DELETE and TRUNCATE?

DELETE removes rows selectively; TRUNCATE removes all and is faster.

Difficulty: EASY

Type: Other

What is the difference between IN and multiple ORs?

Functionally the same; IN is shorter.

Difficulty: EASY

Type: Other

What is the difference between `COUNT(*)` and `COUNT(column_name)`?

`COUNT(*)` counts all rows

Difficulty: EASY

Type: Other

What is the difference between an INNER JOIN and a LEFT JOIN?

INNER JOIN gives only matched rows

Difficulty: EASY

Type: Other

What is the purpose of the HAVING clause in SQL?

To filter groups based on aggregated values.

Difficulty: EASY

Type: Other

What's the difference between WHERE and HAVING clauses?

WHERE filters rows before grouping

Difficulty: EASY

Type: Other

Which SQL aggregate function do you use to count the number of rows in a table?

COUNT(*)

Difficulty: EASY

Type: Other

Which SQL clause is used to filter rows based on a condition?

The `WHERE` clause.

Difficulty: EASY

Type: Other

Which SQL function gives you the average of values in a column?

AVG()

Difficulty: EASY

Type: Other

Which SQL function would you use to get the highest value in a column?

MAX()

Difficulty: EASY

Type: Other

Which SQL function would you use to get the smallest value in a column?

MIN()

Difficulty: EASY

Type: Other

Which aggregate function would you use to calculate the total of values in a numeric column?

SUM()

Difficulty: EASY

Type: Other

Which operator checks if a value matches any from a list?

IN

Difficulty: EASY

Type: Other

Which operator excludes certain values in a list?

NOT IN

Difficulty: EASY

Type: Other

Which operator helps filter rows within a range?

BETWEEN

Difficulty: EASY

Type: Other

Which operator is used for pattern matching?

LIKE

Difficulty: EASY

Type: Other

Why do we use the GROUP BY clause in SQL?

To group rows that have the same values in specified column(s).

Difficulty: EASY

Type: Other

Write a SQL query to delete all cancelled orders.

DELETE FROM Orders WHERE status = 'Cancelled';

Difficulty: EASY

Type: Other

Write a SQL query to find all people from the `Persons` table who are older than 25 and live in 'Mumbai'.

SELECT * FROM Persons WHERE age > 25 AND city = 'Mumbai';

Difficulty: EASY

Type: Other

Write a SQL query to get all employees and their department names

even if no department exists.

Difficulty: EASY

Type: Other

Write a SQL query to get employee names and their department names.

SELECT e.name

Difficulty: EASY

Type: Other

Write a SQL query to get the number of employees in each department.

SELECT department

Difficulty: EASY

Type: Other

Write a SQL query to get unique city names from Customers.

SELECT DISTINCT city FROM Customers;

Difficulty: EASY

Type: Other

Write a SQL query to insert a new student named 'Rahul'

aged 22.

Difficulty: EASY

Type: Other

Write a SQL query to list all departments that have more than 10 employees.

SELECT department

Difficulty: EASY

Type: Other

Write a SQL query to retrieve all rows from the `Employees` table where age is greater than 30.

SELECT * FROM Employees WHERE age > 30;

Difficulty: EASY

Type: Other

Write a SQL query to update a customer's age to 30 where ID is 5.

UPDATE Customers SET age = 30 WHERE customer_id = 5;

Difficulty: EASY

Type: Other

Write a query to count distinct job titles.

SELECT COUNT(DISTINCT job_title) FROM Employees;

Difficulty: EASY

Type: Other

Write a query to find employees who joined in 2020.

SELECT * FROM Employees WHERE join_date BETWEEN '2020-01-01' AND '2020-12-31';

Difficulty: EASY

Type: Other

Write a query to find employees with no manager.

SELECT name FROM Employees WHERE manager_id IS NULL;

Difficulty: EASY

Type: Other

Write a query to find the highest paid employee.

SELECT * FROM Employees WHERE salary = (SELECT MAX(salary) FROM Employees);

Difficulty: EASY

Type: Other

Write a query to find total salary per department.

SELECT department

Difficulty: EASY

Type: Other

Write a query to get employees earning above average.

SELECT name FROM Employees WHERE salary > (SELECT AVG(salary) FROM Employees);

Difficulty: EASY

Type: Other

Write a query to get second highest salary.

SELECT MAX(salary) FROM Employees WHERE salary < (SELECT MAX(salary) FROM Employees);

Difficulty: EASY

Type: Other

Write a query to get top 5 highest salaries.

SELECT salary FROM Employees ORDER BY salary DESC LIMIT 5;

Difficulty: EASY

Type: Other

Write a query to list customers and how many orders they placed.

SELECT c.name

Difficulty: EASY

Type: Other

Write a query to raise all salaries by 10%.

UPDATE Employees SET salary = salary * 1.10;

We use cookies to improve your experience. By clicking “Accept” you consent to the use of cookies. Read our Privacy Policy.