0% found this document useful (0 votes)
30 views36 pages

Database Management System: Dr. Dilip Kumar Choubey Dkchoubey - Cse@iiitbh - Ac.in

Uploaded by

C50 Vansh Mishra
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)
30 views36 pages

Database Management System: Dr. Dilip Kumar Choubey Dkchoubey - Cse@iiitbh - Ac.in

Uploaded by

C50 Vansh Mishra
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/ 36

Database Management System

Dr. Dilip Kumar Choubey


[email protected]
Database Design
Entities Relationship Model
 It is defined to represent the relationship between
different stakeholders.
 Here Student is an entity.
 ID, Name, age and address are attributes.
 Address is also an entities.
Entities and Attribute
 Entity represents the Relation / Table.
 Examples: Student_details, Marks_details, fee_details,
etc.
 Attribute:
 Entity has attributes
 The particular properties that describe the entity
 Property that describe the entity
 Examples:
 Employee name, age, number, address, etc,.
Entity type
Attribute types
 Composite vs simple attributes
 Single valued vs multi valued attributes
 Stored vs derived attributes
 Null attributes
 Complex attribute
Composite Attribute
 Composite attribute can be divided into smaller
subparts, which represent more basic attributes with
independent meaning
 Example: Address(street address(number, name, door
no.), city, state,zip),
Qualification( degree name, year, college name)
Single valued vs multi valued attributes
 Simple attribute
 Attributes are indivisible or atomic values
 Example: phone number
 Single value attribute
 Single value for a particular attribute
 Example: age, place of birth
 Multi Value attribute
 If multiple values are there for a particular attribute.
 Example: degree, course_enrolled, email id.
 Stored vs derived attributes
 Two ( or more) attributes are related
 Example:
 age and DoB attributes of a person.
 Basic salary and total salary.

 Null Value Attribute


 Example: college degree (if person did not complete the
degree, then the value will be null)

 Complex Attribute
 Composite and multi valued attributes are nested.
 Example: {Phone address( phone(area code, phno))}
Key Attribute

 An attribute or collection of attributes whose values


uniquely identify an entity in the entity set
 Example: reg_no, emp_id, hotel_id
Entities set and Keys
• Key is an attribute or collection of attributes that uniquely identifies an
entity among entity set.
• For example, the roll_number of a student makes him/her identifiable
among students. There are mainly three types of keys:
• Super Key − A set of attributes (one or more) that collectively identifies
an entity in an entity set.
• Candidate Key − A minimal super key is called a candidate key. An
entity set may have more than one candidate key.
• Primary Key − A primary key is one of the candidate keys chosen by the
database designer to uniquely identify the entity set.
ER-Diagram Symbol and meaning
 Entities or Strong entities Weak entities
• (having key attribute) (No key attribute)

 Attribute Multi-valued attribute Key Attribute


Key

 Derived attribute Composite attribute


Age
Entity- Relationship Model
ER-Diagram
 Design an ER schema diagram of Library management
system.
 Design an ER schema diagram of student information
management system.
Relationship between entities
ER Diagram: Relationship
The Relationship may:

• One to One

Teach n
• One to Many Professor 1
es
Subjects

• Many to Many

• Many to One

18
Degree of Relationship
1. Unary Relationship
• Relationship among one entity set.

2. Binary Relationship
• Relationship among two entities set.

3. Ternary Relationship
• Relationship among 3 entities set.
Profess Teac
Courses
4. N-ary Relationship : or hes
• Relationship between n number of entities set.
Semeste
r
19
20
21
Initial Conceptual Design
• Design the initial conceptual design of Library
management system.
Entities Attributes
Student Student_id, Student_name, Student_email, Student_mob,
Student_course, Student_address.
Books Book_id, Book_name, Book_authors, Book_publisher,
Book_pub_date, Book_type, Book_pirce, Book_description.
Issue Issue_id, Issue_stud_id, Issue_date, Issue_renewl, Issue_expire,
Issue_description.
Librarian Librarian_id, Librarian_name, Librarian_email, Librarian_mob,
Librarian_address
Member Member_id, Member_name, Member_email, Member_mob,
Member_address, Member_type
22
Relationship between entities
• Binary Relationship

23
Relationship Degree, Roles and
Recursive Relationship
• Ternary Relationship

24
Recursive Relationship

25
Relationship Types of Degree
higher than two

26
27
28
DBMS Languages
• Data Definition Language (DDL)
• CREATE, ALTER, DROP, RENAME and TRUNCATE
• Data Manipulation Language (DML)
• INSERT, UPDATE and DELETE
• Data Transaction Language (DTL)
• Commit, Rollback, and Save Point
• Data Control Language(DCL)
• Grant, Revoke

29
Data Definition Language (DDL)
• Used by the DBA and database designers to specify the conceptual schema
of a database.
• In many DBMSs, the DDL is also used to define internal and external
schemas (views).
• In some DBMSs, separate storage definition language (SDL) and view
definition language (VDL) are used to define internal and external schemas.
• SDL is typically realized via DBMS commands provided to the DBA and
database designers
Taking an example CREATE TABLE f (x int, y varchar(25));.
SDL: the storage for the row int, varchar(25).
DDL: the schema: f(x,y) a relational tuple with two slots.
VDL: the "view" into it, which is just a relationship by the
same name as the table.

30
Data Manipulation Language
(DML)
• High-Level or Non-procedural Languages:
• These include the relational language SQL
• May be used in a standalone way or may be embedded in a
programming language.
• This is called set a time.
• Low Level or Procedural Languages:
• These must be embedded in a programming language
• It is also called record at a time.
• Retrieve data one record-at-a-time;
• Constructs such as looping are needed to retrieve multiple
records, along with positioning pointers.

31
• Data Transaction Language (DTL)
• It is also called TCL (Transaction Control Language)
• Write the data in database.
• Undo and redo the transactions.
• Data Control Language(DCL)
• used to sanction the rights to the users to use the
other user’s database objects.

32
DBMS Interfaces
• Stand-alone query language interfaces
• Example: Entering SQL queries at the DBMS interactive
SQL interface (e.g. SQL*Plus in ORACLE)
• Programmer interfaces for embedding DML in
programming languages
• User-friendly interfaces
• Menu-based, forms-based, graphics-based, etc.

33
DBMS Programming Language
Interfaces
• Programmer interfaces for embedding DML in a
programming languages:
• Embedded Approach: e.g embedded SQL (for C, C++,
etc.), SQLJ (for Java)
• Procedure Call Approach: e.g. JDBC for Java, ODBC for
other programming languages
• Database Programming Language Approach: e.g.
ORACLE has PL/SQL, a programming language based on
SQL; language incorporates SQL and its data types as
integral components

34
User-Friendly DBMS Interfaces
• Menu-based, popular for browsing on the web
• Forms-based, designed for naive users
• Graphics-based
• (Point and Click, Drag and Drop, etc.)
• Natural language: requests in written English
• Combinations of the above:
• For example, both menus and forms used extensively in
Web database interfaces

35
Database System Utilities
• Loading the data files into the database.
• From text file, sequential file, data files.
• Backup the database periodically on other storage
media.
• Database Storage:
• Reorganize the database file structure.
• Performance Monitoring
• Other utilities such as :
• Sorting , data compression, user monitoring, etc.

36

You might also like