SQL stands for Structured Query Language, SQL is not a database system, it is a Query language. SQL is used for storing, manipulating and retrieving data in databases.

There are following five types of SQL commands as DDL, DML, DCL, TCL, and DQL.

1- DDL – Data Definition Language
2- DQl – Data Query Language
3- DML – Data Manipulation Language
4- DCL – Data Control Language
5- TQL – Transaction Control Language

1- DDL (Data Definition Language ):: This SQL commands deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database. It is a set of SQL commands used to create, modify, and delete database structures but not data.

The following below list of DDL commands

CREATE – Used to create the database or its objects (like table, index, function, views, store procedure, and triggers).
DROP – Used to delete objects from the database.
ALTER – Used to alter the structure of the database.
TRUNCATE – Used to remove all records from a table, including all spaces allocated for the records are removed.

2- DML (Data Manipulation Language) :: This SQL commands , deals with the manipulation of data present in the database belonging to DML (Data Manipulation Language) and this includes most of the SQL statements. 

The following below list of DML commands

INSERT – Used to insert data into a table.
UPDATE – Used to update existing data within a table.
DELETE – Used to delete records from a database table.
LOCK – Used to table control concurrency.

3- DCL (Data Control Language) :: This SQL commands deals as GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the database system.

GRANT – This command allows users access privileges to the database.
REVOKE – This command withdraws the user’s access privileges given by using the GRANT command

4- TCL (Transaction control language) :: This SQL commands deals with the transaction within the database

The following below list of TCL commands

COMMIT – Used to Commit a Transaction.
ROLLBACK – Used to Rollback a transaction in case of any error occurs.
SAVEPOINT – Used to Set a savepoint within a transaction.

5- TQL (Transaction Control Language):: Used to fetch the data from the database, It uses only one command

The following below one TQL command

Select – Used to select data from database table.

Database View ::

“Database View is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, like a real table.”

“Database views are created using the CREATE VIEW statement. Views can be created from a single table, multiple tables or another view.”

CREATE VIEW Syntax:: −

CREATE VIEW view_name AS
SELECT column1, column2…..
FROM table_name
WHERE [condition];

Database View also allow to include multiple tables in your SELECT statement

Example
Consider the CUSTOMERS_INFO table having the following records −

IDNAMEAGEADDRESSSALARY
1John32New York2000.00 $
2Mary25Paris1500.00 $
3Smith23Singapore2000.00 $
4Steve25London6500.00 $
5Rindy27Sydney8500.00 $

Following below example to create a View from the CUSTOMERS_INFO table. This view would be used to have customer name and age from the CUSTOMERS_INFO table.

SQL > CREATE VIEW CUSTOMERS_VIEW AS
SELECT name, age
FROM CUSTOMERS;

Now, you can query CUSTOMERS_VIEW in a similar way as you query an actual table.

Following is an example for the same.

SQL > SELECT * FROM CUSTOMERS_VIEW;

Result as below

NameAge
John32
Mary25
Smith23
Steve25
Rindy27