RECORD BASED DATA MODEL – RELATIONAL DATA MODEL
[email protected]
S34AL0U9B8
This file is meant for personal use
DBMS by
[email protected] only. 14
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.
RELATIONAL DATA MODELS BASICS
Data is viewed as existing in two dimensional tables
known as relations
A relation (table) consists of unique attributes
(columns) and tuples (rows)
Sometimes the value to be inserted into a particular
cell may be unknown, or it may have no value. This is
[email protected] represented by a NULL.
S34AL0U9B8
Relational Database: Any database whose logical
organization is based on relational data model
RDBMS: A DBMS that manages the relational
database
DBMS
This file is meant for personal use by [email protected] only. 15
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.
RELATIONAL MODELS BASICS
Relation or Relation Table: Set of
tuples and unique attributes Attribute: Header of a column in a
relation
STUDENT
[email protected]S34AL0U9B8 ID Name Email DOB Address GPA
5001 Suman
[email protected] 12/01/1994 #24, 2nd floor, Trupti Bldg, 3.8
Shah DVG Road, Bengaluru
5002 Arun
[email protected] 23/11/1993 #34, Near Bus Stand, 4.1
Kumar Shan Plaza, Mangalore
5003 Mary
[email protected] 12/05/1993 #44, Meeta Towers, D. U. 4.2
Francis Road, Mysore
Tuple: A row in a relation Domain: A set of atomic
values of an attribute
This file is meant for personal use
DBMS by
[email protected] only. 16
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.
KEY AND NON-KEY ATTRIBUTES
Key Attributes
The attributes that participate in the selection of candidate key are Key attributes
Non-Key Attributes
The attributes other than the Candidate Key attributes in a table/relation are called Non-Key
attributes
[email protected]
S34AL0U9B8
Student Table
Student Id Name Email Id Mobile No Address
Key attribute Non- Key attribute
This file is meant for personal use
DBMS by
[email protected] only. 17
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.
CANDIDATE KEY
Candidate keys are identified during the design of the data base
Candidate key is an attribute, that is sufficient to distinguish every tuple in the relation
from each one
Composite Candidate key is a Candidate key comprising of two or more attributes
[email protected]
S34AL0U9B8
Student Table
Student Id Name Email Id Mobile No Address
Candidate Keys
This file is meant for personal use
DBMS by [email protected] only. 18
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.
PRIMARY KEY
One among the candidate keys is chosen by the database designer at the time of table
creation. This key is called as PRIMARY KEY and is used to uniquely identify the tuples
The remaining candidate keys (other than the primary key) are called as Alternate keys
Cannot be NULL and have to be unique
A relation (table) can have 0 or maximum ONE primary key
[email protected]
S34AL0U9B8
Alternate Keys
Student Id Name Email Id Mobile No Address
Primary Key Candidate Keys
This file is meant for personal use
DBMS by
[email protected] only. 19
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.
COMPOSITE PRIMARY KEY
Composite Primary Key - combination of more than one attribute of the relation which
uniquely identifies the tuple
Student Marks Table Student Marks Table – Sample Data
[email protected]S34AL0U9B8
Student Subject Student Subject
Marks Marks
Id ID Id ID
S1001 S100 87
S1001 S200 65
Composite primary key S1002 S100 45
S1002 S200 74
S1003 S200 64
This file is meant for personal use
DBMS by
[email protected] only. 20
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.
FOREIGN KEY
A set of attribute (s) whose values are required to match values of a column in the same
or another table
Foreign Key of a table (child table) should be the unique key in the parent table
In the child table, FK need not have to be unique and they can also be null
FK establishes relationships between the relational tables
[email protected]
S34AL0U9B8
Student Table(child Table)
Email Mobile
Student Id Name Branch Id
Id No
Foreign Key
Branch Table(Parent Table) Branch
Branch Id
Name
This file is meant for personal use
DBMSby [email protected] only.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
21
Sharing or publishing the contents in part or full is liable for legal action.
FEATURES OF RDBMS
Every piece of information is stored in the form
of tables
Has primary keys for unique identification of
rows
Has foreign keys to ensure data integrity
[email protected]S34AL0U9B8
Provides SQL for data access
Uses indexes for faster data retrieval
Gives access privileges to ensure data security
DBMS
This file is meant for personal use by [email protected] only. 22
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.
[email protected]
S34AL0U9B8
THANK YOU
This file is meant for personal use by [email protected] only.
Proprietary content. ©Great
Sharing Learning. the
or publishing All Rights Reserved.
contents in part or Unauthorized use or
full is liable for legal distribution prohibited
action.