0% found this document useful (0 votes)
4 views2 pages

SQL_Interview_Questions_And_Answers

The document provides a series of SQL interview questions and answers covering fundamental concepts such as SQL definition, types of SQL statements, differences between WHERE and HAVING clauses, primary and foreign keys, normalization, JOIN types, prevention of SQL injection, indexing, and aggregate functions. It serves as a concise guide for individuals preparing for SQL-related interviews. Key topics include data manipulation, data integrity, and performance optimization.

Uploaded by

ADITYA VERMA
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)
4 views2 pages

SQL_Interview_Questions_And_Answers

The document provides a series of SQL interview questions and answers covering fundamental concepts such as SQL definition, types of SQL statements, differences between WHERE and HAVING clauses, primary and foreign keys, normalization, JOIN types, prevention of SQL injection, indexing, and aggregate functions. It serves as a concise guide for individuals preparing for SQL-related interviews. Key topics include data manipulation, data integrity, and performance optimization.

Uploaded by

ADITYA VERMA
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/ 2

SQL Interview Questions and Answers

1. What is SQL?

SQL stands for Structured Query Language. It is used to communicate with databases and perform

tasks such as data retrieval, insertion, updating, and deletion.

2. What are the different types of SQL statements?

The main types are DDL (Data Definition Language), DML (Data Manipulation Language), DCL

(Data Control Language), and TCL (Transaction Control Language).

3. What is the difference between WHERE and HAVING clauses?

WHERE is used to filter records before grouping, while HAVING is used to filter groups after the

GROUP BY clause.

4. What is a primary key?

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

5. What is a foreign key?

A foreign key is a column that creates a relationship between two tables by referencing the primary

key of another table.

6. What is normalization?

Normalization is the process of organizing data to reduce redundancy and improve data integrity.

7. What is the difference between INNER JOIN and LEFT JOIN?

INNER JOIN returns only matching records, while LEFT JOIN returns all records from the left table

and matching records from the right table.

8. How can you prevent SQL injection?

By using prepared statements, parameterized queries, and ORM frameworks, you can prevent SQL

injection attacks.

9. What is an index in SQL?


An index is used to speed up data retrieval operations on a table at the cost of additional space and

slower write operations.

10. What are aggregate functions in SQL?

Aggregate functions perform calculations on multiple values to return a single value. Examples:

COUNT(), SUM(), AVG(), MAX(), MIN().

You might also like