You are on page 1of 24

G V ACHARYA POLYTECHNIC, SHELU

Acharya Technical Education Campus, Raigad, Shelu, Maharashtra 410201

RREPORT ON:
COMMANDS
SUBJECT:
DATABASE MANAGEMENT SYSTEM
SUBJECT CODE: 22319
PROJECT GUIDE:
MRS. DEVAYANI GIRASEY
ACADEMIC YEAR:
2022-23

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

1
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION

This is to certify that Mr. SUJAL .S .THAKUR


Of semester – III of diploma in COMPUTER ENGINEERING of institute, G V
ACHARAYA POLYTECHNIC, SHELU has completed the Micro project
satisfactorily in subject – DATABASE MANAGEMENT SYSTEM ON
COMMANDS for the academic year 2022-23 as prescribed in the curriculum
Place: ENROLLMENT NO: 2211440174
Date: 2211440164
2211440173

SUBJECT TEACHER HEAD OF THE DEPARTMENT PRINCIPAL

MRS. DEVAYANI MRS. DEVAYANI GIRASEY MR. PAWAR

2
Submitted in partial fulfilment of the requirement of the Diploma of
Computer Engineering

GROUP MEMBERS:

SR.NO NAME OF STUDENT ENROLLMENT


1. SUJAL THAKUR 2111440174
2. DNYANDEO PAWAR 2211440164
3. KEDAR TONPE 2211440173

Guided By
Mrs. DEVAYANI GIRASEY MA’AM

3
ACKNOWLEDGEMENT

We extend our special thanks to all teaching and non-


teaching staff. Success is nourished under the combination
of perfect guidance, care and blessing. Acknowledgement is
the best way to convey Last few years spend in estimated
institution has molded us into confident and aspiring
engineers. We express our sense of gratitude towards our
project guide Mrs. Devyani. It is because of her valuable
guidance, analytical approach encouragement that we could
learn, work and complete the project. We will always
cherish great experience work under the enthusiastic
guidance.
We are also grateful to our principal and our vice principal
who not only supported us in our project but also
encouraged for every creative activity. We also sincerely
give thanks to our head of department Mrs. Devyani of
computer and its mission. Sector, friends and well-wishers
to directly or indirectly contribute for the success of our
maiden.

4
INDEX

Sr.No CONTENT Page No.


1. INTRODUCTION 6
2. Architecture Of SQL 7-8
3. Data Types In SQL 9
4. Components Of SQL 10-11
5. DDL Command 12-22
6. Conclusion 23
7. Reference 24

5
INTRODUCTION

Commands comes under SQL.


• SQL: -
1 SQL is a standard language for accessing and
manipulating databases. SQL stands for Structured
Query Language.
2 SQL was developed by IBM Research in the mid-1970s
and standardized by ANSI in 1986. It is also
pronounced as "Sequel".
3 The relational model defines two root languages for
accessing a relational database Relational Algebra and
Relational Calculus.
4 Relational Algebra (RA) is a low-level, operator-
oriented language. Creating a query in Relational
Algebra involves combining relational operators using
algebraic notation.
5 Relational Calculus is a high-level, declarative
language. Creating a query in Relational Calculus
involves describing what results are desired.
6 SQL is a version of Relational Calculus. The basic
structure in SQL is the statement. Semicolons
separate multiple SQL statements.

6
Architecture of SQL
SQL Query

Query Language
Processor

DBMS
Engine

Physical Database

According to architecture there are three basic categories of


SQL statements:

1: SQL Schema Statements (DDL)


2: SQL Data statements (DML)

7
1: SQL Data definition Language

(i): - The Data Definition Language (DDL) part of SQL permits


database tables to be created or deleted.
(ii): - We can also define indexes (keys), specify links between
tables and impose constraints between database tables.

2: - SQL Data Manipulation Language


(i): - SQL is a syntax for executing queries. But the SQL
language also includes a syntax to update, insert and delete
records.
(ii): -These query and update commands together form the
Data Manipulation Language (DML) part of SQL:

• UPDATE
• DELETE
• INSERT

Now before we learn about command, we have to know


something that is called as “Data Types”.

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

DDL DML DCL DQL TCL

1. Data Definition Language (DDL):


• This component of the SQL language is used to create
and modify tables and other objects in the database.
• For tables there are three main commands:
(1) CREATE TABLE to create a table in the database.
(2) DROP TABLE to remove a table from the database.
(3) ALTER TABLE to add or remove columns from a table in
the database.

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.

3. Data Control Language (DCL)


• This component of the SQL language is used to create
privileges to allow users access to, and manipulation of,
the database.
• There are 2 main commands:
(i) GRANT to grant a privilege to a user.
(ii) REVOKE to revoke (remove) a privilege from a user.

4. Data Query Language (DQL)


• This Component of SQL that are used to retrieve data
from the database are collectively called as DQL.
• SELECT to retrieve data from table.

5. Transaction Control Language (TCL)

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

(1) SQL commands are instructions used to communic


ate with the database to perform specific task that work
with data.

(2) SQL commands can be used not only for searching


the database but also to perform various other
functions like, you can create tables, add data to tables,
or modify data, drop the table, set permissions for
users.

• 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.

Commands used: - 1. use database_name;


2. create table marksheet(id int,name varchar(20),roll_no
int);

● Alter table command

Alter table command is used to add or delete columns in


an existing table.

16
Syntax: -
Alter table_name add column_name datatype;
Alter table_name drop column_name;

Example:

• The RENAME Command

The rename command is used to rename old table name


to the new table name.

17
Syntax: -
Rename old_tablename to new_tablename;

Example:

When we renamed the table describe marksheet will


show error because marksheet now don’t exist for
computer in database.

Content of table remains same, just the name has


changed to student_annual_report

Drop command is used to delete the table from a


described database.

Syntax: - drop table_name;

18
Example: -

Now table student annual report will not be there in


entire database.

➢ Now we just created structure of data. Now if we


have to enter values for the structure of data then
We will use DML commands.

➢ By using DML commands we will insert values in


the table.

➢ DML command is used to insert, update and delete


elements in a table.

1. Insert Command: - The insert into table is used to insert


new rows or values in table.
Syntax: -
Insert into table_name values(value 1,value 2……);

19
We can specify the columns for which you want to insert data
Syntax: -
Insert into table_name values (column1, column2,.) values
(value1, value2….);

This is how we enter the values in a table using insert


command.
2. Update Command: -The update command is used to
update values in a table or modify in the table.

Syntax: -

20
Update table_name
SET column_name = new_value
WHERE column_name = some_value;

Example:

Update command is simply just used to replace values of


elements in the table.

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: -

By using delete command we can simply delete any element


from the table.

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.

Syntax: - DELETE FROM table_name;


OR
DELETE * FROM table_name
22
Conclusion:

So far we have discussed all the five categories of SQL


Commands i.e DCL, DML, DDL, TCL and DQL and it’s
subtypes. We’ve gone through each command in detail with
its syntax and example that will assist you in writing
queries. The SQL Commands’ allows you to construct and
manipulate a wide range of database objects with the
different commands. After going through this blog one can
easily play with the SQL commands and interact with their
database easily.

23
References:

• www.google.com
• www.javapoint.com

24

You might also like