0% found this document useful (0 votes)
6 views24 pages

01_RDBMS_01

Uploaded by

yasvinariya2708
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views24 pages

01_RDBMS_01

Uploaded by

yasvinariya2708
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Database Management System

[3051- M.Sc. (Statistics)]

Unit 1. RDBMS (Cont’d…)

By Dr. Tejaskumar Ghadiyali


Unit 1. RDBMS
• RDBMS –Relational Database Management System
• Introduction
• Types of Keys
• Entity Relationship Model
• EER
• Database Structure: DDL, DML, DCL,TCL
• Types of Data Models
• PL/SQL-functions, triggers and procedures
Unit 2. RDBMS - Introduction
• Data consists of raw facts
• Data: Facts, figures, statistics etc. having no particular
meaning (e.g. 1, ABC, 19 etc).
• Record: Collection of related data items, e.g. in the above
example the three data items had no meaning. But if we
organize them in the following way, then they collectively
represent meaningful information.
Roll Name Age
1 ABC 19
Unit1. RDBMS - Introduction
• Table or Relation: Collection of related records.
Roll Name Age
1 ABC 19
2 DEF 22
3 XYZ 28

• The columns of this relation are called Fields or


Attributes
• The rows are called Records or Tuples
Unit 1. RDBMS - Introduction
• Relational Database: Collection of related relations.
Consider the following collection of tables:
Roll Name Age Roll Address
1 ABC 20 1 DEL
2 DEF 22 2 BOM
3 XYZ 19 3 SUR

Roll Year Year Hostel Hostel Warden

1 I I H1 H1 Mr. Das

2 II II H2 H2 Mrs. Pal

3 I Who is the warden of the youngest


student ?
Unit 1. RDBMS - Introduction
• The database which stores data in the tables that
have relationships with other tables in the database
is called RDBMS or Relational Database
Management System.
• So, the software application that enables the users
to store the data is known as a database
• The database which stores data in the tables that
have relationships with other tables in the database
is called RDBMS
• However, in DBMS or Database Management
System, there are no relationships among tables
Unit 1. RDBMS - Introduction
• The database system in which the relationships
among different tables are maintained is called
Relational Database Management System. Both
RDBMS and DBMS are used to store information in
physical database
• In 1970s, Edgar Frank Codd introduced the theory
of relational database
• RDBMS solution is required when large amounts of
data are to be stored as well as maintained
• A relational data model consists of indexes, keys,
foreign keys, tables and their relationships with
Unit 1. RDBMS - Introduction
• Relational DBMS enforces the rules even though
foreign keys are support by both RDBMS and DBMS
• RDMS can be termed as the next generation of
database management system. DBMS is used as a
base model in order to store data in a relational
database system.
• However, complex business applications use
RDBMS rather than DBMS.
Unit 1. RDBMS - Introduction
DBMS v/s RDBMS
DBMS RDBMS
DBMS as it is used to manage Relationship among tables is
the database maintained in a RDBMS

DBMS accepts the ‘flat file’ RDBMS does not accepts this type of
data that means there is no design.
relation among different data
DBMS is used for simpler RDBMS is used for more complex
business applications applications.
Although the foreign key The foreign key concept is supported
concept is supported by by RDBMS that enforces the rules
DBMS, can not enforces the
rules
Small sets of data can be RDBMS solution is required by large
managed by DBMS. sets of data
Unit 1. RDBMS - Introduction
DBMS vs.
DBMS RDBMS RDBMS
DBMS as it is used to manage the Relationship among tables is
database maintained in a RDBMS
DBMS accepts the ‘flat file’ data RDBMS does not accepts this type
that means there is no relation of design.
among different data
DBMS is used for simpler business RDBMS is used for more complex
applications applications.
Although the foreign key concept The foreign key concept is
is supported by DBMS, can not supported by RDBMS that
enforces the rules enforces the rules
small sets of data can be managed RDBMS solution is required by
by DBMS. large sets of data
Unit 1. RDBMS - KEYS
• KEYS in RDBMS is an attribute or set of attributes which
helps you to identify a row(tuple) in a relation(table)
• In a real-world application, a table could contain thousands
of records Moreover, the records could be duplicated.
• Keys ensure that you can uniquely identify a table record
despite these challenges
• Keys help you uniquely identify a row in a table by a
combination of one or more columns in that table.
• Keys allow you to find the relation between two tables
• Key is also helpful for finding unique record or row from
the table
Unit 1. RDBMS - KEYS
• There are different types of Keys in RDBMS and
each key has it’s different functionality
1. Super Key
2. Primary Key
3. Candidate Key
4. Alternate Key
5. Foreign Key
6. Compound Key
7. Composite Key
8. Surrogate Key
Unit 1. RDBMS - KEYS
• A Super key is a group of single or multiple keys
which identifies rows in a table. A Super key may
have additional attributes that are not needed for
unique identification
EmpSRN Empid Empname
9812345098 AB05 Shown
9876512345 AB06 Roslyn
1999378900 AB07 James

• In the above-given example, EmpSRN and Empid ,


Emp name are Super keys.
Unit 1. RDBMS - KEYS
• A Primary Key is a column or group of columns in
a table that uniquely identify every row in that
table. The Primary Key can't be a duplicate meaning
the same value can't appear more than once in the
table. A table cannot have more than one primary
key
• Rules for Primary Keys
• Two rows can't have the same primary key value
• It must for every row to have a primary key value.
• The primary key field cannot be null.
• The value in a primary key column can never be modified
or updated if any foreign key refers to that primary key.
Unit 1. RDBMS - KEYS
In following example, StudID is a primary key
StudID Roll No First Name LastName Email

1 11 Raj Patel patelraj@gmail.com


2 12 Jay Das jaydas@gmail.com
3 13 Vijay Gupta guptavijay@yahoo.com

Primary Key in … AccountNumbe


Banking Application r
Railway Reservation PRNumber
School Admission GRNumber
Unit 1. RDBMS - KEYS
• An Alternate Keys is a column or group of columns in a
table that uniquely identify every row in that table. A table
can have multiple choices for a primary key but only one
can be set as the primary key. All the keys which are not
primary key are called an Alternate Key.
StudID Roll No First Name LastName Email

1 11 Raj Patel patelraj@gmail.com


2 12 Jay Das jaydas@gmail.com
3 13 Vijay Gupta guptavijay@yahoo.com

• In this table, StudID, Roll No, Email are qualified to become


a primary key. But since StudID is the primary key, Roll No,
Email becomes the alternative key.
Unit 1. RDBMS - KEYS
• A Candidate Key is a set of attributes that uniquely
identify tuples in a table. Candidate Key is a super key with
no repeated attributes. The Primary key should be selected
from the candidate keys. Every table must have at least a
single candidate key. A table can have multiple candidate
keys but only a single primary key.
StudID Roll No First Name LastName Email

1 11 Raj Patel patelraj@gmail.com


2 12 Jay Das jaydas@gmail.com
3 13 Vijay Gupta guptavijay@yahoo.com

• In this table, StudID, Roll No, Email the candidate key.


Unit 1. RDBMS - KEYS
Unit 1. RDBMS - KEYS
• A Foreign Key is a column that creates a relationship
between two tables. The purpose of Foreign keys is to
maintain data integrity and allow navigation between two
different instances of an entity. It acts as a cross-reference
between two tables as it references the primary key of
another
DeptCode
table.
DeptName Teacher ID Fname Lname

001 Science B002 David Warner

002 English B017 Sara Joseph

005 Computer B009 Mike Brunton

eacher ID DeptCode Fname Lname

B002 002 David Warner

B017 002 Sara Joseph

B009 001 Mike Brunton


Unit 1. Introduction to RDBMS
Primary Key Foreign Key
Helps you to uniquely identify a It is a field in the table that is the
record in the table. primary key of another table.
Primary Key never accept null A foreign key may accept multiple
values. null values.
Primary key is a clustered index A foreign key cannot automatically
and data in the DBMS table are create an index, clustered or non-
physically organized in the clustered. However, you can
sequence of the clustered index. manually create an index on the
foreign key.
You can have the single Primary You can have multiple foreign keys
key in a table. in a table.
Unit 1. RDBMS - KEYS
• A Compound Key has two or more attributes that allow
you to uniquely recognize a specific record. It is possible
that each column may not be unique by itself within the
database.
• However, when combined with the other column or columns
the combination of composite keys become unique.
• The purpose of the compound key in database is to uniquely
identify each record in the table
• E.g. School Roll Number System –
• Class + Div + Roll No will be Compound Key
Unit 1. RDBMS - KEYS
• A Composite Key is a combination of two or more columns
that uniquely identify rows in a table. The combination of
columns guarantees uniqueness, though individually
uniqueness is not guaranteed. Hence, they are combined to
uniquely identify records in a table.
• The difference between compound and the composite key is
that any part of the compound key can be a foreign key, but
the composite key may or maybe not a part of the foreign
key.
Unit 1. RDBMS - KEYS
• Surrogate Keys is an artificial key which aims to uniquely
identify each record is called a surrogate key. Surrogate
keys in sql are allowed when No property has the
parameter of the primary key
• This kind of partial key in RDBMS is unique because it is
created when you don't have any natural primary key. They
do not lend any meaning to the data in the table. Surrogate
key is usually an integer. A surrogate key is a value
generated right before the
Fnamerecord
Lastnameis inserted
Start Time into
End Timea table.

Anne Smith 09:00 18:00

Jack Francis 08:00 17:00

Anna McLean 11:00 20:00

Shown Willam 14:00 23:00


Thanks ….

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy