0% found this document useful (0 votes)
38 views

Structured Query Language

Structured Query Language (SQL) is used to interact with and manage databases. It allows users to create, modify, and interact with database objects like tables as well as insert, update, delete, and query data. SQL commands are divided into four main categories: data definition language (DDL) for defining schemas, data manipulation language (DML) for managing data, data control language (DCL) for setting permissions, and transaction control language (TCL) for managing transactions.

Uploaded by

Rosita
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Structured Query Language

Structured Query Language (SQL) is used to interact with and manage databases. It allows users to create, modify, and interact with database objects like tables as well as insert, update, delete, and query data. SQL commands are divided into four main categories: data definition language (DDL) for defining schemas, data manipulation language (DML) for managing data, data control language (DCL) for setting permissions, and transaction control language (TCL) for managing transactions.

Uploaded by

Rosita
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Structured Query Language (SQL), as we all know, is the database

language by the use of which we can perform certain operations on the


existing database, and also we can use this language to create a database.

SQL commands are like instructions to a table. It is used to interact with the
database with some operations. It is also used to perform specific tasks,
functions, and queries of data. SQL can perform various tasks like creating a
table, adding data to tables, dropping the table, modifying the table, set
permission for users.
These SQL commands are mainly categorized into five categories:
1. DDL – Data Definition Language
2. DML – Data Manipulation Language
3. DCL – Data Control Language
4. TCL – Transaction Control Language
Data Definition Language actually consists of the SQL commands that can
be used to define the database schema. It simply deals with descriptions of
the database schema and is used to create and modify the structure of
database objects in the database. DDL is a set of SQL commands used to
create, modify, and delete database structures but not data. These
commands are normally not used by a general user, who should be
accessing the database via an application.
List of DDL commands:

 CREATE: This command is used to create the database or its


objects (like table, index, function, views, store procedure, and
triggers).
 DROP: This command is used to delete objects from the database.
 ALTER: This is used to alter the structure of the database.
 TRUNCATE: This is used to remove all records from a table,
including all spaces allocated for the records are removed.

DML

The SQL commands that deal with the manipulation of data present in the
database belong to DML or Data Manipulation Language and this includes
most of the SQL statements. It is the component of the SQL statement that
controls access to data and to the database. Basically, DCL statements are
grouped with DML statements.
List of DML commands:

 INSERT: It is used to insert data into a table.


 UPDATE: It is used to update existing data within a table.
 DELETE: It is used to delete records from a database table.
 LOCK: Table control concurrency.
 CALL: Call a PL/SQL or JAVA subprogram.

DCL

DCL includes commands such as GRANT and REVOKE which mainly deal
with the rights, permissions, and other controls of the database system.
List of DCL commands:
GRANT: This command gives users access privileges to the database.
Syntax:
GRANT SELECT, UPDATE ON MY_TABLE TO SOME_USER, ANOTHER_US
ER;
REVOKE: This command withdraws the user’s access privileges given by
using the GRANT command.

TCL
Transactions group a set of tasks into a single execution unit. Each
transaction begins with a specific task and ends when all the tasks in the
group are successfully completed. If any of the tasks fail, the transaction
fails. Therefore, a transaction has only two results: success or failure. You
can explore more about transactions here. Hence, the following TCL
commands are used to control the execution of a transaction:
BEGIN: Opens a Transaction.
COMMIT: Commits a Transaction.
Syntax:
COMMIT;

You might also like