You are on page 1of 12

DELHI TECHNOLOGICAL UNIVERSITY

(FORMERLY Delhi College of Engineering)


Bawana Road, DELHI - 110042

SE206 : LAB FILE


For the evaluation of
6th semester in
DATABASE MANAGEMENT SYSTEM (SE206)

SUBMITTED BY: SUBMITTED TO:


Divyanshu Sinha Miss Parul Sharma
2K21/EC/83
EXPERIMENT 1

Aim :

Introduction to Database management systems.

Description of aim & related theory :


A Database Management System (DBMS) is a software system that is designed to manage
and organise data in a structured manner. It allows users to create, modify, and query a
database, as well as manage the security and access controls for that database. DBMS
provides an environment to store and retrieve the data in coinvent and efficient manner.

Databases serve as structured repositories for organising and storing data, enabling efficient
retrieval, manipulation, and management of information. They play a pivotal role in various
applications ranging from simple data storage to complex business operations and decision-
making processes. Understanding databases is essential for individuals involved in software
development, data analysis, and information technology sectors.

Key Features of DBMS :-

• Data modelling: A DBMS provides tools for creating and modifying data models, which
define the structure and relationships of the data in a database.

• Data storage and retrieval: A DBMS is responsible for storing and retrieving data from
the database, and can provide various methods for searching and querying the data.

• Concurrency control: A DBMS provides mechanisms for controlling concurrent access


to the database, to ensure that multiple users can access the data without conflicting with
each other.

• Data integrity and security: A DBMS provides tools for enforcing data integrity and
security constraints, such as constraints on the values of data and access controls that
restrict who can access the data.

• Backup and recovery: A DBMS provides mechanisms for backing up and recovering
the data in the event of a system failure.

• DBMS can be classified into two types: Relational Database Management System
(RDBMS) and Non-Relational Database Management System (NoSQL or Non-SQL)

• RDBMS: Data is organised in the form of tables and each table has a set of rows and
columns. The data are related to each other through primary and foreign keys.
• NoSQL: Data is organised in the form of key-value pairs, documents, graphs, or column-
based. These are designed to handle large-scale, high-performance scenarios.

A database is a collection of interrelated data which helps in the efficient retrieval, insertion,
and deletion of data from the database and organises the data in the form of tables, views,
schemas, reports, etc. For Example, a university database organises the data about students,
faculty, admin staff, etc. which helps in the efficient retrieval, insertion, and deletion of data
from it.

Several types of DBMS :-

• Relational DBMS (RDBMS): An RDBMS stores data in tables with rows and columns,
and uses SQL (Structured Query Language) to manipulate the data.

• Object-Oriented DBMS (OODBMS): An OODBMS stores data as objects, which can


be manipulated using object-oriented programming languages.

• NoSQL DBMS: A NoSQL DBMS stores data in non-relational data structures, such as
key-value pairs, document-based models, or graph models.

Discussion :
The introduction to databases provides a foundational understanding of their role in
managing information effectively. It sets the stage for further exploration into database
management systems and related concepts. In conclusion, a Database Management System
(DBMS) employs the 3-Tier Architecture, a tried-and-true structure that separates an
application into three main layers: Presentation, Application Logic, and Data. This
architectural technique is increasingly popular for creating dependable and maintainable
software systems that communicate with databases because it improves the modularity,
scalability, security, reusability, and flexibility of applications.

Finding & Learning :


• Explored various relational database systems and their features.
• Gained insights into the strengths and weaknesses of different database options.
• Recognized the importance of compatibility with programming languages and
operating systems.
EXPERIMENT 2

Aim :

Various types of Relational Database Systems.

Description of aim & related theory :


RDBMS is a type of DBMS that organises data in a tabular format with relationships
between tables, while DBMS can use different data organisation models and may not
enforce strict relationships between data entities. In an RDBMS, data is stored in tables,
where each table represents a specific entity or concept. The tables consist of rows (also
known as tuple in RDBMS or records) that represent individual instances of the entity, and
columns that define the attributes or properties of the entity. The relational model facilitates
the establishment of relationships between tables through keys. A primary key uniquely
identifies each row in a table, while foreign keys establish relationships between tables by
referencing the primary key of another table.

Types of RDBMS (Relational Database Management Systems) :-

1. Oracle Database: Oracle Database is a widely used RDBMS known for its scalability,
security, and comprehensive feature set. It offers robust support for data management,
high availability, and advanced analytics capabilities.

2. MySQL: MySQL is a popular open-source RDBMS that is known for its simplicity,
speed, and ease of use. It is widely used in web applications and is known for its
scalability, reliability, and compatibility with various platforms.

3. SQL Server: Microsoft SQL Server is a powerful RDBMS developed by Microsoft. It


offers a wide range of features, including advanced security, business intelligence tools,
and integration with other Microsoft products and technologies.

4. PostgreSQL: PostgreSQL is a feature-rich open-source RDBMS known for its


extensibility and compliance with industry standards. It offers a strong emphasis on data
integrity, reliability, and support for advanced SQL features.

5. IBM Db2: IBM Db2 is an enterprise-level RDBMS designed for high-performance and
scalability. It offers advanced data management capabilities, support for large-scale
deployments, and integration with other IBM products and technologies.

6. Microsoft Access: Microsoft Access is a relational database management system


(RDBMS) developed by Microsoft. It is primarily designed for small-scale database
applications, allowing users to create and manage databases without requiring extensive
programming knowledge.

7. Azure SQL: Azure SQL is a cloud-based relational database service provided by


Microsoft Azure. It is based on the popular Microsoft SQL Server database engine and
offers a scalable, secure, and managed platform for hosting and managing relational
databases in the cloud.

These are just a few examples of the types of RDBMS available. Each RDBMS has its own
strengths, features, and use cases, so the choice of the RDBMS depends on factors such as
specific requirements, scalability needs, budget, and preferences of the organisation or
application developer.

Discussion :
Understanding the different types of relational database systems helps in selecting the most
suitable option based on specific project requirements, performance considerations, and
compatibility needs.

Finding & Learning :


• Explored various relational database systems and their features.
• Gained insights into the strengths and weaknesses of different database options.
• Recognised the importance of compatibility with programming languages and operating
systems.
EXPERIMENT 3

Aim :

Creation of a Databases and writing SQL queries to retrieve information from the database.

Description of aim & related theory :


SQL (Structured Query Language) is a standard programming language used for managing
and manipulating relational databases. In this experiment, we will create a sample database
and write SQL queries to perform operations such as selecting, inserting, updating, and
deleting data.

Code :

// Creation of database

mysql> CREATE DATABASE Office;

// Showing all the databases in the system

mysql> SHOW DATABASES;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| Office |
| performance_schema |
| sys |
+——————————+

// Using the desired database


mysql> USE Office;

// Creation of a Table
mysql> CREATE TABLE EMPLOYEE
-> (Fname VARCHAR(15) NOT NULL,
-> Minit CHAR,
-> Lname VARCHAR(15) NOT NULL,
-> Ssn CHAR(9) NOT NULL,
-> Bdate DATE,
-> Address VARCHAR(30),
-> Sex CHAR,
-> Salary DECIMAL(10,2),
-> Super_ssn CHAR(9),
-> Dno INT NOT NULL,
-> PRIMARY KEY (Ssn),
-> FOREIGN KEY (Super_ssn) REFERENCES EMPLOYEE(Ssn),
-> FOREIGN KEY (Dno) REFERENCES DEPARTMENT(Dnumber));
//Description of the table
mysql> DESCRIBE EMPLOYEE;
+-----------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------+------+-----+---------+-------+
| Fname | varchar(15) | NO | | NULL | |
| Minit | char(1) | YES | | NULL | |
| Lname | varchar(15) | NO | | NULL | |
| Ssn | char(9) | NO | PRI | NULL | |
| Bdate | date | YES | | NULL | |
| Address | varchar(30) | YES | | NULL | |
| Sex | char(1) | YES | | NULL | |
| Salary | decimal(10,2) | YES | | NULL | |
| Super_ssn | char(9) | YES | | NULL | |
| Dno | int | NO | | NULL | |
+—————+---------------+------+-----+---------+-------+

//Inserting data into the table


mysql> INSERT INTO EMPLOYEE (‘Franklin’, ’T’, ‘Wong’, 333445555, '1955-12-08’,
‘638 Voss, Houston, TX’, 'M', 40000, 888665555, 5)

//Displaying the table


mysql> SELECT*FROM EMPLOYEE;

Output :
Finally displaying the table ‘EMPLOYEE’ created with in ‘Office’ database:

Discussion :
This experiment demonstrates the basic operations of creating a database, defining tables,
inserting data, showing tables in a database, and using the desired database and querying
data using SQL.

Finding & Learning :


• Learned how to create a database and tables using SQL.
• Then to insert the data into the table.
• Ans also to display the table.
• Practiced writing SQL queries to manipulate data.
EXPERIMENT 4

Aim :

To implement Data Definition Language : (DDL)

• Create, Alter, Drop, Truncate


• To implement constraints:
- Primary key
- Foreign key
- Check
- Unique
- Not Null and Null
- Default

Description of aim & related theory :


DDL commands are used to define, modify, and remove the structure of database objects
such as tables and indexes. Common DDL commands include CREATE, ALTER, DROP,
and TRUNCATE.

Code :

// Creation of a Table
mysql> CREATE TABLE STUDENT
-> (Fname VARCHAR(15) NOT NULL,
-> Lname VARCHAR(15) NOT NULL,
-> Rollno INT NOT NULL,
-> Branch VARCHAR(5) NOT NULL,
-> Sex CHAR,
-> PRIMARY KEY (Rollno));

// Alteration in the table created above


mysql> ALTER TABLE STUDENT
-> ADD Phone VARCHAR(20);

// Dropping the above table


mysql> DROP TABLE STUDENT

//Truncating the above table


mysql> TRUNCATE TABLE STUDENT
Output :
Finally displaying the table ‘STUDENT’ created with in ‘Office’ database:

Before alteration:

After alteration :

Discussion :
DDL commands are essential for managing the structure of databases. This experiment
demonstrates how to create, alter, drop, and truncate tables using DDL commands.

Finding & Learning :


• Learned how to use DDL commands for database management.
• Learned various DDL commands like CREATE, ALTER, DROP and TRUNCATE.
• Other than that we also learned implementing the primary key and other constraints.
• Understood the significance of DDL in database administration.
EXPERIMENT 5

Aim :

To implement Data Manipulation Language (DML)


• Insert
• Select
• Update
• Delete

Description of aim & related theory :


A data-manipulation language (DML) is a language that enables users to access or
manipulate data as organised by the appropriate data model. The types of access are:

• Retrieval of information stored in the database.


• Insertion of new information into the database.
• Deletion of information from the database.
• Modification of information stored in the database.

Code :

// Inserting into a table


mysql> INSERT INTO STUDENT VALUES ('Divyanshu', 'Sinha', 83, 'ECE', 'M',
8287063262);
mysql> INSERT INTO STUDENT VALUES ('Aditya', 'Goyal', 22, 'COE', 'M',
7353367378);
mysql> INSERT INTO STUDENT VALUES ('Ayushi', 'Prasoon', 40, 'IT', 'M',
9354726457);
mysql> INSERT INTO STUDENT VALUES ('Harshita', 'Tiwari', 32, 'MCE', 'F',
8364527356);

// Selection in the table created above


mysql> SELECT*FROM STUDENT;

// Updation in the above table


mysql> UPDATE STUDENT
-> SET Sex = 'F'
-> WHERE Rollno = 40;

// Deleting the above table


mysql> DELETE FROM STUDENT
-> WHERE Rollno = 22;
Output :
Finally displaying the table ‘STUDENT’ created with in ‘Office’ database:

Before updation:

After updation :

After deletion :

Discussion :
DML commands are crucial for manipulating data in a database. This experiment
demonstrates how to insert, select, update, and delete data using DML commands.

Finding & Learning :


• Learned how to use DML commands for database management.
• Learned various DML commands like INSERT, SELECT, UPDATE and DELETE.
• Understood the significance of DML in database administration.

You might also like