0% found this document useful (0 votes)
2 views

SQL notes

This document provides a comprehensive list of SQL interview questions and answers tailored for freshers. It covers fundamental concepts such as SQL commands, keys, normalization, joins, and transaction properties. Additionally, it explains various SQL functionalities like aggregate functions, constraints, and the use of indexes.

Uploaded by

gousebagban09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

SQL notes

This document provides a comprehensive list of SQL interview questions and answers tailored for freshers. It covers fundamental concepts such as SQL commands, keys, normalization, joins, and transaction properties. Additionally, it explains various SQL functionalities like aggregate functions, constraints, and the use of indexes.

Uploaded by

gousebagban09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL Interview Questions and Answers for Freshers

1. Q: What is SQL?
A: SQL (Structured Query Language) is used to store, manipulate, and retrieve data in relational databases.

2. Q: What are the types of SQL commands?


A: DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language), and
TCL (Transaction Control Language).

3. Q: What is a primary key?


A: A column (or set of columns) that uniquely identifies each row in a table.

4. Q: What is a foreign key?


A: A key used to link two tables together. It refers to the primary key in another table.

5. Q: What is a table in SQL?


A: A table is a collection of rows and columns used to store structured data.

6. Q: What is normalization?
A: The process of organizing data to reduce redundancy and improve data integrity.

7. Q: What are the different normal forms?


A: 1NF (Atomic values), 2NF (No partial dependency), 3NF (No transitive dependency), and so on.

8. Q: What is a JOIN?
A: JOIN is used to combine rows from two or more tables based on a related column.

9. Q: What are the types of JOINs?


A: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN.

10. Q: What is a view?


A: A virtual table based on the result of a SQL query.
11. Q: What is the difference between DELETE and TRUNCATE?
A: DELETE removes specific rows and logs the action. TRUNCATE removes all rows quickly without logging
individual deletions.

12. Q: What is a constraint?


A: A rule applied to table columns to enforce data integrity (e.g., NOT NULL, UNIQUE).

13. Q: What is a unique key?


A: A key that ensures all values in a column are different.

14. Q: What are aggregate functions?


A: Functions like COUNT, SUM, AVG, MAX, and MIN used to perform calculations on data.

15. Q: What is a GROUP BY clause?


A: It groups rows with the same values in specified columns into summary rows.

16. Q: What is the HAVING clause?


A: Used to filter records after a GROUP BY is applied.

17. Q: What is the difference between WHERE and HAVING?


A: WHERE filters rows before grouping; HAVING filters groups after aggregation.

18. Q: What is a subquery?


A: A query inside another query.

19. Q: What is the use of the DISTINCT keyword?


A: It returns only unique values in a result set.

20. Q: What is an index?


A: An index improves the speed of data retrieval operations.

21. Q: What is a composite key?


A: A combination of two or more columns that uniquely identify a row.
22. Q: What is a schema?
A: A logical structure that holds database objects like tables, views, and procedures.

23. Q: What is a transaction?


A: A sequence of operations that are treated as a single unit. It is either fully completed or rolled back.

24. Q: What are ACID properties?


A: Atomicity, Consistency, Isolation, Durability – properties that ensure reliable processing of transactions.

25. Q: What is the LIMIT clause?


A: It restricts the number of records returned by a query.

26. Q: What is the LIKE operator?


A: Used to search for a specified pattern in a column.

27. Q: What is a stored procedure?


A: A saved SQL code that can be reused again and again.

28. Q: What is a trigger?


A: A trigger is a procedure that is automatically executed in response to certain events on a table.

29. Q: What is a NULL value in SQL?


A: NULL means the absence of a value or unknown data.

30. Q: What is a cursor in SQL?


A: A cursor is used to iterate through the result set of a query row by row.

You might also like