Sunteți pe pagina 1din 17

DATABASE MANAGEMENT SYSTEM

LAB FILE

SUBMITTED BY:
NAME : PRASHUK JAIN
ROLL NO : 2K17 / CO / 233
GROUP – G1(A4)
Page no. 2

INDEX
S.No Content Page Done Checked Sign Remarks
No. On On
Page no. 3

VISION
The Department of Computer Science & Engineering strives to be a leading world class
technology department with excellence in creating, applying, and imparting theoretical,
experimental, and applied knowledge through comprehensive educational programs and
collaborative research, playing its role as a key node in national and global network to
empower the industry and society with the wings of knowledge and power of innovation.

MISSION
1. To nurture the talent of students for research, innovation and excellence in the field of
Computer Science & Engineering.
2. To develop highly analytical and qualified computer engineers by giving hands-on
training on cutting-edge technology.
3. To produce socially responsible computer engineers with professional ethics.
4. To focus on R&D environment in close partnership with industry and academia globally.
5. To produce up-to date, scientifically tempered, design oriented engineers and scientists
capable of lifelong learning.

PROGRAM OBJECTIVES
1. To acquire in-depth knowledge of software and hardware techniques, which provide a
strong foundation to pursue continuing education and nurture the talent for innovation and
research.
2. To nurture the talent in leadership qualities, at an appropriate level in order to address
the issues in a responsive, ethical and innovative manner.
3. To excel in careers by being a part of success and growth of an organization with whom
they will be associated.
4. To inculcate the ability for lifelong learning by active participation in self-study courses,
seminars, research projects.
Page no. 4 PRACTICAL NO. 1
09/01/2019

Objective – To differentiate different DBMS softwares and choose the best.


Problem Statement - Differentiate between any of the 5 RDBMS softwares and give
reasons for the one you choose.

A. Amazon Aurora vs mySQL vs Oracle vs Postgresql vs Mongodb

IMPORTANT - SQL is not a language like one would think of an object-oriented language
or procedural language. In many ways the ANSI SQL standard is more like a protocol or a
series of generally accepted statements based on mathematical principles of set
theory, predicate logic and relational algebra.
But how individual RDBMS developers implement these standards vary significantly across
various proprietary software enough so to almost classify each individual implementation as
a language of its own.
For instance, Oracle SQL is quite different from Microsoft SQL Server SQL which is different
to MySQL, etc. On top of this, each company implements their own unique functions,
database engine and (in some cases) procedural languages on top of the traditional ANSI
SQL standard statements. Some even choose to abandon the standard at times in favor of
their own personal implementation.

MySQL - MySQL is a full-featured open-source relational database management system


(RDBMS) that was originally built by MySQL AB and currently owned by Oracle Corporation.
It stores data in tables that are grouped into a database, uses Structured Query Language
(SQL) to access data and such commands as ‘SELECT’, ‘UPDATE’, ‘INSERT’ and ‘DELETE’ to
manage it. Related information can be stored in different tables, but the usage of JOIN
operation allows you to correlate it, perform queries across various tables and minimize the
chance of data duplication.
MySQL is compatible with nearly all operating systems, namely Windows, Linux, Unix, Apple,
FreeBSD and many others. It supports various storage engines, like InnoDB (it is the default
one), Federated, MyISAM, Memory, CSV, Archive, Blackhole and Merge.
MySQL is used by companies including Airbnb, Uber Technologies, Netflix, Dropbox, Twitter,
Pinterest, Slack, Shopify, LinkedIn, Udemy.
Page no. 5 PRACTICAL NO. 1
09/01/2019

MongoDB - MongoDB (a noSql language) is a popular open-source document-oriented


database developed by 10gen, later called the MongoDB Inc. In this case, documents are
created and stored in BSON files, Binary JSON (JavaScript Object Notation) format, so all JS
types of data are supported. That being the case, MongoDB is often applied for Node.js
projects. Besides of that, JSON enables transferring data between servers and web apps
with the use of the human-readable format. It is also a better option, when it comes to
storage capacity and speed, as it offers greater efficiency and reliability.
One of the top benefits offered by MongoDB is the use of dynamic schemas that eliminates
the need to pre-define the structure, like fields or value types. Such model allows
hierarchical relationships representation, array storage, and ability to change the records
structure by simply adding or deleting fields. This NoSQL solution comes with embedding,
auto-sharding, and on-board replication for better scalability and high availability.
MongoDB is used by companies including Uber Technologies, Lyft, Rainist, Codecademy,
Hootsuite, MIT, Trello.

Oracle - Oracle Database is an RDBMS. An RDBMS that implements object-oriented


features such as user-defined types, inheritance, and polymorphism is called an object-
relational database management system (ORDBMS). Oracle Database has extended the
relational model to an object-relational model, making it possible to store complex business
models in a relational database.
Oracle is used by companies including Netflix, MIT, Ebay, BodyBuilding.com, jMonkeyEngine.

Amazon Aurora - Amazon Aurora is a MySQL-compatible, relational database engine


that combines the speed and availability of high-end commercial databases with the
simplicity and cost-effectiveness of open source databases. Amazon Aurora provides up to
five times better performance than MySQL at a price point one tenth that of a commercial
database while delivering similar performance and availability.
Amazon Aurora is used by compaines including Medium, GoGuardian, Akoova, Zumba,
Entelo, SoFi.
Page no. 6 PRACTICAL NO. 1
09/01/2019

Postgresql - PostgreSQL is a general purpose and object-relational database


management system. It was designed to run on UNIX-like platforms. However, PostgreSQL
was then also designed to be portable so that it could run on various platforms such as Mac
OS X, Solaris, and Windows. PostgreSQL is free and open source software. Its source code is
available under PostgreSQL license, a liberal open source license. You are free to use, modify
and distribute PostgreSQL in any form. PostgreSQL requires very minimum maintained
efforts because of its stability. Therefore, if you develop applications based on PostgreSQL,
the total cost of ownership is low in comparison with other database management systems.
Postgresql is used by compaines including ViaSat Inc, Cloudera Inc, FiscalNote Inc, CIGNEX
Datamatics Corporation, Udacity Inc.

Why oracle database is the best DBMS solution ?


When it comes to database management software, Oracle database is the top pick for most
of the organizations. It has some advanced features and capabilities which makes it popular
in DBMS world. Oracle was designed towards business and corporations. Within the
software market, it has the leading role as the perfect database solution. In other words,
Oracle database has some unique features that made it the best DBMS solution. Let’s see,
why Oracle is the best among all other database management systems.

Functionality: Oracle provides the combination of high-level security and integrated


business solutions. As it fits perfectly with the needs of businesses and corporations, they
are the most common users of Oracle database. Today, Oracle dominates the companies
and banking industries. Top ten banks use Oracle to access and manage their data. Oracle is
the best solution for corporations who have an enormous amount of data to handle and
access.

Portability: Oracle is the best choice as a portable DBMS solution. It supports more than
100 hardware platforms and 20 networking protocols. You can also develop a completely
featured Oracle application on any operating system without even knowing the underlying
layers of that system. Oracle has the most user-friendly and easy to use features which is
usable to any platform. Meteorically, this features makes Oracle the best portable database
solution.

Page no. 7 PRACTICAL NO. 1


09/01/2019

Quick recovery: If your system fails due to any technical issues, Oracle offers the quickest
online backup and recovery features. So, you can undo or recover the existing database
from the server, when your system is back online. You can also set a point-in-time recovery.
Because Oracle supports continues backup and recovery from a pre-defined server storage.

Speed and Performance: When you are managing a large database, speed and
performance is everything for you. It doesn’t matter, how big is the database, Oracle
provides the best speed to access the database. With the highest level of performance. The
performance of Oracle is not only “raw” but includes the locking and transaction controls.
Which also ensures the high-level security of your database system.

Multiple Database Support: Oracle uses two-phase commit protocol to manage


multiple databases within same transactions. With multiple database support, you can
move data from nodes to nodes from where it was stored. As well as mirroring the data
within the same network. It is one of Oracle’s unique features that allows you to update
more than one data with a single request.
Page no. 8 PRACTICAL NO. 2
16/01/2019

AIM – To understand what SQL is all about.


PROBLEM STATEMENT – What is SQL ? List down the characteristics, advantages,
and disadvantages.

SQL – Structured Qurey Language


1. Introduction
SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to
communicate with a database. According to ANSI (American National Standards Institute), it
is the standard language for relational database management systems. SQL statements are
used to perform tasks such as update data on a database, or retrieve data from a database.
Some common relational database management systems that use SQL are: Oracle, Sybase,
Microsoft SQL Server, Access, Ingres, etc. Although most database systems use SQL, most of
them also have their own additional proprietary extensions that are usually only used on
their system. However, the standard SQL commands such as "Select", "Insert", "Update",
"Delete", "Create", and "Drop" can be used to accomplish almost everything that one needs
to do with a database.

2. Basic Commands
ALTER TABLE
ALTER TABLE table_name
ADD column_name datatype;

ALTER TABLE lets you add columns to a table in a database.

AND
SELECT column_name(s)
FROM table_name
WHERE column_1 = value_1
AND column_2 = value_2;
AND is an operator that combines two conditions. Both conditions must be true for
the row to be included in the result set.

Page no. 9 PRACTICAL NO. 2


16/01/2019

AS
SELECT column_name AS 'Alias'
FROM table_name;

AS is a keyword in SQL that allows you to rename a column or table using an alias.
AVG()
SELECT AVG(column_name)
FROM table_name;

AVG() is an aggregate function that returns the average value for a numeric column.

BETWEEN
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value_1 AND value_2;

The BETWEEN operator is used to filter the result set within a certain range. The values
can be numbers, text or dates.

CASE
SELECT column_name,
CASE
WHEN condition THEN 'Result_1'
WHEN condition THEN 'Result_2'
ELSE 'Result_3'
END
FROM table_name;

CASE statements are used to create different outputs (usually in the SELECT statement).
It is SQL's way of handling if-then logic.

COUNT()
SELECT COUNT(column_name)
FROM table_name;

is a function that takes the name of a column as an argument and counts the
COUNT()
number of rows where the column is not NULL.
CREATE TABLE
CREATE TABLE table_name (
column_1 datatype,
column_2 datatype, );

Page no. 10 PRACTICAL NO. 2


16/01/2019

CREATE TABLE creates a new table in the database. It allows you to specify the name of
the table and the name of each column in the table.

DELETE
DELETE FROM table_name
WHERE some_column = some_value;

DELETE statements are used to remove rows from a table.

GROUP BY
SELECT column_name, COUNT(*)
FROM table_name
GROUP BY column_name;

GROUP BY is a clause in SQL that is only used with aggregate functions. It is used in
collaboration with the SELECT statement to arrange identical data into groups.

HAVING
SELECT column_name, COUNT(*)
FROM table_name
GROUP BY column_name
HAVING COUNT(*) > value;

HAVINGwas added to SQL because the WHERE keyword could not be used with
aggregate functions.

INNER JOIN
SELECT column_name(s)
FROM table_1
JOIN table_2
ON table_1.column_name = table_2.column_name;

An inner join will combine rows from different tables if the join condition is true.
INSERT
INSERT INTO table_name (column_1, column_2, column_3)
VALUES (value_1, 'value_2', value_3);

INSERT statements are used to add a new row to a table.

Page no. 11 PRACTICAL NO. 2


16/01/2019

IS NULL / IS NOT NULL


SELECT column_name(s)
FROM table_name
WHERE column_name IS NULL;

IS NULL and IS NOT NULL are operators used with the WHERE clause to test for empty
values.

LIKE
SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern;

LIKE is a special operator used with the WHERE clause to search for a specific pattern in
a column.

LIMIT
SELECT column_name(s)
FROM table_name
LIMIT number;

LIMIT is a clause that lets you specify the maximum number of rows the result set will
have.

MAX()
SELECT MAX(column_name)
FROM table_name;

MAX() is a function that takes the name of a column as an argument and returns the
largest value in that column.

MIN()
SELECT MIN(column_name)
FROM table_name;
MIN() is a function that takes the name of a column as an argument and returns the
smallest value in that column.

Page no. 12 PRACTICAL NO. 2


16/01/2019

OR
SELECT column_name
FROM table_name
WHERE column_name = value_1
OR column_name = value_2;

OR is an operator that filters the result set to only include rows where either condition
is true.

ORDER BY
SELECT column_name
FROM table_name
ORDER BY column_name ASC | DESC;

ORDER BYis a clause that indicates you want to sort the result set by a particular
column either alphabetically or numerically.

OUTER JOIN
SELECT column_name(s)
FROM table_1
LEFT JOIN table_2
ON table_1.column_name = table_2.column_name;

An outer join will combine rows from different tables even if the join condition is not
met. Every row in the left table is returned in the result set, and if the join condition is
not met, then NULL values are used to fill in the columns from the right table.
ROUND()
SELECT ROUND(column_name, integer)
FROM table_name;

ROUND() is a function that takes a column name and an integer as an argument. It


rounds the values in the column to the number of decimal places specified by the
integer.
SELECT
SELECT column_name
FROM table_name;

SELECTstatements are used to fetch data from a database. Every query will begin with
SELECT.

Page no. 13 PRACTICAL NO. 2


16/01/2019

SELECT DISTINCT
SELECT DISTINCT column_name
FROM table_name;

SELECT DISTINCT specifies that the statement is going to be a query that returns
unique values in the specified column(s).

SUM
SELECT SUM(column_name)
FROM table_name;

SUM()is a function that takes the name of a column as an argument and returns the
sum of all the values in that column.

UPDATE
UPDATE table_name
SET some_column = some_value
WHERE some_column = some_value;

UPDATE statements allow you to edit rows in a table.

WHERE
SELECT column_name(s)
FROM table_name
WHERE column_name operator value;

WHEREis a clause that indicates you want to filter the result set to include only rows
where the following condition is true.
WITH
WITH temporary_name AS (
SELECT *
FROM table_name)
SELECT *
FROM temporary_name
WHERE column_name operator value;

WITH clause lets you store the result of a query in a temporary table using an alias.
You can also define multiple temporary tables using a comma and with one instance
of the WITH keyword.

Page no. 14 PRACTICAL NO. 2


16/01/2019

3. Characteristics of SQL

1. SQL is an ANSI and ISO standard computer language for creating and manipulating
databases.
2. SQL allows the user to create, update, delete, and retrieve data from a database.
3. SQL is very simple and easy to learn.
4. SQL works with database programs like DB2, Oracle, MS Access, Sybase, MS SQL Sever
etc.

4. Advantages of SQL
1. High Speed: SQL Queries can be used to retrieve large amounts of records from a
database quickly and efficiently.
2. Well Defined Standards Exist: SQL databases use long-established standard, which is
being adopted by ANSI & ISO. Non-SQL databases do not adhere to any clear standard.
3. No Coding Required: Using standard SQL it is easier to manage database systems without
having to write substantial amount of code.
4. Emergence of ORDBMS: Previously SQL databases were synonymous with relational
database. With the emergence of Object Oriented DBMS, object storage capabilities are
extended to relational databases.

5. Disadvantages of SQL
1. Difficulty in Interfacing: Interfacing an SQL database is more complex than adding a few
lines of code.
2. More Features Implemented in Proprietary way: Although SQL databases conform to
ANSI & ISO standards, some databases go for proprietary extensions to standard SQL to
ensure vendor lock-in.
Page no. 15 PRACTICAL NO. 2
16/01/2019

6. SQL Division

1.DDL (Data Definition Language)

These statements are used to create tables and databases and define field properties
or table properties. Examples of commands that fall in this category are
CREATE,ALTER and DROP statements

2. DML (Data Manipulation Language)


The statements that falls under this category are used to update data or add or
remove data from tables. UPDATE, DELETE and

INSERT commands fall under this category.

3. DCL (Data Control Language)


It is used to control who access the data. The commands that come under this
category are GRANT and REVOKE

4. TCL (Transaction Control Language)


This language is used to commit data and restore data. COMMIT and ROLLBACK
falls under this category.

5. DQL (Data Query Language)


This is to retrieve data from sql server. SELECT statement falls in this category.
Page no. 16 PRACTICAL NO. 3
23/01/2019

Objective – To learn about entities and entity relationships using ER diagrams.


Problem Statement – Draw 2 ER diagrams.
1. School Management System
2. Hotel Management System

Description –
Entity - An entity is a real-world item or concept that exists on its own.
Attribute - Each entity has attributes, or particular properties that describe the entity.
Entity relationship model / Entity-relationship (ER) diagram – It is a graphical
representation of entities and their relationships to each other, typically used in computing
in regard to the organization of data within databases or information systems. An entity is a
piece of data-an object or concept about which data is stored.

Code/Algorithm – None Required. ER diagrams made using ERDplus.com


Output –

School Management system


Page no. 17 PRACTICAL NO. 3
23/01/2019

Hotel Management System

Learnings – Leant about entities, attributes, entity relationships. Got to know how tables
can be connected inside a database.

S-ar putea să vă placă și