Basics
Fundamental
SQL
Interview
Questions
with Answers
Pradeep M
@pradeep-m-analyst
1
What is the difference
between SQL and MySQL?
SQL is a standard language for managing
relational databases
MySQL is a specific database management
system that uses SQL as its querying
language.
2
In what order does SQL execute
different clauses such as SELECT,
WHERE , GROUP
BY etc.?
SQL executes clauses in this order:
FROM, WHERE, GROUP BY, HAVING, SELECT,
ORDER BY.
3
Difference between
DROP and TRUNCATE
DROP: Removes the entire table definition
and data (permanent).
TRUNCATE: Deletes all data from the table,
but keeps the table structure.
4
What is Alias in SQL?
Alias is a temporary name for a table or
column.
Example: SELECT customer_name AS name
5
What are the constraints in
SQL?
Constraints are used to specify rules for
the data in a table.
Common constraints:
NOT NULL
UNIQUE
PRIMARY KEY
FOREIGN KEY
CHECK
6
What is DDL (Data
Definition Language)
It is used to define the structure of the
database
Examples: CREATE, ALTER , DROP.
7
What is DML (Data
Manipulation Language)
It is used to manipulate data within the
database
Examples: SELECT, INSERT, UPDATE, DELETE.
8
Difference between
DELETE and TRUNCATE
DELETE: Removes specific rows from a table.
TRUNCATE: Deletes all rows from a table.
9
Difference between
DISTINCT and GROUP BY
DISTINCT: Retrieves unique values
GROUP BY: Groups data based on a
common value in a specified column.
10
Difference between
WHERE and HAVING
WHERE: Filters rows before grouping
(applies to individual rows).
HAVING: Filters grouped data after grouping
(applies to aggregated results)
Was this
useful?
Would you mind showing your support by
giving it a like?