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

Dbms

Uploaded by

mname3212
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)
15 views

Dbms

Uploaded by

mname3212
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/ 24

1

DATABASE MANAGEMENT SYSTEM LAB


BY

Name : M.Ajay Srinivas

Id Number : N210142

Seciton : CSE-03

Roll Number : 09
2

08/07/24

LAB-1

Task-1 :
Write the applications of Database management system ?

1. Banking and Finance :


• Customer information management: Store and manage customer data.
• Transaction management: Handle and process financial transactions.
• Risk management: Analyze and manage financial risks.

2. Airlines :
• Flight scheduling: Manage flight schedules and timings.
• Reservations: Handle ticket reservations and cancellations.
• Crew scheduling: Assign and manage crew schedules.

3. Education :
• Student information systems: Manage student records, grades, and
enrollment.
• Library management: Track book inventory and lending.
• Learning management systems: Handle course materials and student
progress.

4. Telecommunications :
• Call records: Store call detail records (CDRs).
• Billing: Handle billing and invoicing for customers.
• Network management: Monitor and manage the network infrastructure.
5.Healthcare :
• Patient records: Store and manage patient information.
• Appointment scheduling: Manage doctor and patient schedules.
• Billing and insurance: Handle billing and insurance claims.
3

6. Government :
• Public records: Store and manage records such as birth and death
certificates.
• Tax administration: Manage tax records and transactions.
• E-governance: Facilitate online services for citizens.

7. Manufacturing :
• Supply chain management: Track raw materials and products.
• Production planning: Manage production schedules and processes.
• Quality control: Monitor and maintain product quality.

8. E-Commerce :
• Product catalogs: Manage product listings and inventory.
• Order processing: Handle orders and track shipments.
• Customer management: Store customer information and purchase
history.

9. Hospitality :
• Reservation systems: Manage room bookings and reservations.
• Guest management: Store guest information and preferences.
• Billing: Handle billing and invoicing for guests.

Task-2 :
Identify the names of existing Databases and write which
companies are using those Databases ?

Relational Databases
1. Oracle Database
• Companies: Amazon, eBay, LinkedIn, Cisco, and Airbnb.
2. Microsoft SQL Server
• Companies: Microsoft, Dell, Bank of America, Citibank, and
Starbucks.An entity is like a person, place, thing, or concept that
4

you want to store information about in a database. Think of an


entity as a table in a database, where each table holds data about
one type of thing.
3. MySQL
• Companies: Facebook, Twitter, YouTube, PayPal, and Netflix.
4. PostgreSQL
• Companies: Apple, Instagram, Spotify, Reddit, and TripAdvisor.
5. MariaDB
• Companies: Google, Wikipedia, Mozilla, and Deutsche Bank.

NoSQL Databases
1. MongoDB
• Companies: Adobe, eBay, EA, Verizon, and SEGA.
2. Cassandra
• Companies: Facebook, Netflix, Spotify, Instagram, and Reddit.
3. Couchbase
• Companies: LinkedIn, PayPal, Amadeus, Marriott, and Tesco.
4. Redis
• Companies: Twitter, GitHub, Snapchat, StackOverflow, and
Craigslist.
5. Amazon DynamoDB
• Companies: Amazon, Samsung, Lyft, Dropbox, and Capital One.

Task-3 :
Purpose of these existing Databases ? (Why is that Database
developed) ?

Relational Databases :
1. Oracle Database
Purpose : Designed for enterprise-level applications requiring high
performance, reliability, and complex transaction processing. Used
extensively in financial services, government, and large-scale operations.
2. Microsoft SQL server
5

Purpose : A comprehensive, scalable, and secure database platform for


enterprise applications, data warehousing, and web applications. Known
for its integration with other Microsoft products.
3. MySQL
Purpose : An open-source relational database known for its reliability, ease
of use, and performance. Commonly used for web applications,
particularly as part of the LAMP stack (Linux, Apache, MySQL,
PHP/Python/Perl).
4. Postgre SQL
Purpose : An open-source, highly extensible and standards-compliant
relational database. It is known for its advanced features like support for
complex queries, foreign keys, triggers, and views.
5. MariaDB
Purpose : A fork of MySQL developed to maintain open-source freedom.
It aims to improve the performance, reliability, and features while
maintaining compatibility with MySQL.

NoSQL Databases :
1. MongoDB
Purpose : A document-oriented database designed for high availability,
high scalability, and agile development. Used for storing JSON-like
documents, making it a popular choice for web applications and real-time
analytics.
2. Cassandra
Purpose : A distributed NoSQL database designed for handling large
amounts of data across many commodity servers, providing high
availability with no single point of failure. Suitable for big data
applications.
3. CouchBase
Purpose : A NoSQL database that combines the best of both document and
key-value stores. Designed for interactive applications that require
consistent high performance, availability, and scalability.
4. Redis
6

Purpose: An in-memory data structure store used as a database, cache, and


message broker. It supports data structures such as strings, hashes, lists,
sets, and more, providing extremely fast operations.
5. Amazon DynamoDB
Purpose: A fully managed key-value and document database that delivers
single-digit millisecond performance at any scale. Ideal for applications
requiring consistent, low-latency data access.

Task-4 :
MySQL , Oracle , MongoDB , Sybase – Developed by ,Purpose
of the database , its functionalities ?
MySQL
• Developed by : MySQL AB (now owned by Oracle Corporation).
• Functionalities :
◦ Data Storage: Stores data in tables using rows and columns.
◦ SQL Support: Executes SQL queries to retrieve and manipulate data.
◦ Indexes: Improves query performance by creating indexes on columns.
◦ Transactions: Supports transactions to ensure data integrity.
◦ Replication : Allows data to be copied from one database server to
another for backup and high avaliability.
Oracle
• Developed by : Oracle Corporation.
• Functionalities :
◦ Data Storage: Advanced storage options including tables, indexes, and
partitions.
◦ SQL and PL/SQL: Executes SQL and PL/SQL (procedural language)
queries.
◦ Backup and Recovery: Tools for backing up data and recovering it in
case of failures.
7

◦ High Availability: Features like Real Application Clusters (RAC) for


load balancing and failover.
◦ Security: Advanced security features like user authentication,
encryption, and auditing.

MongoDB
• Developed by : MongoDB, Inc.
• Functionalities :
◦ Document Storage: Stores data in JSON-like documents, which can
have varying structures.
◦ Dynamic Schema: No fixed schema, allowing flexible data models.
◦ Indexing: Creates indexes on documents to improve query
performance.
◦ Sharding: Distributes data across multiple servers for scalability.
◦ Replication: Ensures high availability by replicating data across
different servers.
Sybase (SAP ASE - Adaptive Server Enterprise)
• Developed by: Sybase, Inc. (now owned by SAP SE)
• Functionalities:
◦ Data Storage: Organizes data in tables with rows and columns.
◦ SQL Support: Executes standard SQL queries for data operations.
◦ Transactions: Supports ACID-compliant transactions for data integrity.
◦ Backup and Recovery: Provides tools for data backup and recovery.
◦ High Availability: Features like data mirroring and failover clustering
for reliability.

Task-5 :
Installation of MySQL -write down the steps in the document ?
Step-1 : Update the Package Index
8

• Run the following commands :


sudo apt update

Step-2 : Install MySQL Server


• Run the following commands :
sudo apt install mysql-server

Step-3 : Secure your MySQL Server


• Run the following commands :
sudo mysql_secure_installation

• Setup your root password (low or medium or strong ) and configure other
security options.
Step-4 : Install MySQL Workbench
• Run the following commands :
sudo apt install mysql-workbench

Step-5 : Starting MySQL Service


• Run the following commands :
sudo systemctl start mysql

• To check if MySQL is running, use :


sudo systemctl status mysql

• This will show you the current status of the MySQL Servcice.
Step-6 : Access MySQL
• You can access MySQL by running :
sudo mysql -u root -p

• Enter your root password (in Step-3) when prompted.


Step-7 : Lauch MySQL Workbench
• You can start MySQL Workbench from your applications menu.
• Click on the MySQL connections and enter your root password.
9

Task-6 :
Open MySQL application and observe the elements in it ?
MySQL Workbench :
1) Open MySQL Workbench :
Launch MySQL Workbech form your applications menu.
2) Connect to MySQL Server :
Click on the connection you want to use or create a new connection by
entering the required details (hostname,port,username and password).
3) Show Databases :
In the left-hand sidebar, you will see a list of databases under the
“SCHEMAS” tab.
4) Select a Database :
Click on the database name to expand it and see the tables it contains.
5) View Tables :
Click on the table name to view its columns and indexes.
6) Describe a Table :
Right-click on a table and select “Table Inspector” to see detalied
information about the table structure.
7) View Table Data :
Right-click on a table and select “ Select Rows-Limit 1000 ” to see the
data within the table.
10

LAB – 2
Task-1 :
Define Entity and Relationship in Databases and write about
them in detail with examples ?
Entity :
An entity is like a person, place, thing, or concept that you want to store
information about in a database. Think of an entity as a table in a database, where
each table holds data about one type of thing.
Examples :
• Person: Employee, Student, Patient
• Place: Store, Building
• Object: Machine, product, and Car
• Event: Sale, Registration, Renewal
• Concept: Account, Course
Entity Set :
An entity set is a set of entities of the same type that share the same properties or
attributes.An entity set is represented in an E-R diagram by a Rectangle, which is
divided into two parts. The first part, which in this text is shaded blue, contains the
name of the entity set. The second part contains the names of all the attributes of
the entity set.
Example :
• The set of all people who are instructors at a University can be defined as
the entity set Instructor.
• The set of all Students at a University can be defined as the entity set
Student.
Types of Entities :
1. Strong Entity (or Independent Entity) :
• A strong entity is an entity that can exist independently of other
entities. It has a primary key that uniquely identifies each record.
11

• Example:
◦ Customer: A customer can exist independently in the system.
2. Weak Entity
• A weak entity is an entity that cannot exist without being associated
with another entity (known as the owner or strong entity). It doesn't
have a primary key on its own but uses a foreign key in combination
with its own attributes to create a unique identifier.
• Example:
▪ OrderItem: An order item exists only as part of an order.
Relationship :
• Relationship is nothing but an association among two or more
entities.Entities take part in relationships. We can often identify
relationships with verbs or verb phrases.In ER diagram, the relationship
type is represented by a diamond and connecting the entities with lines.
• Examples :
• A student attends a lecture.

Student Attends Lecture

Relationship Set :
• A set of relationships of the same type is known as a relationship set.
• Example : The Students table stores information about students.The
Courses table stores information about courses.The Enrollments table
represents the relationship set where each row indicates that a student is
enrolled in a particular course.
Degree of a Relationship Set :
1) Unary (or Recursive) Relationship:
• Involves a single entity set.
• Example: An employee is a manager of another employee.
2) Binary Relationship:
12

• Involves two entity sets.


• Most common type of relationship.
• Example: A customer places an order.
3) Ternary Relationship:
• Involves three entity sets.
• Example: A supplier supplies a product to a project.
4) N-ary Relationship:
• Involves more than three entity sets.
• Example: In a research context, a researcher is assigned to a project,
which is sponsored by a funding agency.
Mapping Constraints :

For a Binary Relationship set R over two entities A and B there are four possible
Mapping Cardinalities :
1. One-to-One: Each record in one table is related to one record in another
table.
Example: A person and their passport.
2. One-to-Many: One record in a table can be related to many records in
another table.
Example: A customer can place many orders.
3. Many-to-One : Many records in a table are related to one record in
another table.
13

Example : Books and Authors.Many books are written by one Author.


4. Many-to-Many: Records in one table can be related to many records in
another table and vice versa.
Example: Students and courses. A student can enroll in many courses, and
a course can have many students.
Participation Constraints :
Types of Participation Constraints :
1) Total Participation:
• Every instance of an entity must participate in the relationship.
• Represented by a double line in ER diagrams.
• Example: In a university database, every student must have an
enrollment record, indicating total participation of the Students entity
in the Enrollments relationship.
2) Partial Participation:
• Some instances of an entity may participate in the relationship, but not
necessarily all.
• Represented by a single line in ER diagrams.
• Example: In a company database, not all employees need to manage a
project, indicating partial participation of the Employees entity in the
Manages relationship.
Attributes
• In a database management system (DBMS), attributes are the properties or
characteristics of an entity set that describe the entity. Each attribute has a
name and a data type. Understanding attributes and their types is
fundamental to designing a database schema.
Types of Attributes
1) Simple Attribute:
◦ Cannot be divided into smaller parts.
◦ Example: (For a Student Entity) StudentID, Age.
2) Composite Attribute:
14

◦ Can be divided into smaller subparts, which represent more basic


attributes with independent meanings.
◦ Example: Address can be divided into Street, City, State, ZIP.
3) Single-Valued Attribute:
◦ Holds a single value for each entity.
◦ Example: DateOfBirth.
4) Multi-Valued Attribute:
◦ Can hold multiple values for each entity.
◦ Example: PhoneNumbers.
5) Derived Attribute:
◦ Can be derived from other attributes.
◦ Example: Age can be derived from DateOfBirth.
6) Key Attribute:
◦ An attribute that uniquely identifies an entity in an entity set.
◦ Example: StudentID.
Entity-Relationship Diagram Symbols :

Component Symbol
Entity

Attribute

Relationship

Weak Entity

Multivalued Attribute

Derived Attribute
15

Weak Relationship

Connection /Partial Participation

Total Participation

Task-2
List the tools to draw ER diagrams in both Offline and Online :
Offline Tools
1) Microsoft Visio
◦ A widely used diagramming tool that includes templates for ER
diagrams.
◦ Features: Drag-and-drop interface, extensive library of shapes, data
linking.
◦ Platform: Windows.
2) Lucidchart Desktop App
◦ Although primarily an online tool, it offers offline functionality.
◦ Features: Intuitive interface, templates, collaboration features.
◦ Platform: Windows, macOS.
3) draw.io Desktop
◦ Free, open-source diagramming tool with offline capabilities.
◦ Features: Simple interface, templates, no internet connection required.
◦ Platform: Windows, macOS, Linux.
4) ER/Studio Data Architect
◦ A professional-grade data modeling tool that supports ER diagrams.
◦ Features: Advanced data modeling, database integration, reverse
engineering.
◦ Platform: Windows.
5) Oracle SQL Developer Data Modeler
16

◦ A free data modeling tool from Oracle that supports ER diagrams.


◦ Features: Supports various database systems, reverse engineering,
forward engineering.
◦ Platform: Windows, macOS, Linux.
Online Tools
1) Lucidchart
• A popular online diagramming tool with robust ER diagram
capabilities.
• Features: Real-time collaboration, extensive template library,
integration with other tools.
2) draw.io (diagrams.net)
• A free online diagramming tool with strong ER diagram support.
• Features: No registration required, integrates with cloud storage
services.
3) Gliffy
• An online diagramming tool that includes templates for ER diagrams.
• Features: Easy-to-use interface, real-time collaboration, integrations
with other apps.
4) Creately
• An online diagramming and collaboration tool with ER diagram
templates.
• Features: Real-time collaboration, customizable templates, smart
shapes.
17

Lab – 3
Draw ER diagrams to the following streams :

Identify the attributes and keys (Primary key and Foreign key)
in the Databases ?

(1) University Database :


Relational Tables :
◦ Student(Student ID(PK), Department ID(FK), First Name, Last Name,
Gender, Phone Number, Date of Birth)
◦ Enrolls(Student ID(PK, FK), Course ID(PK, FK)
◦ Courses(Course ID(PK), Department ID(FK), Faculty ID(FK), Credits,
Name)
◦ Department(Department ID(PK), Name)
◦ Faculty(Faculty ID(PK), Department ID(FK), Name, Phone Number,
Salary)
E-R Diagram:
18

Schema Diagram :
19

(2) Software Company :


Relational Tables :
◦ Employee(Employee ID(PK), Company ID(FK),Project ID(FK),
Name, Date of Birth, Salary)
◦ Company(Company ID(PK), Name, Location)
◦ Projects(Project ID(PK), Project Name, Budget)
◦ Skill Set(Employee ID(PK, FK), Skill Set)

E-R Diagram :
20

Schema Diagram :
21

(3) Airline Reservation System :


Relational Tables :
◦ Passenger(Passenger ID(PK), Flight Number(PK), Name, Gender,
Date of Birth, TicketPrice)
◦ Airport(Airport Code(PK), Name, Location)
◦ Flights R Airplanes (Flight Number(PK), Airport Code(FK), Airplane
ID(PK), Destination, Departure, Num. Of Seats, Owner Name)

E-R Diagram :
22

Schema Diagram :
23

(4) Hospital Database :


Relational Tables :
◦ Hospital(Hospital ID(PK), Hospital name, Location, Patient Capacity)
◦ Hospital R Doc(Hospital ID(PK, FK), Patient ID(PK, FK))
◦ Doctors(Doctor ID(PK), Name, Salary)
◦ Qualifications(Doctor ID(PK, FK), Qualifications)
◦ Patient R Med(Patient ID(PK), Hospital ID(FK), Record ID(PK),
Patient Name, Diagnosis, Age, Test Results, Medicine)

E-R Diagram :
24

Schema Diagram :

You might also like