0% found this document useful (0 votes)
3 views3 pages

SQL Important Questions For Placement

This document outlines important SQL questions and concepts relevant for placement, including definitions of SQL, differences between DELETE and TRUNCATE, types of joins, normalization, keys, indexes, stored procedures, subqueries, views, functions, GROUP BY, and triggers. It provides key distinctions and explanations for each topic, serving as a study guide for SQL interviews. The content is structured to help candidates understand essential SQL functionalities and their applications.

Uploaded by

Ayush Malhotra
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)
3 views3 pages

SQL Important Questions For Placement

This document outlines important SQL questions and concepts relevant for placement, including definitions of SQL, differences between DELETE and TRUNCATE, types of joins, normalization, keys, indexes, stored procedures, subqueries, views, functions, GROUP BY, and triggers. It provides key distinctions and explanations for each topic, serving as a study guide for SQL interviews. The content is structured to help candidates understand essential SQL functionalities and their applications.

Uploaded by

Ayush Malhotra
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 Important Questions for Placement

1. SQL Basic Queries

What is SQL?:

SQL stands for Structured Query Language. It is used to communicate with and manage data in a

relational database management system (RDBMS). SQL is used for querying, inserting, updating,

and deleting data.

What is the difference between DELETE and TRUNCATE?:

DELETE removes records one by one from a table and logs each row deletion, which can be rolled

back. TRUNCATE, on the other hand, removes all rows without logging individual row deletions and

cannot be rolled back.

What are the types of joins in SQL?:

There are 4 main types of joins:

1. INNER JOIN: Returns rows that have matching values in both tables.

2. LEFT JOIN: Returns all rows from the left table and matching rows from the right table.

3. RIGHT JOIN: Returns all rows from the right table and matching rows from the left table.

4. FULL JOIN: Returns all rows when there is a match in one of the tables.

What is normalization and its types?:

Normalization is the process of organizing data to reduce redundancy and dependency. Types of

normalization:

1. First Normal Form (1NF)

2. Second Normal Form (2NF)

3. Third Normal Form (3NF)

4. Boyce-Codd Normal Form (BCNF)


What is the difference between a primary key and a foreign key?:

A primary key uniquely identifies each record in a table and cannot accept null values. A foreign key

is a column or combination of columns used to establish a link between the data in two tables.

What is an index in SQL?:

An index is a database object that improves the speed of data retrieval operations on a table at the

cost of additional space and slower write operations.

What is a stored procedure?:

A stored procedure is a set of SQL queries and logic that can be saved and reused. It helps reduce

redundancy and improve performance by executing complex operations in the database server.

What is a subquery in SQL?:

A subquery is a query within another query. It is used to return data that will be used in the main

query. Subqueries can be placed in SELECT, WHERE, and FROM clauses.

What is the difference between UNION and UNION ALL?:

UNION combines the result of two or more queries and removes duplicate rows, whereas UNION

ALL combines the results but does not remove duplicates.

What is a view in SQL?:

A view is a virtual table based on the result-set of an SQL query. It can be used to simplify complex

queries, aggregate data, or hide sensitive information from users.

What is the difference between a function and a stored procedure?:

A function is a block of code that returns a single value and can be used in SQL expressions. A

stored procedure is a block of code that performs operations and does not return a value, though it

can return multiple results.

What is the use of GROUP BY in SQL?:


The GROUP BY statement groups rows that have the same values into summary rows, like

COUNT, SUM, AVG, etc. It is often used with aggregate functions (e.g., COUNT, AVG) to

summarize data.

What is a trigger in SQL?:

A trigger is a special kind of stored procedure that automatically executes when certain events occur

on a table or view in a database, such as INSERT, UPDATE, or DELETE.

You might also like