





















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Constraints and Relational Algebra, Key Constraints, Multiple Relations, Relational Database Schema, Referential Integrity, Foreign Key, Relational Algebra, Relational Algebra Expression, SELECT, PROJECT, UNION, INTERSECTION, MINUS, CARTESIAN PRODUCT, JOIN, EQUIJOIN, NATURAL JOIN, DIVISION
Typology: Study Guides, Projects, Research
1 / 61
This page cannot be seen from the preview
Don't miss anything!






















































Class bufMgr{... // Call DB object to allocate
a run of new pages and
// find a frame in the buffer pool for the first page// and pin it. If buffer is full, ask DB to deallocate// all these pages and return errorStatus newPage(int& firstPageId, Page& firstpage,int howmany=1);// Check if this page is in buffer pool, otherwise// find a frame for this page, read in and pin it.// Also write out the old page if it's dirty before reading// if emptyPage==TRUE, then actually no read is done to bring// the page in.Status pinPage(int PageId_in_a_DB, Page& page,**
int
emptyPage=0, const
*char filename=NULL);
*...} //// in your code//PageId pid;Page pPageTmpSecondaryIndexHeaderPage
*pHeaderPage;
MINIBASE_BM->newPage( pid, pPageTmp
);
pHeaderPage = (SecondaryIndexHeaderPage)pPageTmp;*
key constraint
Superkey
of R:
same value for SK
≠
t2[SK]
any valid state
r(R)
Key
of R:
from K results in a set of attributes that is not a superkey (doesnot possess the superkey uniqueness property)
If a relation has several
candidate keys
, one is chosen
arbitrarily to be the
primary key
Example: Consider the CAR relation schema:– CAR(State, Reg#, SerialNo, Make, Model, Year)– We chose SerialNo as the primary key
-^
The primary key value is used to
uniquely identify
each
tuple in a relation– Provides the tuple identity
-^
Also used to
reference
the tuple from another tuple
candidate keys (in terms of size)
database.
database schema
relation schemas
within the database S
reference
a tuple t2 in R2 if
t1[FK] = t2[PK].
of the the
referencing relation
R1 can be
either
corresponding primary key PK in the
referenced
relation
R2, or
null
expressed by the model per se
projects he or she works on is 56 hrs per week”
(RESTRICT or REJECT option)
violation
corrected (CASCADE option, SET NULL option)
INSERT may violate any of the constraints:– Domain constraint:
of the specified attribute domain
in another tuple in the relation
key value that does not exist in the referenced relation