0% found this document useful (0 votes)
65 views16 pages

Relational Databases: Rishu Kaul Computer Science Department

This document discusses relational databases and database terminology. It defines a database as a collection of interrelated data stored together to serve multiple applications. A database management system (DBMS) is software that defines, manipulates, retrieves and manages data in a database. The document then discusses key concepts in relational database modeling including tables, rows, columns, primary keys, candidate keys, alternate keys, and foreign keys. Primary keys uniquely identify rows, candidate keys may be selected as the primary key, alternate keys are not selected as primary keys, and foreign keys link data between tables.

Uploaded by

Rishu Kaul
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)
65 views16 pages

Relational Databases: Rishu Kaul Computer Science Department

This document discusses relational databases and database terminology. It defines a database as a collection of interrelated data stored together to serve multiple applications. A database management system (DBMS) is software that defines, manipulates, retrieves and manages data in a database. The document then discusses key concepts in relational database modeling including tables, rows, columns, primary keys, candidate keys, alternate keys, and foreign keys. Primary keys uniquely identify rows, candidate keys may be selected as the primary key, alternate keys are not selected as primary keys, and foreign keys link data between tables.

Uploaded by

Rishu Kaul
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/ 16

Relational Databases

Rishu Kaul
Computer Science Department
Objectives
• What is a database?
• Database Management System
• Relational Database Model and Terminology
• Keys
- Candidate Key
- Primary Key
- Alternate Key
- Foreign Key
Database
A database is defined as a collection of
interrelated data stored together to serve
multiple applications.

https://www.handybackup.net/database-backup.shtml
WHY DO WE NEED DATABASE
❑ To manage large chunks of data: if size of data increases into thousands
of records, it will simply create a problem to manage.Database can
manage large amount of data.
❑ Accuracy: Through validation rule in database ,data accuracy can
be maintained.
❑ Ease of updating data: With the database, we can flexibly update the
data according to our convenience. Moreover, multiple people can also
edit data at same time.
❑ Security of data: With databases we have security groups and
• privileges to restrict access.
❑ Data integrity: In databases, we can be assured of accuracy and
consistency of data due to the built in integrity checks and access
controls.
Advantages of Database System
❖ Databases reduces Redundancy
It removes duplication of data because data are kept at one place and all the application
refers to the centrally maintained database.
❖ Database controls Inconsistency
When two copies of the same data do not agree to each other, then it is called
Inconsistency. By controlling redundancy, the inconsistency is also controlled.
❖ Database facilitate Sharing of Data
Data stored in the database can be shared among several users.
❖ Database ensures Security
Data are protected against accidental or intentional disclosure to unauthorized
person or unauthorized modification.
❖ Database maintains Integrity
It enforces certain integrity rules to insure the validity or correctness of data. For ex. A date
can’t be like 31/31/2000.
Database Management System

A database management system (DBMS)


is a software package designed to define,
manipulate, retrieve and manage data in
a database. A DBMS generally manipulates
the data itself, the data format, field names,
record structure and file structure.

https://www.vectorstock.com/royalty-free-vector/dbms-database-management-system-computer-data-vector-8212159
DBMS EXAMPLES
RELATIONAL DATABASE TERMS
❖ Relation (Table)
A Relation or Table is Matrix like structure arranged in Rows and Columns. It has the
following properties-
❖ Atomicity : Each column assigned a unique name and must have atomic(indivisible)
value i.e. a value that can not be further subdivided.
❖ No duplicity: No two rows of relation will be identical i.e. in any two rows
value in at least one column must be different.
All items in a column are homogeneous i.e.same data type.
❖ Ordering of rows and column is immaterial.
❖ Domain :It is collection of values from which the value is derived for a
column.
❖ Tuple / Entity / Record - Rows of a table is called Tuple or Record.
❖ Attribute/ Field- Column of a table is called Attribute or Field.
❖ Degree - Number of columns (attributes) in a table.
❖ Cardinality - Number of rows (Records) in a table.
A relational database is a set of
formally described tables from
which data can be accessed or
reassembled in many different ways
without having to reorganize
the database tables. The standard user
and application programming interface
(API) of a relational database is the
Structured Query Language (SQL).
Key plays an important role in relational database; it is used for identifying unique rows from
table & establishes relationship among tables on need.
Types of keys in DBMS
❖ Primary Key – A primary is a column or set of columns in a table that uniquely identifies
tuples (rows) in that table.
❖ Candidate Key –It is an attribute or a set of attributes or keys participating for Primary
Key, to uniquely identify each record in that table.
❖ Alternate Key – Out of all candidate keys, only one gets selected as primary key,
remaining keys are known as alternate or secondary keys.
❖ Foreign Key – Foreign keys are the columns of a table that points to the primary key of
another table. They act as a cross-reference between tables.
Candidate Key
A Candidate key is an attribute or set of attributes that uniquely identifies a record.
Among the set of candidate, one candidate key is chosen as Primary Key. So a table can
have multiple candidate key but each table can have maximum one primary key.

https://www.c-sharpcorner.com/UploadFile/f0b2ed/types-of-keys-in-database/
Primary Key

A Primary key uniquely identifies each record


in a table and must never be the same for the
2 records. Primary key is a set of one or more
fields ( columns) of a table that uniquely
identify a record in database table. A table
can have only one primary key and one
candidate key can select as a primary key. The
primary key should be chosen such that its
attributes are never or rarely changed, for
example, we can’t select Student_Id field as a
primary key because in some case Student_Id
of student may be changed. https://www.teach-
ict.com/as_a2_ict_new/ocr/AS_G061/315_database_concepts/terminology/miniweb/pg10.htm
Alternate Key:

Alternate keys are candidate keys that are not selected as primary key. Alternate
key can also work as a primary key. Alternate key is also called “Secondary Key”.

https://www.guru99.com/dbms-keys.html
Foreign Keys:

Foreign key is used to generate the relationship between the tables. Foreign Key is a
field in database table that is Primary key in another table. A foreign key can accept
null and duplicate value.

http://www.querytool.com/help/1075.htm

You might also like