Sunteți pe pagina 1din 25

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Book Page Number 22 - 50

DATABASE MANAGEMENT SYSTEM ORACLE SQL AND PL/SQL

CHAPTER 2 Relational Algebra Normal Forms

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 22 - 28

CHAPTER 2 Relational Database


1 of 4

A relational database is based on the concept that the related data is organized and stored in a series of two dimensional tables known as relations A row is called a tuple

Pranab Kumar Das Gupta

A column is called as attribute A primary key is an attribute that determines all the other attributes within that row Each data item in a row is functionally dependent on the primary key
Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 22 - 28

CHAPTER 2 Relational Database


2 of 4

PRIMARY KEY A primary key is a minimal combination of field(s) that uniquely identifies the corresponding values of other field in a table. The field(s) of a primary key is known as prime attribute(s). The values of prime attributes can never be NULL FOREIGN KEY A foreign key is an attribute or set of attributes that appears in one table but is the primary key in other table. It is used to link two tables

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 22 - 28

CHAPTER 2 Relational Database


3 of 4

SUPER KEY A super key is combination of prime attribute(s) and one or more nonprime key attribute(s). It also uniquely identifies a record in a table. Primary key can be defined as super key with minimal attributes CANDIDATE KEY & ALTERNATE KEY Candidate key may be two or more keys that uniquely identifies record in a table. Any one in the candidate key can be chosen as a primary key. The remaining keys are called alternate key
Teaching Aid

Pranab Kumar Das Gupta

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 22 - 28

CHAPTER 2 Relational Database


4 of 4

SETS AND DOMAINS A domain is finite or infinite set from which values can be chosen CARTESIAN PRODUCT For two domains D1 and D2, the Cartesian product, denoted by D1 x D2 is defined as the set of all ordered pairs such that the first element is a member of D1 and second element is a member of D2 RELATIONS A Relation is defined as any subset of the Cartesian product of the domains
Teaching Aid

Pranab Kumar Das Gupta

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 28 - 32

CHAPTER 2 Relational Algebra


1 of 5

Two relation P and Q are said to be Union, Intersection and Difference compatible if both P and Q are of same degree n and the domain of the corresponding n attributes are identical UNION Selects the all tuples from the two relations without repetition INTERSECTION Selects the common tuples from the two relations DIFFERENCE Removes common tuples from the first relation

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL


Pranab Kumar Das Gupta PHI Learning Private Limited
Page 28 - 32

CHAPTER 2 Relational Algebra


2 of 5

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 28 - 32

CHAPTER 2 Relational Algebra


3 of 5

PROJECTION The projection operation yields a vertical subset of a relation

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 28 - 32

CHAPTER 2 Relational Algebra


4 of 5

SELECTION The selection operation yields a horizontal subset of a relation

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL


Pranab Kumar Das Gupta PHI Learning Private Limited
Page 28 - 32

CHAPTER 2 Relational Algebra


5 of 5

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 33 - 45

CHAPTER 2 Normal Forms


1 of 9

Normalization is the process of refining the data model built by the Entity-Relationship diagram. The decomposition of more complex data structures into flat files (relation) is known as normalization. A relation is said to be normalized if every value in the relation is atomic.

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 33 - 45

CHAPTER 2 Normal Forms


2 of 9

All relations in a relational database are required to be normalized to permit the simple retrieval and maintenance of data through updates, insertions and deletions. It also allows representing any pertinent relationship between entities. Normalization ensures minimum redundancies of data and removes anomalies for database activities.

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL


Pranab Kumar Das Gupta PHI Learning Private Limited
Page 33 - 45

UN-NORMALIZED FORM
3 of 9

CHAPTER 2 Normal Forms

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 33 - 45

CHAPTER 2 Normal Forms


4 of 9

FIRST NORMAL FORM:

All attributes are atomic

Pranab Kumar Das Gupta

Anomalies associated with First Normal Form

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 33 - 45

CHAPTER 2 Normal Forms


5 of 9

SECOND NORMAL FORM 1 NF and every non-key attribute is functionally dependent on the primary key

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 33 - 45

CHAPTER 2 Normal Forms


6 of 9

SECOND NORMAL FORM Elimination of anomalies encountered in First Normal Form Anomalies associated with Second Normal Form

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 33 - 45

CHAPTER 2 Normal Forms


7 of 9

THIRD NORMAL FORM Second Normal Form and no transitive dependency

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 33 - 45

CHAPTER 2 Normal Forms


8 of 9

THIRD NORMAL FORM Elimination of anomalies encountered in Second Normal Form

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 33 - 45

CHAPTER 2 Normal Forms


9 of 9

BOYCE - CODD NORMAL FORM If and only if every determinant is a candidate key FOURTH NORMAL FORM BCNF and has no nontrivial multi-values Dependencies FIFTH NORMAL FORM Fourth normal form and every join dependency in the table is a consequence of the candidate key of the table

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 46 - 48

CHAPTER 2 Short/ Objective Type Questions


1 of 5

Q1. What are the disadvantages of flat file database? Q2. How Cartesian product and relations are associated with each other? Q3. What is the difference between primary key and unique key? Q4. Define candidate key.

Pranab Kumar Das Gupta

Q5. Define division operation. Q6. Describe fully functional dependency with the help of an example. Q7. Define BCNF and Fourth normal form. Q8. Mention common type of anomalies during normalization process.

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 46 - 48

CHAPTER 2 Short/ Objective Type Questions


2 of 5 Q9. a. b. c. d. Which normal form is considered adequate for RDBMS design? 3 NF 2 NF BCNF 4 NF

Pranab Kumar Das Gupta

Q10. If every non-key attribute is functionally dependent on the primary key, the relation will be in a. 1 NF b. 2 NF c. 3 NF d. 4 NF Q11. The column of a table is referred to as the a. Tuple b. Entity c. Degree d. Attribute

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 46 - 48

CHAPTER 2 Short/ Objective Type Questions


3 of 5

Q12.Relation produced from an ER model will always be in a. 1 NF b. 2 NF c. 3 NF d. 4 NF Q13. Select True/ False statement a. An alternate key is a primary key that is not a candidate key b. An alternate key is a candidate key that is not a primary key c. An alternate key is a candidate key that is also a primary key Q14. An attribute of one table matching the primary key of another table, is called as a. Primary key b. Unique key c. Composite key d. Foreign key

Pranab Kumar Das Gupta

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 46 - 48

CHAPTER 2 Short/ Objective Type Questions


4 of 5

Q15. Oracle database server supports a. Client/ Server architecture b. Three-tier architecture c. None of the above Q16. Join correctly a. Projection b. Selection c. Join the following a. Yields a horizontal subset of a relation b. Selects a vertical subset of a relation c. Allows combining two relations

Pranab Kumar Das Gupta

Q17. A domain is/are a. Finite set from which values can be chosen b. Infinite set from which values can be chosen c. None of the above

Teaching Aid

Database Management System, Oracle SQL and PL/SQL

PHI Learning Private Limited

Page 46 - 48

CHAPTER 2 Short/ Objective Type Questions


5 of 5

Q18. Primary key can also be defined as a. Super key with minimal attributes b. Any one candidate key c. Combination of prime attributes d. Alternate key Q19. Disadvantage of normalization is/are a. Elimination of anomalies b. Increase in execution time because of join c. Overall reduction of space d. Minimal redundancy Q20. Transitive dependency is related to a. 1NF b. 2NF c. 3NF d. 4NF
Teaching Aid

Pranab Kumar Das Gupta

Database Management System, Oracle SQL and PL/SQL


Pranab Kumar Das Gupta
WORKOUT SECTION [Page 48 50]

PHI Learning Private Limited


Page 48 - 50

CHAPTER 2 Home Assignment

Teaching Aid

S-ar putea să vă placă și