Database Management System: Dr. Dilip Kumar Choubey Dkchoubey - Cse@iiitbh - Ac.in
Database Management System: Dr. Dilip Kumar Choubey Dkchoubey - Cse@iiitbh - Ac.in
Complex Attribute
Composite and multi valued attributes are nested.
Example: {Phone address( phone(area code, phno))}
Key Attribute
• 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