You are on page 1of 9

DATABASE MANAGEMENT SYSTEM – CS3492

UNIT I: RELATIONAL DATABASE


Purpose of Database System – Views of data – Data Models – Database System
Architecture – Introduction to relational databases – Relational Model – Keys –
Relational Algebra – SQL fundamentals – Advanced SQL features – Embedded
SQL– Dynamic SQL
2 MARKS
1. What is Database Management System? Why do we need a DBMS?
 A Database Management System (DBMS) is collection of interrelated data and
various programs that are used to handle the data.
 The primary goal of DBMS is to provide a way to store and retrieve the required
information from the database in convenient and efficient manner.

2. What is the purpose of database management system?


The purpose of database management system is -
 Define the structure for storage of information.
 Provide mechanism for manipulation of information.
 In addition, the database systems must ensure the safety of information stored.
3. List any two advantages of database systems.
Following are the advantages of DBMS-
1) DBMS removes the data redundancy that means there is no duplication of data
in database.
2) DBMS allows to retrieve the desired data in required format.
3) Data can be isolated in separate tables for convenient and efficient use.
4) Data can be accessed efficiently using a simple query language.
4. Define data abstraction.
Data abstraction means retrieving only required amount of information of the
system. Hiding other background details.
5. What are three levels of data abstraction?
The three levels of data abstraction are -
1. Physical Level
2. Logical Level
3. View Level
6. Is it possible for several attributes to have same domain? Illustrate your answer with
suitable example.
A domain is the set of legal values that can be assigned to an attribute. Each
attribute in a database must have a well-defined domain; we can't mix values for
different domains in the same attribute. Hence it is not possible for several
attribute have same domain.
For example - Student domain has attributes RollNo, Name, Address. Simil
Employee domain has EmpID, Ename,Salary,Address. We can not define the s
domain for defining several attributes.
7. What is data model?
o It is a collection of conceptual tools for describing data, relationships amon
semantics (meaning) of data and constraints.
o Data model is a structure below the database.
8. What are different types of data models?
Various types of data models are -
(1) Relational Data Model
(2) Entity Relational Data Model
(3) Object Based Data Model
(4) Semi-structured Data Model
9. Name the categories of SQL commands.
The categories of SQL commands are -
(1) Data Definition Language (DDL)
(2) Data Manipulation Language (DML)
(3) Data Control Language (DCL)

10. What is data definition language? Give example.


 Data Definition Language (DDL) is a specialized language used to specify
database schema by a set of definitions.
 It is a language which is used for creating and modifying the structures of tab
views, indexes and so on.
 Some of the common commands used in DDL are -CREATE, ALTER, DROP.
11. Give brief description of DCL command.
DCL stands for Data Control Language. It includes commands such as GRANT and
REVOKE which mainly deals with the rights, permissions and other controls of the
database system.
12. Define the term tuple.
Tuple means a row present in the table
13. Why does SQL allow duplicate tuples in a table or in a query result?
• Data can be the same. Two people may have the same name. Since SQL is a
database where you store your data and data can be duplicate.
• But we can apply primary key constraints, Unique constraints or Distinct keyword
to identify the record uniquely Q.16
14. Why key is essential? Write the different types of keys.
• Keys are used to specify the tuples distinctly in the given relation.
• Various types of keys used in relational model are - Superkey, Candidate Keys, primary
keys, foreign keys.
15. Define primary key. Give example.
o The primary key is a candidate key chosen by the database designer to identify the
tuple in the relation uniquely.
o For example - Consider a Student database as Student (RollNo, Name, Address).
The primary key for this database is RollNo. The primary is underlined.
16. Define foreign key. Give example.
Foreign key is a single attribute or collection of attributes in one table that refers to the
primary key of other table.
For example - Consider a Student database as Student (RollNoName,Address) and
Course(Courseld, CourseName, RollNo). Here RollNo is a foreign key
17. What is the difference between primary key and foreign key?
Primary Key Foreign Key

Primary key is a column or a set of columns Foreign key is a column or a set of columns
that can be used to uniquely identify a row in that refer to a primary key or a candidate key
a table of another table

A table can have a single primary key A table can have multiple foreign keys that
can references different table
18. What is referential integrity?
 The referential integrity rule states that "whenever a foreign key value is used it must
reference a valid, existing primary key in the parent table".
Example: Consider the situation where you have two tables : Employees and Managers.
The Employees table has a foreign key attribute entitled Managed By, which points to the
record for each employee's manager in the Managers table.
19. What is domain integrity? Give example.
 Domain integrity ensures that all the data items in a column fall within a defined
 set of valid values. Each column in a table has a defined set of values, such as the set of
all numbers for zip (five-digit), the set of all character strings for name.

20. What are different types of integrity constraints used in designing relational
databases?
Different types of integrity constraints are-
(1) Entity Integrity Constraint
(2) Referential Integrity Constraint
(3) Domain Integrity Constraint
(4) Key Integrity Constraint
21. List the reasons why null value might be introduced into the database.
NULL special value provided by database in two cases-
i) When field values of some tuples are unknown (For eg. City name is not
assigned) and
ii) inapplicable (For eg. middle name is not present).
22. List various operators used in relational algebra.
Various operators used in Relational algebra are
(1) Selection Operator(σ)
(2) Projection Operator(π)
(3) Cartesian Product(×)
(4) Rename Operator(ρ)
23. Describe briefly any two undesirable properties that a database design may have.
The two undesirable properties that a database design may have -
(1) Repetition of data
(2) In-ability of representation of certain information in database.
24. Define data independence.
Data independence is an ability by which one can change the data at one level without
affecting the data at another level. Here level can be physical, conceptual or external.
25. Distinguish between physical and logical data independence.
PHYSICAL INDEPENDENCE LOGICAL INDEPENDENCE
It allows modification of physical It allows modification of conceptual schema
scheme without requiring any changes to without any changes requiring to external
the conceptual schema. schema.
For example: if there is any change in For example: Any change in the table
memory size of database server then it structure such as addition or deletion of some
will not affect the logical structure of any column does not affect user views
data object

26. What is meant by instance and Schema of the database?


• When information is inserted or deleted from the database then the database gets
changed. The collection of information at particular moment is called instances.
• The overall design of the database is called database.

27. Differentiate between Static SQL and Dynamic SQL?

STATIC SQL DYNAMIC SQL


SQL statement are compiled at compile SQL statement are compiled at run time
time
It is more efficient It is less efficient
It is less flexible It is more flexible
It is used in the situation where data is It is used in situation where data is
distributed uniformly distributed non uniformly
UNIT II

DATABASE DESIGN

Entity-Relationship model-E-R Diagrams - Enhanced-ER Model - ER-to-Relational


Mapping-Functional Dependencies- Non-loss Decomposition - Fint, Second, Third
Normal Forms, Dependency Preservation-Boyce Code Normal Form - Multi-valued
Dependencies and Fourth Normal Form - JoinDependencies and Fifth Normal Form
Fifth Normal Form

PARTA

1. What is an entity?
 It is a basic object represented by E-R model
 It is a thing in real world with an independent existence.
 An entity can have
 Physical existence - employee o Conceptual existence - company, department

2. Define the terms i) Entity type ii) Entity set


Entity type:An entity type defines a collection of entities that have the same attributes.
Entity set: The set of all entities of the same type is termed as an entity set.

3. What are attributes? Give example.


An entity is represented by a set of attributes. Attributes are descriptive properties
possessed by each member of an entity set.
Example: Attributes of customer entity are customer name, customer id, Customer Street,
customer city.
4. What is a relationship? Give example.
A relationship is an association among several entities. Example: A depositor relationship
associates a customer with each account that he/she has.

5. Define the terms i) Entity set ii) Relationship set


Relationship set: The set of all relationships of the same relationship type is termed as a
relationship set.
Entity set: The set of all entities of the same entity type is termed as an entity set.

6. Define strong entity set and weak entity set.


Weak entity set - Entity set that belong to the entity type that do not have key attributes
of their own are called weak entity sets. Ex. DEPENDENTS (NAME, RELATION, ADDRESS,
PHNO)
Strong entity set - Entity set that belong to the entity type that has key attributes of their
own are called strong entity sets. Ex.EMPLOYEE(EMPNO, NAME, SALARY,ADDRESS,
PHNO)
7. Define single-valued and multi-valued attributes.
Single-valued attribute: Attribute with single value for a particular entity.
Ex. AGE attribute for PERSON entity.
Multi-valued attribute: Attribute with multiple values for a particular entity.
Ex. PHNO attribute for PERSON entity.
8. What are stored, derived and composite attributes?
Stored Attribute: The attributes stored in a data base are called stored attributes.
Ex. DOB
Derived Attribute: The attributes that are derived from the stored attributes are
called derived attributes. Ex. AGE (derived from DOB)
Composite Attribute: The attributes that can be divided into subparts, which
represent basic attributes with independent meaning. Ex. Address(Number, Street, City)
9. What is meant by the degree of relationship type/set?
The degree of relationship type/set is the number of participating entity types/sets

10. Define cardinality ratio. (or) Define Mapping cardinality.


Mapping cardinalities or cardinality ratios express the number of entities to which another
entity can be associated.
Mapping cardinalities must be one of the following:
One to one (1:1) (Employee - manages - Department)
One to many (1:N) (Dependent - dependents of- Employee)
Many to one (N:1) (Project-controlled_by-department)
Many to many (N:N) (Employee - works_on - Project)

11. What are the two types of participation constraint?


Total Participation: The participation of an entity set E in a relationship set R is said
to be total if every entity in E participates in at least one relationship in R. Ex. EMPLOYEE
in WORKS FOR Partial Participation: If only some entities in E participate in relationships
in R. the participation of entity set E in relationship R is said to be partial. Ex. EMPLOYEE
MANAGES

12. Define attribute inheritance.


a. Attributes of superclass are inherited by the subclasses in the process of
specialization/generalization.
b. Superclass EMPOYEE attributes are inherited by the subclasses TECHNICIAN and
ENGINEER.

13. What is an EER Model?


An Enhanced/Extended Entity Relationship Model includes all the modeling concepts of
ER model and additionally includes the concepts of subclass and superclass and the
related concepts of specialization and generalization.
14. What is an anomaly? Mention its types.
 Anomalies cause redundant work to be done while inserting and modifying a relation,
and may cause accidental loss of information during deletion from a relation.
 Types of Update Anomalies
o Insertion anomalies:
o Deletion Anomalies
o Modification anomalies

15. What is a deletion anomaly?


Deletion anomaly occurs if it is not possible to delete certain information
from the relation without losing some other unrelated information as well.
Ex. EMP_DEPT(empno,ename,salary.dno,dname)
If an employee detail is deleted, department detail is also lost.

16. Define Functional Dependency (or) What are functional dependencies?


A Functional dependency denoted by X->Y, between two sets of attributes X and
Y that are subsets of relation schema R specifies a constraint:

For a relation state r of R, if tl and 12 are any two tuples, If tl [X]=12[X], then
tl[Y]=t2[Y]

i. e., Y is functionally determined by X.


Ex. Rollno-> Name

17. Define Trivial Functional Dependency.


A Functional dependency X^Y is trivial if the dependent attribute set Y is a subset of the
determinant attribute set X i.e., YC_X
Ex. (Stud No, Stud_Name} ^ {Stud_Name}

18. What is a canonical cover (or) minimal cover and minimal set?
Minimal Cover: minimal (or) canonical cover of a set of functional dependencies E is a
set of functional dependencies F that satisfies the property that every dependency in Eis
in the closure F+ of F.
Minimal Set: A minimal set of dependencies is a set of dependencies in a standard or
canonical form and with no redundancies.
19. Define Normalization.
Normalization of data can be considered as a process of analyzing the given relation
schemas based on their functional dependencies and primary keys to achieve
the properties of
o minimizing redundancy
o minimizing the anomalies

20. What is the need for normalization?


Normalization of data enables to achieve desirable properties of
o minimizing redundancy
o minimizing the insertion, deletion and update anomalies

21. What is a normal form?


The normal form of a relation refers to the highest normal form condition that i meets, and hence
indicates the degree to which it has been normalized.
22. What are the properties of decomposition?
a. Non-additive join or Loss-less join property
b. Dependency preservation property

23. What is loss- less join property?


Loss-less join (or) non-additive join property guarantees that spurious tuples not
generated and recovery of any instance of the decomposed relation is possible respect to
the relation schemas created after decomposition.
R=RI UR2 U... U Rn

24. What is mapping cardinality?


Mapping cardinality express the number of entities to which another entity can be
associated via a relationship set

25. What is functional dependence?


A Functional dependency is denoted by X Y between two sets of attributes X and Y that
are subsets of R specifies a constraint on the possible tuple that can form a relation state r
of R. The constraint is for any two tuples t1 and 12 in if t1 [X]=t2[X] then they lace
t1[Y]=t2[Y]. This mean the value of X component of a tuple uniquely determines the
value of component Y.

26. What is object oriented data model?


The object-oriented data model is another data model that has seen increasing attention.
The object-oriented model can be seen as extending the E-R model with notions of
encapsulation, methods and object identity

You might also like