0% found this document useful (0 votes)
11 views

Unit 3 DBMS Macro

The document discusses key concepts in the relational model, including attributes, domains, primary keys, foreign keys, and various constraints. It explains the importance of normalization, detailing the different normal forms (1NF, 2NF, 3NF, and BCNF) and their requirements to eliminate redundancy and ensure data integrity. Additionally, it outlines Codd's 12 rules for relational database management systems and the implications of functional dependencies.

Uploaded by

Pratik Erande
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Unit 3 DBMS Macro

The document discusses key concepts in the relational model, including attributes, domains, primary keys, foreign keys, and various constraints. It explains the importance of normalization, detailing the different normal forms (1NF, 2NF, 3NF, and BCNF) and their requirements to eliminate redundancy and ensure data integrity. Additionally, it outlines Codd's 12 rules for relational database management systems and the implications of functional dependencies.

Uploaded by

Pratik Erande
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Attributes and Domains:-There are some commonly used terms in primary key is a candidate key chosen by the database

hosen by the database designer to identify


Relational Model and those are - Table or relation : In relational model, the tuple in the relation uniquely.
table is a collection of data items arranged in rows and columns. The table Candidate Key = Super Key – Primary Key
cannot have duplicate data or rows. Tuple or record or row : The single Rules for Primary Key i) The primary key may have one or more attributes.
entry in the table is called tuple. The tuple represents a set of related data. ii) There is only one primary key in the relation. iii) The value of primary
In above Student table there are four tuples. One of the tuple can be key attribute can not be NULL. iv) The value of primary key attribute does
represented as Attribute or columns : It is a part of table that contains not get changed. Alternate key : The alternate key is a candidate key
several records. Each record can be broken down into several small parts which is not chosen by the database designer to uniquely identify the
of data known as attributes.consists of four attributes such as tuples Foreign key is a .Foreign key :single attribute or collection of
RollNo,Name,Marks and Phone. Relation schema : A relation schema attributes in one table that refers to the primary key of other table. Thus
describes the structure of the relation, with the name of the relation (i.e. foreign keys refer to primary key. The table containing the primary key is
name of table), its attributes and their names and type. Relation Instance called parent table and the table containing foreign key is called child
: It refers to specific instance of relation i.e. containing a specific set of table Constraints:-Constraints mean some rules or restrictions that are
rows. Domain : For each attribute of relation, there is a set of permitted set on the database. There are three main types of constraints. 1. Domain
values called domain. For example – in above table, the domain of Constraint Domain constraint defines the domain or set of values for an
attribute Marks is set of all possible permitted marks of the students. attribute. The data type of domain includes string, character, integer,
Similarly the domain of Name attribute is all possible names of students. time, date, currency, etc. The value of the attribute must be available in
Atomic : The domain is atomic if elements of the domain are considered the corresponding domain. 2. Key Constraint or Null Constraint Keys are
to be indivisible units. For example in above Student table, the attribute used to identify particular record from the table. Primary key is normally
Phone is non-atomic. NULL attribute : A null is a special symbol, used to identify the record uniquely. All values of primary key must be
independent of data type, which means either unknown or inapplicable. unique. o The value of primary key must not be NULL.3. Integrity
It does not mean zero or blank. For example - Consider a salary table that Constraint Integrity constraints are rules that are to be applied on
contains NULL . Degree : It is nothing but total number of columns present database columns to ensure the validity of data. i) Entity Integrity
in the relational database.Cardinality : It is total number of tuples present Constraint:-This rule states that “In the relations, the value of attribute of
in the relational database. CODD's Rules: Codd proposed 13 rules for primary key can not be null”. The NULL represents a value for an attribute
relational database management system, which are popularly known as that is currently unknown or is not applicable for this tuple. The Nulls are
Codd’s 12 rule : These rules are as follows – Rule 0 : This rule states for a always to deal with incomplete or exceptional data. The primary key
database to be relational, it must use its relational capabilities to manage value helps in uniquely identifying every row in the table. Thus if the users
the database. Rule 1 : The Information rule - All information in an RDBMS of the database want to retrieve any row from the table or perform any
is represented logically only by storing the values in tables. Rule 2 : The action on that table, they must know the value of the key for that row.
Guaranteed Access rule - Each item of data in an RDBMS is guaranteed to Hence it is necessary that the primary key should not have the NULL
be logically accessible by specifying the table name, primary key value, valueii) Referential Integrity Constraint In relationships, data is linked
and column name. Rule 3 : The Systematic Treatment of Null Values rule between two or more tables. This is achieved by having the foreign key
- Null values are supported in a fully relational DBMS for representing (in the associated table) reference a primary key value (in the primary - or
missing information or inapplicable information in a systematic way which parent - table). Because of this, we need to ensure that data on both sides
is independent of the data type. Rule 4 : The Dynamic Online Catalog of the relationship remain intact. The referential integrity rule states that
Based on the Relational Model rule - Database dictionary which is called “whenever a foreign key value is used it must reference a valid, existing
as catalog-is the structure description of the complete Database and it primary key in the parent table. Enterprise Constraints Enterprise
must be stored online. This Catalog must be governed by same rules as constraints are also called as semantic constraints. The enterprise
rest of the database. The same query language should be used on catalog constraints are basically the additional rules specified by users or
as used to query database. Rule 5 : The Comprehensive Data database administrators. These constraints are normally based on
Sublanguage rule - At least one well structured, welldefined language multiple tables. Examples of enterprise constraints are – 1) The salary of
must be there which can access all the data present in the database. Rule teacher should not exceed the salary of Principal. 2) A Student can not opt
6 : The View Updating rule - All views of the data which are theoretically for more than two courses at a time. 3) A class can have maximum 50
updatable must be updatable in practice by the DBMS. Rule 7 : Relational students Enterprise constraints are also called as semantic constraints.
level operation - The High-level Insert, Update, and Delete rule: There The enterprise constraints are basically the additional rules specified by
must be insert, delete and update operations at each level of relations. users or database administrators. These constraints are normally based
Rule 8 : The Physical Data Independence rule - Physical storage should on multiple tables. Examples of enterprise constraints are – 1) The salary
not matter the system. Whenever any changes are made in either storage of teacher should not exceed the salary of Principal. 2) A Student can not
representations or access methods then it should not affect the opt for more than two courses at a time. 3) A class can have maximum 50
application. Rule 9 : The Logical Data Independence rule - If any changes students Data Redundancy and Update Anomalies Definition : Data
are made in table structure then the logical view of the user should not redundancy is a condition created in database in which same piece of data
get affected. For Rule example - if a table is split into two tables internally, is held at two different places. Redundancy is at the root of several
the view of the table to the user should be an entire table and not the split problems associated with relational schemas. Problems caused by
tables. Rule 10 : The Integrity Independence rule - The Integrity redundancy : Following problems can be caused by redundancyi)
constraints must be defined by the RDBMS stored in the system and it Redundant storage : Some information is stored repeatedly. ii) Update
should not be enforced by the external application programs. Rule 11 : anomalies : If one copy of such repeated data is updated then
The Distribution Independence rule - An RDBMS must have distribution inconsistency is created unless all other copies are similarly updated. iii)
independence. That means, even if database is scattered geographically, Insertion anomalies : Due to insertion of new record repeated information
user should get a feel as if it is stored in one piece at one location. Rule 12 get added to the relation schema. iv) Deletion anomalies : Due to deletion
: The Non-sub-version rule - If low-level language is allowed to access the of particular record some other important information associated with
system, then that low-level language must not be able to subvert or the deleted record get deleted and thus we may lose some other
bypass the integrity rules which are expressed in a higher-level language. important information from the schema. Normalization :-Normalization
Keys are used to specify the tuples distinctly in the given relation. Various is the process of reorganizing data in a database so that it meets two basic
types of keys used in relational model are – Superkey, Candidate Keys, requirements : 1) There is no redundancy of data (all data is stored in only
primary keys, foreign keys. 1) Super Key(SK) : It is a set of one or more one place) and 2) Data dependencies are logical (all related data items are
attributes within a table that can uniquely identify each record. 2) stored together) Need for normalization 1) It eliminates redundant data.
Candidate Key(CK) : The candidate key is a subset of superset. In other 2) It reduces chances of data error. 3) The normalization is important
words candidate key is a single attribute or least or minimal combination because it allows database to take up less disk space. Atomic Domains
of attributes that uniquely identify each record. 3) Primary Key(PK) :The and First Normal Form By atomic value, we mean that each value in the
domain is indivisible. The first normal form rule defines that all the
attributes in a relation must have atomic domains. The values in an atomic
domain are indivisible units. The table is said to be in 1NF if it follows
following rules - i) It should only have single (atomic) valued
attributes/columns. ii) Values stored in a column should be of the same
domain. iii) All the columns in a table should have unique names. iv) And
the order in which data is stored, does not matter. Decomposition using
Functional Dependencies:-Definition : A functional dependency A->B in a
relation holds if two tuples having same value of attribute A also have the
same value for attribute B. It is denoted by A->B where A is called
determinant and B is called dependent.Trivial FD : The functional
dependency A->B is trivial if B is a subset of A. For example (A,B}->A Non
Trivial FD : The functional dependency A->B is non trivial if B is not a
subset of A. Inference Rules The closure set is a set of all functional
dependencies implied by a given set F. It is denoted by F+ The closure set
of functional dependency can be computed using basic three rules which
are also called as Armstrong’s Axioms. These are as follows - i) Reflexivity
: If X Y, then X Y ii) Augmentation : If X Y, then XZ YZ for any Z iii)
Transitivity : If X Y and Y Z, then X Z In addition to above axioms some
additional rules for computing closure set of functional dependency are
as follows - Union : If X Y and X Z then X YZ Decomposition : If X YZ,
then X Y and X Z Lossless Join:- The lossless join can be defined using
following three conditions : i) Union of attributes of R1 and R2 must be
equal to attribute of R. Each attribute of R must be either in R1 or in R2.
Att(R1) ∪ Att(R2) = Att(R) ii) Intersection of attributes of R1 and R2 must
not be NULL. Att(R1) ∩ Att(R2) ≠ Φ iii) Common attribute must be a key
for at least one relation (R1 or R2) Att(R1) ∩ Att(R2) -> Att(R1) or Att(R1)
∩ Att(R2) -> Att(R2) Second Normal Form (2NF):-Before understanding
the second normal form let us first discuss the concept of partial
functional dependency and prime and non prime attributes. Concept of
partial functional dependency Partial dependency means that a nonprime
attribute is functionally dependent on part of a candidate key. For
example : Consider a relation R(A,B,C,D) with functional dependency {AB-
>CD, A->C} Here (AB) is a candidate key because (AB)+ = {ABCD} = {R}
Hence {A,B} are prime attributes and {C,D} are non prime attribute. In A-
>C, the non prime attribute C is dependent upon A which is actually a part
of candidate key AB. Hence due to A->C we get partial functional
dependency. Prime and non prime attributes Prime attribute : An
attribute, which is a part of the candidate-key, is known as a prime
attribute. Non-prime attribute : An attribute, which is not a part of the
prime-key, is said to be a non-prime attribute. Third Normal Form (3NF):-
7 Before understanding the third normal form let us first discuss the
concept of transitive dependency, super key and candidate key. Concept
of transitive dependency A functional dependency is said to be transitive
if it is indirectly formed by two functional dependencies. For example - X
-> Z is a transitive dependency if the following functional dependencies
hold true : X->Y Y->Z Concept of super key and candidate key Superkey :
A super key is a set or one of more columns (attributes) to uniquely
identify rows in a table. Candidate key : The minimal set of attribute which
can uniquely identify a tuple is known as candidate key.
Superkeys {RegID} {RegID, RollNo} {RegID, Sname} {RollNo,
Sname} {RegID, RollNo, Sname} Candidate keys {RegID} {RollNo} Third
normal form A table is said to be in the third normal form when, i) It is in
the second normal form.(i.e. it does not have partial functional
dependency). ii) It doesn't have transitive dependency. Or in other words
In other words 3NF can be defined as : A table is in 3NF if it is in 2NF and
for each functional dependency X-> Y at least one of the following
conditions hold : i) X is a super key of table. ii) Y is a prime attribute of
table BCNF:- 5 Boyce and Codd Normal Form is a higher version of the
Third Normal form. This form deals with certain type of anomaly that is
not handled by 3NF. A 3NF table which does not have multiple
overlapping candidate keys is said to be in BCNF. Or in other words, For a
table to be in BCNF, following conditions must be satisfied : i) R must be
in 3rd Normal Form ii) For each functional dependency ( X → Y ), X should
be a super key. In simple words if Y is a prime attribute then X can not be
non prime attribute.
Study material provided by: Vishwajeet Londhe

Join Community by clicking below links

Telegram Channel

https://t.me/SPPU_TE_BE_COMP
(for all engineering Resources)

WhatsApp Channel
(for all tech updates)

https://whatsapp.com/channel/
0029ValjFriICVfpcV9HFc3b

Insta Page
(for all engg & tech updates)

https://www.instagram.com/
sppu_engineering_update

You might also like