SQL Important Questions For Placement
SQL Important Questions For Placement
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,
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
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.
Normalization is the process of organizing data to reduce redundancy and dependency. Types of
normalization:
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.
An index is a database object that improves the speed of data retrieval operations on a table at the
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.
A subquery is a query within another query. It is used to return data that will be used in the main
UNION combines the result of two or more queries and removes duplicate rows, whereas UNION
A view is a virtual table based on the result-set of an SQL query. It can be used to simplify complex
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
COUNT, SUM, AVG, etc. It is often used with aggregate functions (e.g., COUNT, AVG) to
summarize data.
A trigger is a special kind of stored procedure that automatically executes when certain events occur