0% found this document useful (0 votes)
20 views13 pages

RDBMS Basics

RDBMS
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)
20 views13 pages

RDBMS Basics

RDBMS
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/ 13

RDBMS

DATABASE

May be defined as a collection of interrelated data stored


together to serve multiple application
It is computer based record keeping system.
It not only allows to store but also allows us
modification of data as per requirements.
DBMS

A DBMS refers to Database Management System


It is a software that is responsible for storing, manipulating,
maintaining and utilizing database.
A database along with the a DBMS is referred to as a database
system.
There are various DBMS software available in the market like
:-
Oracle, MS SQL Server, MySQL, Sybase, PostgreSQL,
SQLite
RDBMS
In relational database model data is organized into table (i.e. rows
and columns).
These tables are also known as relations.
A row in a table represent relationship among a set of values.
A column represent the field/attributes related to
relation under which information will be stored.
For example if we want to store details of students then : Roll,
Name, Class, Section, etc. will be the column/attributes and the
collection of all the column information will become a Row/Record
SAMPLE TABLES
EMPLOYEE
EMPNO ENAME GENDER DEPTNO SALARY COMM
1 ANKITA F 10 20000 1200
2 SUJEET M 20 24000 1900
3 VIJAYA F 10 28000 2000
4 NITIN M 30 18000 3000
5 VIKRAM M 30 22000 1700

DEPARTMENT
DEPTNO DNAME LOCATION
10 HR NEW YORK
20 ACCOUNTS BRAZIL
30 SALES CANADA
40 IT INDIA
COMPONENTS OF A TABLE

Byte : group of 8 bits and is used to store a character.

Data Item : smallest unit of named data.


It represent one type of information and often referred to as a
field or
column information
Record : collection of data items which represent a
complete unit of information

Table : collection of all Rows and Columns.


Field
Table
s

DEPTNO DNAME LOCATION


10 HR NEW YORK
20 ACCOUNTS BRAZIL
30 SALES CANADA
40 IT INDIA

Data Items (requires 5


bytes)
Records
RELATED TERMS
EXAMPLE
BOOKCODE BOOKNAME PUB PRICE
B001 LET US C BPB 400
B002 VISUAL EEE 350
BASIC
B003 JAVA PHI 550
B004 VC++ BPB 750

Identify the following in the above table

1) Degree of Table
2) Cardinality of Table
3) Attributes of Table
4) Tuple
5) Data types of Book Code and Price
CONCEPT OF KEYS

EMPNO ENAME GENDER DEPTNO SALARY COMM


1 ANKITA F 10 20000 1200
2 SUJEET M 20 24000
3 VIJAYA F 10 28000 2000
4 NITIN M 30 18000 3000
5 VIKRAM M 30 22000 1700

In relation each record must be unique i.e. no two identical records are
allowed in the Database. A key attribute identifies the record and must have
unique values. There are various types of Keys:
Primary Key, Candidate Key, Alternate Key and Foreign Key.
Primary Key
❖ A set of one or more attribute that can identify a record uniquely in the relation is
called Primary Key.
❖ There can be only 1 primary key in a table
❖ Allows only distinct (no duplicate) values and also forces mandatory entry (NOT
NULL) i.e. we cannot left it blank.
Candidate Key
❖ In a table there can be more than one attribute which contains unique values. These
columns are known as candidate key as they are the candidate for primary key.
❖ Among these database analyst select one as a primary key based on requirement like
must contain unique value, compulsory entry and where maximum searching is done
etc.
Alternate Key
❖ In case of multiple candidate keys, one of them will be selected as Primary Key
and rest of the column will serve as Alternate Key
❖ A Candidate Key which is not a primary key is an Alternate Key.
Foreign key
❖ Used to create relationship between two tables.
❖ It is a non-key attribute whose value is derived from the Primary key of another
table.
❖ Foreign key column will for the value in Primary key of another table, if present
then entry will be allowed otherwise data will be rejected.
❖ Primary Key column table from where values will be derived is known as Primary
Table or Master Table or Parent Table and Foreign key column table will be
Foreign Table or Detail Table or Child table
EMPLOYEE
EMPNO ENAME GENDER DEPTNO SALARY COMM
Child
1 ANKITA F 10 20000 1200 Table
2 SUJEET M 20 24000
3 VIJAYA F 10 28000 2000
4 NITIN M 30 18000 3000
5 VIKRAM M 30 22000 1700

DEPARTMENT
Parent
DEPTNO DNAME LOCATION
Table
10 HR NEW YORK
20 ACCOUNTS BRAZIL
30 SALES CANADA
40 IT INDIA

From the Above table definition we can observe that the DEPTNO column of EMPLOYEE
table is deriving its value from DEPTNO of table DEPARTMENT. So we can say that the
DEPTNO of EMPLOYEE table is a foreign key whose value is dependent upon the Primary
key column DEPTNO of table DEPARTMENT.

You might also like