DEV Community

bhuvaneswari nandhagopal
bhuvaneswari nandhagopal

Posted on

SQL Interview Preparation Notes:

1.What is SQL?
SQL stands for structured query language. it is used to store, retrieve, update, and delete data from a database.

2.What is DBMS?
DBMS stands for database management system. It is software used to create, store, and manage data.

EXAMPLE: MySQL, SQL Server, Oracle.

3.What is a database?
A database is a collection of related data stored in an organized way.
EXAMPLE:
Employee details, Student details.

4.What is table?
A table stored data in rows and columns.

5.What is a primary key?
A primary key uniquely identifies each record in a table. It cannot have duplicate or NULL values.

  1. What is a foreign key?
    A foreign key is used to connect two tables. It creates a relationship between them.

  2. What is difference between primary key and foreign key?
    A primary key uniquely identifies each record in a table. A foreign key links one table with another table.

  3. What are SQL commands?
    SQL commands are used to perform different operations in a database.

Thet are

  1. DDL
  2. DML
  3. DQL
  4. DCL
  5. TCL

9.What is DDL?
DDL stands for data definition language. It is used to create or modify database object like tables.

10.What is DML?
DML stands for data manipulation language. It is used to insert, update and delete data.
EXAMPLES:
Insert, Update, Delete.

  1. What is DQL? DQL stands for data query language. It is used to retrieve data from a table.

EXAMPLE: select.

12.What is DCL?
DCL stands for data control language. It is used to give or remove permissions.
EXAMPLE:GRANT, REVOKE.

13.What is TCL?
TCL stands for transaction control language. it is used to manage transaction.

EXAMPLES: Commit, Rollback, Savepoint.

14.What is a join?
A join is used to combine data from two or more tables based on a common column.

15.Types of join?
1.Inner join - Returns matching records.
2.Left join - Returns all records from the left table.
3.Right join - Returns all records from the right table.
4.Full join - Returns all records from both tables.

16.What is the difference between DELETE, TRUNCATE, and DROP?
1.DELETE removes selected rows.
2.TRUNCATE removes all rows from a table.
3.DROP removes the entire tables, including its structure.

17.What is a view?
A view is a virtual table created from one or more tables.

18.What is an index?
An index helps retrieve data faster and improves query performance.

19.What is SQL used for?
SQL is used to create databases, store data, retrieve data, update data, delete data, and manage databases.

20.What is select?
SELECT is a SQL command used to retrieve or fetch data from a database table. It can return all columns using * or only the specific columns we need.

21.What is from for SQL?
FROM is a SQL clause that specifies the table from which SQL retrieves the data.

22.What is WHERE in SQL?
WHERE is a SQL clause used to filter records based on a condition. It returns only the rows that match the specified condition.

23.What is ORDER BY in SQL?
ORDER BY is a SQL clause used to sort the data in ascending or descending order.

24.What is GROUP BY in SQL?
GROUP BY is a SQL clause used to group rows that have the same values in a column. It is commonly used with aggregate functions like COUNT(), SUM(), AVG(), MAX(), and MIN().

25.What is HAVING in sql?
HAVING is used to filter grouped records based on aggregate functions like COUNT(), SUM(), AVG(), MAX(), and MIN()

Top comments (0)