Database-Concepts 1
Database-Concepts 1
Database
or
DBMS ( Database Mangement system)
• It is a collection of multiple tables.
• OR
• collection of logically related data.
• OR
• It is computerized record keeping information
system.
Examples of DBMS software are
Dbase, Foxpro, Oracle, MS SQL
Server, MS Access, Paradox, DB2,
FileMaker and MySQL etc.
DATABASE
is a collection of Data is organized into
organized rows, columns i.e. in
DATA/INFORMATION the tables form
It works like a
container which
contains the various
object like Tables,
Queries, Reports
Different types of Databases
reduces
Redundancy facilitate Sharing
of Data
(duplication)
maintains
Provides Integrity
Security
( rules /condition)
RELATIONAL DATABASE
It establishes a well-defined
relationship between database tables
Relation : Student
Rollno Admno Name Stream Phone
1 12/345 Teena Science 234567879
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Attribute/field/column
A column in a relation is called an attribute.
It is also termed as field or column.
Relation : Student
Rollno Admno Name Stream Phone
1 12/345 Teena Science 234567879
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Degree
No of columns/attributes in a relation
Degree is 5
Relation : Student
Rollno Admno Name Stream Phone
1 12/345 Teena Science 234567879
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Tuple/Record
- A row in a relation is called a tuple.
OR
– Collection of fields in a relation
Relation : Student
Rollno Admno Name Stream Phone
1 12/345 Teena Science 234567879
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Cardinality
- No of rows/record/tuples in a relation
Cardinality is 6
Relation : Student
Rollno Admno Name Stream Phone
1 12/345 Teena Science 234567879
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Domain
It is pool of values from which the value
is derived for a column.
Relation : Student
Rollno Admno Name Stream Phone
1 12/345 Teena Science 234567879
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Science
Commerce
Humanities
RELATIONAL DATABASE TERMS
KEYS IN A DATABASE
Alternate Key-
Foreign Key
Primary Key
Primary key is a key that can uniquely identifies the
records/tuples in a relation.
This key can never be duplicated and NULL.
Relation : Student
Rollno Admno Name Stream Phone
Rollno can be
primary key 1 12/345 Teena Science 234567879
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Candidate Key -
which can serve as a primary key but not
primary key. it is also called alternate key
Relation : Student
Rollno Admno Name Stream Phone
admno can be
candidate key 1 12/345 Teena Science 234567879
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Alternate Key-
Out of all candidate keys, only one gets selected
as primary key, remaining keys are known as
alternate or candidate key
Relation : Student
admno can be Rollno Admno Name Stream Phone
alternate key/ 1 12/345 Teena Science 234567879
candidate key
2 14/564 Sheena Commerce 344553322
3 10/345 Heena Science 23455632
4 11/456 Meena Science 345522356
5 13/432 Leena Humanities 456720980
6 3/567 Reena Commerce 456322578
Foreign Key-
Foreign Key is a key that is defined as a primary key
in some other relation.
Relation : Student
Rollno Admno Name
Relation : Test
Stream Phone Tno
12/345 Science
Tno Tname dateofexam
1 Teena 234567879 T1
14/564 Commerce
T1 UT1 2/4/2020
2 Sheena 344553322 T1
10/345 Science
T2 HY 3/9/2020
3 Heena 23455632 T2
11/456 Science
T3 UT2 5/11/2020
4 Meena 345522356 T2
13/432 Humanities
T4 Annual 9/1/2021
5 Leena 456720980 T3
6 3/567 Reena Commerce 456322578 T2
FOREIGN KEY
Observe the following table and answer the question
TABLE: VISITOR
• Table: Client
C_ID ClientName City P_ID
1 Cosmetic Shop Delhi FW05
6 Total Health Mumbai BS01
12 Live Life Delhi SH06
15 Pretty One Delhi FW05
(i) Identify the attribute best suitable to be declared as a primary key from
the product table
(ii) Identify the foreign key and primary key from the table client
(ii) Write the degree and cardinality of the table product.