SQL Notes
Learn the most important beginner-level SQL interview questions with answers, examples, and explanations commonly asked in technical interviews.
Great work!
You've made it through:
SQL Basics
SQL Intermediate
SQL Advanced
SQL OptimizationNow comes the fun part:
Interviews
Technical Tests
Viva Exams
Campus PlacementsThis section has the interview questions you'll actually see.
These questions work for:
Freshers
Students
Internship Interviews
Junior Developers
Campus PlacementsQ1. What is SQL?
Answer
SQL is short for:
Structured Query LanguageIt's what you use to:
Store Data
Retrieve Data
Update Data
Delete Data
Manage DatabasesExample
SELECT *
FROM Employees;Q2. What are the main categories of SQL commands?
Answer
SQL commands break down into five types:
DDL DML DQL DCL TCL
DDL
Deals with structure:
CREATE
ALTER
DROP
TRUNCATEDML
Deals with data:
INSERT
UPDATE
DELETEDQL
Gets data:
SELECTDCL
Controls access:
GRANT
REVOKETCL
Manages transactions:
COMMIT
ROLLBACK
SAVEPOINTQ3. What is a Database?
Answer
A database is just structured data that you can easily store, manage, and pull from whenever you need it.
Example
Student Database
Bank Database
Hospital DatabaseQ4. What is a Table?
Answer
A table is how data gets organized — rows and columns, like a spreadsheet.
Example
| EmployeeID | EmployeeName |
|---|---|
| 1 | Rahul |
| 2 | Priya |
Q5. What is a Row?
Answer
A row is one complete record.
Example:
1 RahulThat's one row.
Q6. What is a Column?
Answer
A column is a single piece of information across all records.
Example:
EmployeeID
EmployeeName
SalaryQ7. What is a Primary Key?
Answer
A primary key uniquely identifies each record — no two rows can have the same primary key.
What you need to know:
Unique
Cannot Be NULL
One Primary Key Per TableExample:
EmployeeID INT PRIMARY KEYQ8. What is a Foreign Key?
Answer
A foreign key connects two tables by referencing another table's primary key.
Example:
DepartmentID INT,
FOREIGN KEY
(
DepartmentID
)
REFERENCES Departments
(
DepartmentID
)Q9. Difference Between Primary Key and Foreign Key?
| Feature | Primary Key | Foreign Key |
|---|---|---|
| Uniqueness | Yes | No |
| NULL Allowed | No | Yes |
| Purpose | Identify Row | Create Relationship |
Q10. What is a Constraint?
Answer
Constraints are rules you put on columns to keep data clean and reliable.
Examples:
PRIMARY KEY FOREIGN KEY UNIQUE CHECK DEFAULT NOT NULL
Q11. What is NOT NULL Constraint?
Answer
This says "you must have a value here" — no blanks allowed.
Example:
Name VARCHAR(100)
NOT NULLQ12. What is UNIQUE Constraint?
Answer
Every value in this column has to be different from every other value.
Example:
Email VARCHAR(100)
UNIQUEQ13. What is the Difference Between DELETE, TRUNCATE, and DROP?
| Feature | DELETE | TRUNCATE | DROP |
|---|---|---|---|
| Removes Rows | Yes | Yes | Yes |
| Removes Table | No | No | Yes |
| WHERE Allowed | Yes | No | No |
| Rollback Possible | Yes* | Depends | No |
Q14. What is the Difference Between CHAR and VARCHAR?
CHAR
Fixed width — if you say CHAR(10) and input 5 characters, it pads with spaces.
Example:
CHAR(10)VARCHAR
Variable width — only takes the space it needs.
Example:
VARCHAR(10)Q15. What is NULL?
Answer
NULL means "I don't have a value for this" — missing data.
Example:
Phone Number Not Provided
Q16. What is the Difference Between NULL and 0?
NULL
Unknown value. We don't know what it is.
0
Actual number. You know it's zero.
Q17. What is SQL JOIN?
Answer
JOIN pulls data from multiple tables by matching rows on a shared column.
Example:
SELECT *
FROM Employees E
JOIN Departments D
ON E.DepartmentID =
D.DepartmentID;Q18. What are Different Types of JOINs?
Your main options:
INNER JOIN LEFT JOIN RIGHT JOIN FULL JOIN SELF JOIN CROSS JOIN
Q19. What is INNER JOIN?
Answer
Returns only the rows where there's a match in both tables.
Example:
SELECT *
FROM Employees E
INNER JOIN Departments D
ON E.DepartmentID =
D.DepartmentID;Q20. What is LEFT JOIN?
Answer
Returns everything from the left table, plus matching rows from the right table. If there's no match, you still get the left table data.
Q21. What is RIGHT JOIN?
Answer
Same as LEFT JOIN, but the other way around — everything from the right table plus matches.
Q22. What is FULL OUTER JOIN?
Answer
Returns all rows from both tables. If something matches, great. If not, you still get it.
Q23. What is a Subquery?
Answer
A query inside another query. Useful when you need results from one query to filter another.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for SQL Interview Questions (Beginner).
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this SQL Complete Guide topic.
Search Terms
sql-complete-guide, sql complete guide, sql, complete, guide, interview, questions, beginner
Related SQL Complete Guide Topics