What is SQL?

SQL is Structured Query Language. It helps to execute queries against database. It helps to insert, retrieve, update and delete data from database.

Categories of SQL:

1.DDL (Data Definition Language): Defines structure and relationship of data.

Create: To create object of database such as table, view etc.

Alter: To alter structure of database

Drop: To delete structure of database

Truncate: To remove only record, but structure is exists

Rename: To rename object of database such as table, view etc

2.DML (Data Manipulation Language): To perform some set of operations on database

Select: To retrieve data from database

Insert: To store data inside database

Update: To update data

Delete: To delete Record from database

3.DCL (Data Control Language): To provide controlled access to database

Grant: To give access privileges to different database users

Revoke: To remove assigned privileges from users

4.TCL (Transaction Control Language): Manages the change made by DML statements. For Example, commit, Rollback, Savepoint etc.

Constraints in SQL:

  1. Not Null: It enforces a column to NOT accept NULL values.
  2. UNIQUE: It uniquely identifies each record in a database table. It provides guarantee for uniqueness for set of column.
  3. PRIMARY KEY: It uniquely identifies each record in a database table. Primary key must be unique value.
  4. FOREIGN KEY: A foreign key in one table points to a Primary Key in another table.
  5. CHECK: Limits the value range that can be placed in a column.
  6. DEFAULT: Inserts default value in a column.

Advantages of SQL:

It has good Portability.

It is interactive language

No coding required

It has high speed.

Edusera
Logo
Open chat
1
Scan the code
Hello!👋
Can we help you?