Professional Documents
Culture Documents
RREPORT ON:
COMMANDS
SUBJECT:
DATABASE MANAGEMENT SYSTEM
SUBJECT CODE: 22319
PROJECT GUIDE:
MRS. DEVAYANI GIRASEY
ACADEMIC YEAR:
2022-23
1
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION
2
Submitted in partial fulfilment of the requirement of the Diploma of
Computer Engineering
GROUP MEMBERS:
Guided By
Mrs. DEVAYANI GIRASEY MA’AM
3
ACKNOWLEDGEMENT
4
INDEX
5
INTRODUCTION
6
Architecture of SQL
SQL Query
Query Language
Processor
DBMS
Engine
Physical Database
7
1: SQL Data definition Language
• UPDATE
• DELETE
• INSERT
8
Data Types in SQL: -
➢ SQL data type is an attribute that specifies type
of data of any object. Each column, variable and
expression has related data type in SQL.
➢ A table can have up to 254 columns which may
have different or same data types and sets of
values (domains), respectively. Possible domains
are alphanumeric data (strings), numbers and
date formats.
➢ Oracle offers the following basic data types:
(1). Char- char is data type that allows us to write alphabet in
a table.
E.g., char (40)
Note: - We can set char limit as we want.
(2). Varchar- varchar datatype is a combination of variable as
well as characters in a table.
E.g., varchar (80)
Note: - We can set varchar limit as much as we want.
9
Components of SQL:
SQL consist of components such as Data Definition Language
[DDL], Data Manipulation Language [DML], Data Control
Language [DCL] and Data Query Language [DQL].
SQL Components
10
2. Data Manipulation Language (DML)
• This component of the SQL language is used to
manipulate data within a table.
• There are 3 main commands
(i) INSERT to insert rows of data into a table.
(ii) UPDATE to change rows of data in a table.
(iii) DELETE to remove rows of data from a table.
11
● Tcl command can only use with dml command i.e
( insert, update, delete ) only.
● This operations are automatically commited in the database
i.e why they cannot be used while creating tables or dropping
tables.
● There are 3 main commands
(i) Commit : Is used to saved all the transaction to the data
base.
Syntax: Commit;
(ii) Rollback : Is used to undo transaction that have not
already being save to be database.
Syntax: Rollback;
(iii) Savepoint : Is used to roll the transaction back to a
certain point without rolling back the entire transaction.
Syntax: Savepoint SP_name;
12
DDL COMMAND
• CREATE COMMAND
Data Definition Language (DDL) SQL commands are used
for creating, modifying, and dropping the structure of
database objects.
• CREATE TABLE command is used to create a table in a
database.
• Create command is also used to create a database.
Syntax:
CREATE TABLE table_name (column_name1 data_type
size, column_name2 data_type size, ….);
13
14
Database Created using syntax.
15
Table created using syntax.
16
Syntax: -
Alter table_name add column_name datatype;
Alter table_name drop column_name;
Example:
17
Syntax: -
Rename old_tablename to new_tablename;
Example:
18
Example: -
19
We can specify the columns for which you want to insert data
Syntax: -
Insert into table_name values (column1, column2,.) values
(value1, value2….);
Syntax: -
20
Update table_name
SET column_name = new_value
WHERE column_name = some_value;
Example:
2. Delete Command: -
The delete command is used to delete rows in table.
21
Syntax: -
DELETE FROM table_name
Where column_name = some_value;
Example: -
Not only element but also entire table can be deleted using
DELETE command but only values/elements we commanded
will be deleted but structure of table will be same as it was.
23
References:
• www.google.com
• www.javapoint.com
24