0% found this document useful (0 votes)
13 views19 pages

Module 2 - Part 1

Uploaded by

anshwaraullas
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)
13 views19 pages

Module 2 - Part 1

Uploaded by

anshwaraullas
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/ 19

DBMS

Module 2
part 1
INDEX
❑ Relational Model
❑ Relational Model Constraints
❑ ER Model to Relational Model
❑ Relational Algebra
❑ Select
❑ Project
❑ Cartesian product
RELATIONAL MODEL
• The relational model represents
the database as a collection of
relations
• In the formal relational model
terminology,
❑ A row is called a tuple
❑ A column is called an
attribute
❑ The table is called a relation
DOMAIN
❑ A set of atomic values allowed for an attribute
Eg:Student age

RELATION SCHEMA
❑ Describes a relation
❑ Made up of a relation name R and a list of attributes
A1,A2,……..An
Eg:STUDENT(Name,Rollnum,Age)
STUDENT(Name:string,Rollnum:integer,Age:integer)
DEGREE OF A RELATION
❑ Number of attributes in a relation schema
Eg: STUDENT(Name,Rollnum,Age)-degree-3

CARDINALITY
❑ Total number of tuples present in a relation
RELATIONAL MODELS
CONSTRAINTS
• Constraints are the restrictions or the limitations on data in
the database
1. Inherent model-based constraints or implicit constraints:
Constraints that are inherent in the data model
2. Schema-based constraints or explicit constraints:
Constraints that are defined directly in the schemas of the
data model
3. Application-based or semantic constraints or business
rules: Constraints that cannot be directly expressed in the
schemas of the data model, and hence must be
expressed and enforced by the application programs.
SCHEMA BASED CONSTRAINTS
1.DOMAIN CONSTRAINTS
• Must be atomic value
• Performs data type check
2.KEY CONSTRAINTS
• An attribute that can uniquely identify each tuple in a
relation is called a key

• A superkey specifies that no two tuples can have the


same value
• Every relation has atleast one superkey -set of all
attributes.EG:{RollNo,Email,{RollNo,Name},…..}
• Candidate key is a set of attributes that uniquely
identify the tuples in a relation
Eg:RollNo and Email
3.CONSTRAINTS OF NULL VALUES
• Specifies whether null values are permitted or not(NOT
NULL)
Eg:Name

4.ENTITY INTEGRITY CONSTRAINTS


• Specify that no primary key value can be null
ER MODEL TO RELATIONAL MODEL
1.Create a table for each entity
2.Entity’s attribute should become fields of tables with respect
to data types
3.Declare primary key
RELATIONAL ALGEBRA

• It is a procedural query language


• It consist of a set of operation that take one or two relation
as input and produce a new relation as their result
• It consist of two types of operation
1.Unary operation:They operate on one relation
Eg:Select,Project
2.Binary operation:They operate on pairs of relationships
Eg:Cartesian product
SELECT OPERATION
• The select operation select tuples that satisfy a given
predicate
PROJECT OPERATION
• It projects attributes(columns) that satisfy a given predicate
CARTESIAN PRODUCT
• It combines information of two different relations into one
relation
THANK YOU

You might also like