0% found this document useful (0 votes)
47 views14 pages

A Presentation On SQL Commands by Harshitaa Kapoor

This document provides an overview of SQL commands presented by Harshita Kapoor. It discusses the main SQL command categories: DDL for data definition, DML for data manipulation, DCL for data control, TCL for transaction control, and DQL for data queries. Key commands include CREATE, INSERT, UPDATE, DELETE, SELECT, and ALTER to manage and retrieve data from relational databases.

Uploaded by

Harshita Kapoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views14 pages

A Presentation On SQL Commands by Harshitaa Kapoor

This document provides an overview of SQL commands presented by Harshita Kapoor. It discusses the main SQL command categories: DDL for data definition, DML for data manipulation, DCL for data control, TCL for transaction control, and DQL for data queries. Key commands include CREATE, INSERT, UPDATE, DELETE, SELECT, and ALTER to manage and retrieve data from relational databases.

Uploaded by

Harshita Kapoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

A PRESENTATION

ON SQL
COMMANDS
NAME- HARSHITA KAPOOR
ENROLLMENT NO.- 35224401721
WHAT IS SQL?
• SQL stands for Structured Query Language. It is used for storing and managing data in Relational
Database Management System (RDBMS).

• It is a standard language for Relational Database System. It enables a user to create, read, update and
delete relational databases and tables.

• All the RDBMS like MySQL, Informix, Oracle, MS Access and SQL Server use SQL as their standard
database language.

• SQL allows users to query the database in a number of ways, using English-like statements.
SQL RULES TO BE
FOLLOWED
• Structure query language is not case sensitive. Generally, keywords of SQL are written in
uppercase.

• Statements of SQL are dependent on text lines. We can use a single SQL statement on one
or multiple text line.

• Using the SQL statements, you can perform most of the actions in a database.

• SQL depends on tuple relational calculus and relational algebra.


SQL PROCESS
SQL COMMANDS.
• SQL commands are instructions. It is used to
communicate with the database. It is also used to
perform specific tasks, functions, and queries of
data.

• SQL can perform various tasks like create a table,


add data to tables, drop the table, modify the table,
set permission for users.

• There are five types of SQL commands:


• DDL
• DML
• DCL
• TCL
• DQL.
DATA DEFINITION
LANGUAGE [DDL]
• DDL CHANGES THE STRUCTURE OF THE TABLE LIKE CREATING A TABLE, DELETING A TABLE,
ALTERING A TABLE, ETC.
• ALL THE COMMAND OF DDL ARE AUTO-COMMITTED THAT MEANS IT PERMANENTLY SAVE ALL
THE CHANGES IN THE DATABASE.

HERE ARE SOME COMMANDS THAT COME UNDER DDL:


• CREATE
• ALTER
• DROP
• TRUNCATE
• CREATE It is used to create a new table in the database.
• Syntax: CREATE TABLE TABLE_NAME (COLUMN_NAME DATATYPES[,....]);
• DROP It is used to delete both the structure and record stored in the table.
• Syntax: DROP TABLE table_name;
• ALTER It is used to alter the structure of the database. This change could be either to
modify the characteristics of an existing attribute or probably to add a new attribute.
• Syntax: To add a new column in the table
• ALTER TABLE table_name ADD column_name COLUMN-definition;
• To modify existing column in the table:
• ALTER TABLE table_name MODIFY(column_definitions....);

• TRUNCATE It is used to delete all the rows from the table and free the space containing
the table.
• Syntax: TRUNCATE TABLE table_name;
DATA MANIPULATION
LANGUAGE [DML]
• DML COMMANDS ARE USED TO MODIFY THE DATABASE. IT IS RESPONSIBLE FOR ALL FORM OF
CHANGES IN THE DATABASE.

• The command of DML is not auto-committed that means it can't permanently save all the changes in the database.
They can be rollback.

• Here are some commands that come under DML:


• INSERT
• UPDATE
• DELETE
• INSERT: The INSERT statement is a SQL query. It is used to insert data into the row of a table.
• Syntax: INSERT INTO TABLE_NAME (col1, col2, col3,.... col N)
VALUES (value1, value2, value3, .... valueN); OR
• INSERT INTO TABLE_NAME
VALUES (value1, value2, value3, .... valueN);

• UPDATE: This command is used to update or modify the value of a column in the table.
• Syntax:UPDATE table_name SET [column_name1= value1,...column_name= valueN]
[WHERE CONDITION]

• DELETE: It is used to remove one or more row from a table.


• Syntax: DELETE FROM table_name [WHERE condition];
DATA CONTROL
LANGUAGE [DCL]
• DCL COMMANDS ARE USED TO GRANT AND TAKE BACK AUTHORITY FROM ANY DATABASE
USER.

• Here are some commands that come under DCL:


• Grant
• Revoke

• Grant: It is used to give user access privileges to a database.


• Syntax: GRANT SELECT, UPDATE ON MY_TABLE TO SOME_USER, ANOTHER_USER;

• Revoke: It is used to take back permissions from the user.


• Syntax: REVOKE SELECT, UPDATE ON MY_TABLE FROM USER1, USER2;
TRANSACTION CONTROL
LANGUAGE [TCL]
• TCL COMMANDS CAN ONLY USE WITH DML COMMANDS LIKE INSERT, DELETE AND UPDATE
ONLY.
• These operations are automatically committed in the database that's why they cannot be used while creating tables
or dropping them.

• Here are some commands that come under TCL:


• COMMIT
• ROLLBACK
• SAVEPOINT
• Commit: Commit command is used to save all the transactions to the database.
• Syntax: COMMIT;

• Rollback: Rollback command is used to undo transactions that have not already been saved to the
database.
• Syntax: ROLLBACK;

• SAVEPOINT: It is used to roll the transaction back to a certain point without rolling back the entire
transaction.
• Syntax: SAVEPOINT SAVEPOINT_NAME;
DATA QUERY LANGUAGE
[DQL]
• DQL IS USED TO FETCH THE DATA FROM THE DATABASE.

• It uses only one command:


• SELECT

• SELECT: This is the same as the projection operation of relational algebra. It is used to select the
attribute based on the condition described by WHERE clause.
• Syntax:SELECT expressions
FROM TABLES
WHERE conditions;

You might also like