You are on page 1of 5

DBMS Lecture 29

BCA II

Sql Commands
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.

The standard SQL commands to interact with relational databases are CREATE,
SELECT, INSERT, UPDATE, DELETE and DROP. These commands can be classified
into groups based on their nature:

These SQL commands are mainly categorized into four categories as:
1. DDL – Data Definition Language
2. DML – Data Manipulation Language
3. DCL – Data Control Language
4. DQL – Data Query Language

Neelam Sunda, Assistant Professor, KMM JaipurPage 1


DBMS Lecture 29
BCA II

DDL -Data Definition Language:


DDL or Data Definition Language actually consists of the SQL commands that can be
used to define the database schema. It is used for creating tables, schema, indexes,
constraints etc. in database. Let’s see the operations that we can perform on database
using DDL:

Command Description

Creates a new table, a view


CREATE of a table, or other object in
database

Modifies an existing
ALTER database object, such as a
table.

Deletes an entire table, a


DROP view of a table or other
object in the database.

Remove all records from a table,


TRUNCATE including all spaces allocated
for the records are removed.

Rename an object existing in


RENAME
the database.

Add comments to the data


COMMENT
dictionary.

Neelam Sunda, Assistant Professor, KMM JaipurPage 2


DBMS Lecture 29
BCA II

DML -Data Manipulation Language:


The SQL commands that deals with the manipulation of data present in the database
belong to DML or Data Manipulation Language and this includes most of the SQL
statements.

Command
Description

INSERT
Creates a record

UPDATE
Modifies records

DELETE
Deletes records

DCL -Data Control Language:


DCL includes commands such as GRANT and REVOKE which mainly deals with the
rights, permissions and other controls of the database system.

Command Description

GRANT Gives a privilege to user

REVOKE Takes back privileges granted


from user

DQL -Data Query Language:

Command Description

SELECT Retrieves certain records from one


or more tables

Neelam Sunda, Assistant Professor, KMM JaipurPage 3


DBMS Lecture 29
BCA II

TCL –Transaction Control Language:


TCL commands deals with the transaction within the database.

Command Description

COMMIT
Commits a Transaction
Rollbacks a transaction in case
ROLLBACK
of any error occurs

Sets a save point within a


SAVEPOINT
transaction

Specify characteristics for the


SET TRANSACTION
transaction

References:
 TUTORIALS POINT Simply Easy Learning pdf from tutorialspoint.com

 https://www.geeksforgeeks.org/sql-ddl-dql-dml-dcl-tcl-commands/

 https://beginnersbook.com/2015/04/dbms-languages/

Neelam Sunda, Assistant Professor, KMM JaipurPage 4


DBMS Lecture 29
BCA II

Neelam Sunda, Assistant Professor, KMM JaipurPage 5

You might also like