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

Dbms File Format Shubham

Uploaded by

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

Dbms File Format Shubham

Uploaded by

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

Practical File

of

Database Management
System
(Software Lab-4)

Submitted To: Submitted By:


Mr. Pardeep Kumar Shubham
Dept. of CSE BCA II Sem
Roll No: 22001041054

___________________________________________________________________________________________
Deenbandhu Chhotu Ram University of Science and Technology
Murthal, Sonipat- INDIA,
A Haryana State Government University

INDEX

S.NO EXPERIMENT NAME D.O.P D.O.C


1

10
Experiment No : 1
Aim: Basics of SQL : DDL, DML, TCL, DCL and DQL.

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
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.
 COMMENT: This is used to add comments to the data
dictionary.
 RENAME: This is used to rename an object existing in the
database.
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. 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.
 EXPLAIN PLAN: It describes the access path to data.

TCL (Transaction Control Language):


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 successfully complete. 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.
 ROLLBACK: Rollbacks a transaction in case of any error
occurs.
 SAVEPOINT: Sets a save point within a transaction.
 SET TRANSACTION: Specifies characteristics for the
transaction.

DCL (Data Control Language):


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.
 REVOKE: This command withdraws the user’s access
privileges given by using the GRANT command.

DQL (Data Query Language):


DQL statements are used for performing queries on the data
within schema objects. The purpose of the DQL Command is to
get some schema relation based on the query passed to it. We can
define DQL as follows it is a component of SQL statement that
allows getting data from the database and imposing order upon it.
It includes the SELECT statement. This command allows getting
the data out of the database to perform operations with it. When a
SELECT is fired against a table or tables the result is compiled
into a further temporary table, which is displayed or perhaps
received by the program i.e. a front-end.
List of DQL:
 SELECT: It is used to retrieve data from the database.

EXPERIMENT NO: 2
AIM: Detailed explanation of DBMS architecture.
DBMS Architecture
o The DBMS design depends upon its architecture. The basic
client/server architecture is used to deal with a large number
of PCs, web servers, database servers and other components
that are connected with networks.
o The client/server architecture consists of many PCs and a
workstation which are connected via the network.
o DBMS architecture depends upon how users are connected
to the database to get their request done.
Types of DBMS Architecture
Database architecture can be seen as a single tier or multi-tier. But
logically, database architecture is of two types like: 2-tier
architecture and 3-tier architecture.
1-Tier Architecture
o In this architecture, the database is directly available to the
user. It means the user can directly sit on the DBMS and
uses it.
o Any changes done here will directly be done on the database
itself. It doesn't provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local
application, where programmers can directly communicate
with the database for the quick response.
2-Tier Architecture
o The 2-Tier architecture is same as basic client-server. In the
two-tier architecture, applications on the client end can
directly communicate with the database at the server side.
For this interaction, API's like: ODBC, JDBC are used.
o The user interfaces and application programs are run on the
client-side.
o The server side is responsible to provide the functionalities
like: query processing and transaction management.
o To communicate with the DBMS, client-side application
establishes a connection with the server side.
3-Tier Architecture
o The 3-Tier architecture contains another layer between the
client and server. In this architecture, client can't directly
communicate with the server.
o The application on the client-end interacts with an
application server which further communicates with the
database system.
o End user has no idea about the existence of the database
beyond the application server. The database also has no idea
about any other user beyond the application.
o The 3-Tier architecture is used in case of large web
application.
EXPERIMENT NO : 3
AIM : Keys in Database Management System.
What are the different types of Keys in DBMS?
Keys are of seven broad types in DBMS:
1. Candidate Key
2. Primary Key
3. Foreign Key
4. Super Key
5. Alternate Key
6. Composite Key
7. Unique Key

1. Primary Key
The primary key refers to a column or a set of columns of a table
that helps us identify all the records uniquely present in that table.
A table can consist of just one primary key. Also, this primary key
cannot consist of the same values reappearing/repeating for any
of its rows. All the values of a primary key have to be different,
and there should be no repetitions.
The PK (PRIMARY KEY) constraint that we put on a column/set
of columns won’t allow these to have a null value or a duplicate.
Any table can consist of only a single primary key constraint. A
foreign key (explained below) that refers to it can never change
the values present in the primary key.

2. Super Key
A super key refers to the set of all those keys that help us
uniquely identify all the rows present in a table. It means that all
of these columns present in a table that can identify the columns
of that table uniquely act as the super keys.
A super key is a candidate key’s superset (candidate key has been
explained below). We need to pick the primary key of any table
from the super key’s set so as to make it the table’s identity
attribute.
3. Candidate Key
The candidate keys refer to those attributes that identify rows
uniquely in a table. In a table, we select the primary key from a
candidate key. Thus, a candidate key has similar properties as that
of the primary keys that we have explained above. In a table,
there can be multiple candidate keys.
4. Alternate Key
As we have stated above, any table can consist of multiple
choices for the primary key. But, it can only choose one. Thus, all
those keys that did not become a primary key are known as
alternate keys.
5. Foreign Key
We use a foreign key to establish relationships between two
available tables. The foreign key would require every value
present in a column/set of columns to match the referential table’s
primary key. A foreign key helps us to maintain data as well as
referential integrity.

6. Composite Key
The composite key refers to a set of multiple attributes that help
us uniquely identify every tuple present in a table. The attributes
present in a set may not be unique whenever we consider them
separately. Thus, when we take them all together, it will ensure
total uniqueness.
7. Unique Key
A unique key refers to a column/a set of columns that identify
every record uniquely in a table. All the values in this key would
have to be unique. Remember that a unique key is different from
a primary key. It is because it is only capable of having one null
value. A primary key, on the other hand, cannot have a null value.

You might also like