0% found this document useful (0 votes)
7 views25 pages

12 Relational Databases

The document provides an overview of relational databases, defining key concepts such as databases, DBMS, data redundancy, and data inconsistency. It explains the structure of relational databases, including tables, fields, records, and keys, while also discussing MySQL and SQL functionalities. Additionally, it outlines the classification of SQL statements and their respective commands for data definition, manipulation, and transaction control.
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)
7 views25 pages

12 Relational Databases

The document provides an overview of relational databases, defining key concepts such as databases, DBMS, data redundancy, and data inconsistency. It explains the structure of relational databases, including tables, fields, records, and keys, while also discussing MySQL and SQL functionalities. Additionally, it outlines the classification of SQL statements and their respective commands for data definition, manipulation, and transaction control.
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/ 25

R E L AT I O N A L

DATA B A S E S
CHAP 12
W H AT I S A D ATA B A S E ?

T H E C O L L E C T I O N O F I N T E R R E A LT E D D ATA
S TO R E D TO S E RV E M U LT I P L E A P P L I C AT I O N S .

Krish Info Tech


W H AT I S D B M S ?
• A database management system refers to
a software that is responsible for
storing, maintaining and utilizing
databases.
• A database along with the DBMS is
referred to as a database system.

Krish Info Tech


Duplication
of data is
known as
data
redundancy

W H AT I S D ATA R E D U N D A N C Y ?
Krish Info Tech
W H AT I S D ATA I N C O N S I S T E N C Y ?

Mismatched
multiple copies
of same data is
known as data
inconsistency.

Krish Info Tech


R E L A T I O N A L D A TA B A S E
MANAGEMENT S YSTEM

Data is organized into tables and these tables


are called relations in database.

A row in a table represents a relationship


among a set of values.

A table is a collection of such relationships


and we call that as relations.

Krish Info Tech


C O M P O N E N T S O F A TA B L E

Byte
• a byte is a group of eight bits and is used to store a single
character

data item
• the smallest unit of named data, the value present in a single
cell is data item

Krish Info Tech


C O M P O N E N T S O F A TA B L E

Field
• a data item represents one type of information also called as
column

record
• record is a named collection of data items which represents
a complete unit of information

Krish Info Tech


C O M P O N E N T S O F A TA B L E

Table
• a table is surnamed collection of all
occurrences of a given type of logical
records
Krish Info Tech
Requires 1 Bytes

Krish Info Tech


Requires 8 Bytes

Krish Info Tech


Data Items

Krish Info Tech


Fields

Krish Info Tech


Records

Krish Info Tech


E X A M P L E S O F R D B M S S O F T WA R E

SAP Sybase
Microsoft adaptive
Oracle IBM
SQL MYSQL
database Informix server
software
enterprise

Krish Info Tech


T H E R E L AT I O N A L M O D E L
TE R MI N OLOG I E S

Relation • relation is a table that is data arranged in rows and columns

Domain • domain is a pool of values from which the actual values appearing in a given
column are drawn

Tuple • the rows of tables

Attributes • the columns of tables

Degree • the number of attributes in a relation

Cardinality • the number of rows in a relation


Krish Info Tech
KEYS

To distinguish the rows in a relation conceptually we need keys so


that the rows are distinct from one another.

The keys we use in RDBMS are:

Primary key Candidate key Alternate key Foreign key


Krish Info Tech
Primary key

• Primary key is a set of one or more attributes that can uniquely


identify tuples within the relation
• When a primary key is made-up of two or more attributes it is called
composite primary key

Candidate key

• All attributes combinations inside a relation that can serve as primary


KEYS key or candidate keys as they are candidates for the primary key post

Alternate key

• A candidate key that is not the primary key is called as alternate key

Foreign key

• A non key attribute whose values are derived from the primary key of
some other table
Krish Info Tech
M Y S Q L D ATA B A S E
• MySQL database system refers to the combination of a MySQL server instance
and a MySQL database.
• MySQL operates using client server architecture in which the server runs on the
main machine containing the databases in clients connect to the server over a
network.
• The server listens for client request coming in over the network and access
database contains according to those requests and provides that to the clients.
• Clients are the programs that connect to the database server and issue queries in
a pre specified format.

Krish Info Tech


MYSQL AND SQL

The SQL is a language that


SQL stands for structured
enables you to create and
query language and it is a set
operate on relational
of commands that is
databases, which are set of
recognized by nearly all
related information stored in
rdbmss.
tables.

Krish Info Tech


P RO C E S S I N G C A PA B I L I T I E S O F S Q L

Data definition Interactive Data embedded data View definition Authorization Integrity transaction
language manipulation manipulation control
language language
provides comments for includes a query language embedded form of SQL SQL DDL also includes it includes comments for it provides forms of includes commands for
defining relations, based on both relational is a designed for use commands for defining specifying access rights to integrity checking specifying the beginning
deleting relations, algebra and the tuple within general purpose views which are tables. relations and views and ending of
creating indexes and relational calculus. programming languages transactions along with
modifying relations. like COBOL, Pascal, C, commands
C++, etc

Krish Info Tech


C L A S S I F I C AT I O N O F S Q L
S TAT E M E N T S

SQL provides many different types of commands used for different purposes.

Data Transaction
Data definition
manipulation control Session control
language (DDL)
language (DML) language (TCL) commands
commands
commands commands

Krish Info Tech


D ATA D E F I N I T I O N C O M M A N D S
• The DDL commands allows you to perform task related to the data
definition.

Create, alter, and drop schema Grant and revoke


Maintenance commands
objects privileges and roles

Krish Info Tech


D ATA M A N I P U L AT I O N C O M M A N D S

DML commands are used to


A DML is a language that
manipulate the data, for
enables users to access or
DMS are basically of two example inserting a tuple into
manipulate data as organized
types: a table modifying a tuple in a
by the appropriate data
table deleting a tuple in a
model.
table.

non procedural DMLs user 2


procedural DMLs which are
specify what data is needed
used to specify what data is
without specifying how to get
needed and how to get it.
it
Krish Info Tech
T RA N S AC T I O N C O N T RO L C OM M A N D S
• A transaction is one complete unit of work, for example, preparing report card for a
student is a transaction but it involves many steps like open students table read data
from it, open marks table read data from it, calculate percentage and grade write the
computed result to result file and finally close these three tables.
• Some TCL commands are:
oCOMMIT - make all the changes made by statements issued, permanent
oROLLBACK - endos all changes since the beginning of a transaction
oSAVE POINT - marks a point up to which all earlier statements have been successfully
completed
oSET TRANSACTION - establishes properties for the current transactions.

Krish Info Tech

You might also like