1.) Super Key:-
→ It is defined as a set of attributes with a table that can uniquely identify each records within a table.
→ Super Key is a superset of candidate key.
Student Table
i.) std-id is unique in every row of date,hence it can be used to identity . each row uniquely.
ii.) stdid,Name name of two student can be same,but there id carit be same ,hence this combinate is also be a key.
iii.) Phone no is also unique, hence it can also be key.
2.) Condidate key
→ A Super key without redundancey.
→ It is not reducible further.
→ Minimum set of attributes used to uniquely differentiate reward of the table single or Combination of Minimal attributes.
→ A candidate key can never be NULL or empty and its value should be uniqe.
→ There can be more then one candidate key a table .
3.) Primary key
→ It is a candidate key that is most appopiate to become the main key for any table.
→ It is a key that can uniquely identify each record in a table.
→ eg:-
→ Primary key contain unique values must never be NULL.
→ It unique identify each record in table.
Note:-
→ Primary key are Mandatory for table each record must have a value for its primary key.
→ When choosing a primary key from the pool of Candidate key always choose single key over a composite key.
# Foreign key
→ It is an attribute which established relationship btn2 tables.
→ Foreign key is a field/collection of field in one table that refers to the primary key in another tables.
→ eg:-
→ we can say foreign key is responsible for connection between two tables.
→ Records cannot be inserted into a detail tables if corresponding record in the master table does not exits.
→ Record of master tables cannot be deleted if Corresponding records in the detail table actually exixts.
- Parent must be unique or primary key.
- Child may have duplicate/null unless it is specified.
- Constraint specified an child not in parent.
- Parent record can delete only if no child record exists.
- Parent cannot modity if child record exist.
# Secondary key
→ It is also know as alternate keys
→ We use it for indexing purpose for better & fast searching.
→ The candidate key other than a primary key is called Alternte key.
# Composition key
→ A key which has multiple attributes to uniquely identify raws in a table is called composite key.
→ But the attributes which together form the composite key are not a key independently or indivisually.
Here std-id & subject-id together will form the primary key.
# Relational Algebra
→ It is used in the designe of transaction & forms the conceptual basis of SQL.
→ It consist of operators &manipulators which apply to relations & give relation as a result but do not change the actual relation in db.
→ It is a procedural intermediate language used with in the DBMS.
<Figure.......>
# Advantages of relational Algebra
→ Mathematical background is the basic of many interesting development & basic of many interesting development & theorems.
→ Query optimizer substitute most efficient query.
Normalization & Redundary
<Figurw..........................>
# Insert Anomolies
-> Attributes cannot insert with thw presence of other attributes.
or,
we tried to insert data in record that doesnt exits at all.
# Delete Anomolies
→ Exists when certain attributes are lost because of deletion of one attributes.
# Update Anomolies
→ Partial update because of data inconsistency.
# Normalisation
→ Nornmalisation is a method to remove all these anomalies & bring the db to a consistent State.
# Normal Forms
→ Condition using keys & functional dependence of a relation to certify whether a relation schema is in a particular Normal form .
* 2NF,3NF,BCNF based on keys & FD'& of a relation schema.
* 4MF is based on keys & multivalue dependencies.
<Figure.......>
# Characteristics of Normalization
→ Scalar values in each fields.
→ Minimal use of Null value.
→ Absence of redundancy.
→ Minimal loss of information.
# First Normal Form (INF)
→ It is a property of a relation in relation db.
→ All attributes in a reltion must have only atomic (indivisible)domains.
# Requirement for INF
1.) Each tables has primary key minimal set of attribute which can uniquely identity a reward.
2.) The value in each coloum of a table are atomic (no multivalve attributes are allowed).
3.) There are not no repeating groups are allowed.
4.) It means two coloum o not store similar information in same information.
# 1NF Decomposition
a.) Place all items that appears in the repeating group in a new table.
b.) Designate a primary key for each new table produce.
c.) Duplicate in the new tabe the primary key of the table from which repeating group was extracted or vice versa.
0 Comments
Thank You ! For your love