Uploaded by Harshit Singh

DBMS LAB FILE

advertisement
Database Management Systems Lab
AIDS254
School of Engineering and Technology
Vivekananda Institute of Professional Studies-Technical Campus
FOURTH SEMESTER
(2022-2023)
Submitted To:
Submitted By:
Name:
Dr. Ashish Kumar
Enrollment No:
Programme:
S.
No
List of Experiments (GGSIPU)
1.
Study and practice various database management systems like
MySQL/Oracle/PostgreSQL/SQL Server and others.
2.
Implement simple queries of DDL and DML.
3.
Implement basic queries to Create, Insert, Update, Delete and
Select Statements for two different scenarios (For instance:
Bank, College etc.)
4.
Implement queries including various functions- mathematical,
string, date etc.
5.
Implement queries including Sorting, Grouping and
Subqueries- like any, all, exists, not exists.
6.
Implement queries including various Set operations (Union,
Intersection, Except etc.).
7.
Implement various JOIN operations- (Inner, Outer).
8.
Write a PL/SQL program using FOR loop to insert ten rows
into a database table.
9
Given the table EMPLOYEE (Emp No, Name, Salary,
Designation, DeptID), write a cursor to select the five highestpaid employees from the table.
10
Illustrate how you can embed PL/SQL in a high-level host
language such as C/Java And demonstrates how a banking debit
transaction might be done.
Date
Sign
Grade
SECTION 1
Database Management Systems Lab
GGSIPU
Experiment 1
Name: Deepakar sora
Roll No: 01117711922
Experiment Name: Study and practice various database management systems like
MySQL/Oracle/PostgreSQL/SQL Server and others.
Theory:
1. MySQL
MySQL is a Relational Database Management System (RDBMS) software based on the SQL
(Structured Query Language), which is the popular language for accessing and managing the
records in the database. MySQL is open-source and free software under the GNU license. It
is supported by Oracle Company.
It is fast, scalable, and easy to use database management system in comparison with
Microsoft SQL Server and Oracle Database. It is commonly used in conjunction
with PHP scripts for creating powerful and dynamic server-side or web-based enterprise
applications.
MySQL provides many things, which are as follows:

It allows us to implement database operations on tables, rows, columns, and indexes.

It defines the database relationship in the form of tables (collection of rows and
columns), also known as relations.

It provides the Referential Integrity between rows or columns of various tables.

It allows us to updates the table indexes automatically.
2. PostgreSQL
PostgreSQL is a powerful, open source object-relational database management system. It has
more than 15 years of active development phase and a proven architecture that has earned it a
strong reputation for reliability, data integrity, and correctness.
PostgreSQL runs on all major operating systems, including Linux, UNIX (AIX, BSD, HPUX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. It supports text, images, sounds,
and video, and includes programming interfaces for C / C++, Java, Perl, Python, Ruby, TCL
and Open Database Connectivity (ODBC).
PostgreSQL supports a large part of the SQL standard and offers many modern features
including:

Complex SQL queries

SQL Sub-selects

Foreign keys

Trigger

Views

Transactions

Multi-version concurrency control (MVCC)

Streaming Replication (as of 9.0)
3. Oracle Database
Oracle database is a relational database management system. It is also
called OracleDB, or simply Oracle. It is produced and marketed by Oracle
Corporation. It is one of the most popular relational database engines in the IT
market for storing, organizing, and retrieving data. It is written in C++ and is not an
open-source platform and is very expensive.
Oracle database was the first DB that designed for enterprise grid computing and data
warehousing. Enterprise grid computing provides the most flexible and cost-effective
way to manage information and applications. It uses SQL queries as a language for
interacting with the database.
Some of the features of Oracle Database are:


Oracle has procedures and principles that help us to get high levels of database
performance. We can increase query execution time and operations with the use
of performance optimization techniques in its database. This technique helps to
retrieve and alter data faster.
The Oracle database can be ported on all different platforms than any of its
competitors by which we can easily write an Oracle application by making
changes to the OS and hardware in a secure manner.
4. Microsoft SQL Server
Microsoft SQL Server is an RDBMS developed by Microsoft. It is a open-source
platform. As a database server, it is a software product with the primary function of
storing and retrieving data as requested by other software applications—which may
run either on the same computer or on another computer across a network (including
the Internet). Microsoft markets at least a dozen different editions of Microsoft SQL
Server, aimed at different audiences and for workloads ranging from small singlemachine applications to large Internet-facing applications with many concurrent users.
It is written in C and C++.
Some of the features of Microsoft SQL Server are:


5. SQLite
It allows us to install multiple versions on a single computer, each of which
operates independently of the others.
It helps in reducing the operating costs of SQL Server. We can get different
services from different instances, so we don't have to buy a single license for
anything.
SQLite is a software library that implements a self-contained, serverless, zeroconfiguration, transactional SQL database engine. SQLite is the most widely deployed
SQL database engine in the world. It is written in C. It is an open-source platform.
Some of the features of SQLite are:


SQLite does not require a separate server process or system to operate
(serverless).
SQLite comes with zero-configuration, which means no setup or administration
needed.
Learning Outcomes:
Experiment 2
Name: Deepakar sora
Experiment Name: Implement simple queries of DDL and DML.
Theory:
Roll No: 01117711922
1.DDL COMMANDS
1. Create a table VIPS with 7 attributes with constraints.
2(a). Create a table VIPSTC with 7 attributes as in question 1(Add constraints after table
creation (primary key, unique key, not null, check, default)).
3 (a). Add column Commission and Phone to VIPS.
(b). Drop phone column.
(c). Change the datatype of any of the column.
4. Rename one of the columns in VIPS.
5. Rename the table name VIPS to VSET.
6. Create table VIPS1(ID, NAME, STATE, SAL, Dno).
7. Create table VIPSTC1(ID, NAME, STATE, SAL, Dno).
8. Drop the table VIPS1 and truncate VIPSTC1 and show the difference.
Firstly, we would insert some values in both the tables:
Now, we would implement the DROP command on VIPS1 and TRUNCATE command on
VIPSTC1:
The difference between TRUNCATE and DROP is: TRUNCATE command is used to delete
the data which has been inserted inside the table but the table structure is retained whereas
DROP command is used to delete a whole database or the table (i.e. the structure).
2.DML COMMANDS
1. Insert values in both tables (At least 7).
2. Show the entire table.
3. Select only 3 columns from the table (with and without where clause).
4. Update the salary of any of the employees by 3000.
5. Update the comm of each employee by 100.
6. Update the salary of employee by 500 with salary between 5000 and 6000.
7. Update the salary of the employee by 10% whose id is 7 or salary is less than 3000.
8. Delete the employee with salary between 5000 and 5500 and commission less than 5
9. Delete the employee with no comm.
10. Delete the employee who works in department.
Learning Outcomes:
Download