Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Assignment A

1. Flat file data bases are not usually accessed. Since they belong with offline entities and form the
machinery of operating systems and local devices. Also there are no transactions in a flat file data
base is disadvantageous to a network user who is accessing a multi access, multitasking relational
online database which can be viewed from many different aspects.
2. An RDBMS enables data sharing between users. At the same time you can ensure consistency of
data across multiple tables by using integrity constraints. An RDBMS uses various types of data
integrity constraints. These types include entity, column, referential and user defined constraints.
The constraint entity ensures uniqueness of rows and the constraint column ensures consistency of
the type of data with in a column. The other type referential ensures validity of foreign keys and
user defined constraints are used to enforce specific business rules.
3.

INTERNAL SCHEME

EXTERNAL SCEME

-The Internal scheme mainly describes the


physical storage structure of the database.

-An External scheme describes the specific users


view data and the specific methods and
constraints connected with this information.

-Internal scheme describes the data from a view


very close to the computer or system in general.

-Each External schema describes the part of the


database that a particular user group is
interested in and hides the rest of the database
from that database.

4.

Data is collection of facts upon which a conclusion is based .


Data has cost attached to it.
Data can be represented in terms of numbers, characters, pictures, sounds and figures.

5.

A view is a virtual table based on the result-set of a select statement. A view contains rows and
columns just like a real table. The fields in a view are fields from one or more real tables in the
database. We can add SQL functions WHERE and JOIN statements to a view and present the data
as if the data were coming from a single table
There are two types of views. Updateable view and non-updatable view.
Using updateable view value of the table can be modified where as in case of non-updateable
view base table cannot be updated
CREATIVE VIEW view name AS
SELECT column name (s)
FROM table name

6.

Union operation means to group the given sets. Whereas intersection set operation means to pick
out the common elements from the given sets.

Example:
Set A = {1,2,3,4,5}
Set B = {1,4,5,6,7,8}
Union of set A and set B is A U B = {1,2,3,4,5,6,7,8}
Intersection of set A and Set B is A B = {1,4,5}

Assignment B
1. Database management system is a logical collection of software programs which facilitates large,
structured sets of data to be stored, modified, extracted and manipulated in different ways.
Database Management System (DBMS) also provides security features that protect against
unauthorized users trying to gain access to confidential information and prevent data loss in case of
a system crash. Depending on the specific users requirement, users are allowed access to either all,
or specific database subschema, through the use of passwords. DBMS is also responsible for the
databases integrity, ensuring that no two users are able to update the same record at the same
time, as well as preventing duplicate entries, such as two employees being given the same employee
number. The main objectives of the DBMS are Data availability, data integrity, privacy, management
control and data independence.
There DBMS has four main components. They are
a. Database engine
Database Engine is the foundation for storing, processing, and securing data. The Database Engine
provides controlled access and rapid transaction processing to meet the requirements of the most
demanding data consuming applications within your enterprise
b. Data dictionary
A data dictionary is a reserved space within a database which is used to store information about the
database itself. A data dictionary is a set of table and views which can only be read and never
altered. Most data dictionaries contain different information about the data used in the enterprise.
c. Query processor
A relational database consists of many parts, but at its heart are two major components: the storage
engine and the query processor. The storage engine writes data to and reads data from the disk. It
manages records, controls concurrency, and maintains log files. The query processor accepts SQL
syntax, selects a plan for executing the syntax, and then executes the chosen plan. The user or
program interacts with the query processor, and the query processor in turn interacts with the
storage engine. The query processor isolates the user from the details of execution.
d. Report writer
Report writer is also called as report generator, a program, usually part of a database management
system that extracts information from one or more files and presents the information in a specified
format. Most report writers allow you to select records that meet certain conditions and to display
selected fields in rows and columns.

2. ER Model:
The Entity - Relationship Model (E-R Model) is a high-level conceptual data model developed by
Chen in 1976 to facilitate database design. Conceptual Modeling is an important phase in designing
a flourishing database. A conceptual data model is a set of concepts that describe the structure of a
database and associated retrieval and update transactions on the database. A high level model is
chosen so that all the technical aspects are also covered. So to sum up, the Entity-Relationship (E-R)
Model is based on a view of a real world that consists of set of objects called entities and
relationships among entity sets which are basically a group of similar objects. The relationships
between entity sets is represented by a named E-R relationship and is of 1:1, 1: N or M: N type
which tells the mapping from one entity set to another.
The E-R model is shown diagrammatically using Entity-Relationship (E-R) diagrams which represent
the elements of the conceptual model that show the meanings and the relationships between those
elements independent of any particular DBMS and implementation details.
ER model for a Hospital Management System consists of patient, doctor, employee, treatment,
room and maintenance information. The ER diagram is as below.

3. Normalization:
Normalization theory is built based on the normal forms concepts and notion of Dependency.
Normalization reduces unnecessary repetition of the data i.e. reduces redundancy. This can cause
problems with storage and retrieval of data. During the process of normalization, dependencies can
be identified, which can cause problems during deletion and updation. Normalization helps in
simplifying the structure of schema and tables. There are five Normal forms in the normalization
theory. They are:
a) First Normal Form:
A relation is in 1st Normal form (1NF) if and only if, in every legal value of that relation, every tuple
contains exactly one value for each attribute. 1NF is the simplest form but the relations have a
number of discrepancies. So, first normal form alone will not serve the purpose of building a good
database.
b) Second Normal Form:
A relation is in 2NF if and only if it is in 1NF and every non key attribute is fully functionally
dependent on the primary key. Here it has been assumed that there is only one candidate key,
which is in turn the primary key.
c) Third Normal Form:
A relation is in 3NF if only if it is in 2NF and every non-key attribute is non-transitively dependent on
the primary key.
d) Boyce-Codd Normal Form:
The previous normal forms assumed that there was just one candidate key in the relation and that
key was also the primary key. Another class of problems arises when this is not the case. Very often
there will be more candidate keys than one in practical database designing situation. This normal
form will look in adequately with the case of relations that had two or more candidate keys, and
that the candidate keys were composite, and they overlapped.
e) Fifth Normal Form:
It seems that the sole operation necessary or available in the further normalization process is the
replacement of a relation in a non-loss way by exactly two of its projections. This assumption has
successfully carried us as far as 4NF.
4. The ER diagram to model the cities, counties and states in US is as below.

Assignment C
1. b (Structured Query Language)
2. c (students and courses, currency and bank account, flight and tourist)
3. c (is used for creating queries which divide items into groups according to a given
attribute and an aggregate function)
4. b (networked, hierarchical, relational)
5. b (list different values only once)
6. a (Database Management System)
7. b (answer the question "How many...?")
8. b (Data Manipulation Language)
9. b (scientific)
10. c (records, fields, values)
11. b (create a new query)
12. b (Data dictionary)
13. d (Mining)
14. c (it stores user data)
15. c (data about data)
16. b (data dictionary)
17. b (data integrity)
18. c (data storage management)
19. c (DBMS)
20. a (Tree Structure)
21.
CREATE TABLE LIBRARY
(NO
NUMBER(10) NOT NULL,
TITLE
VARCHAR2(50) NOT NULL,
AUTHOR VARCHAR2(50) NOT NULL,
TYPE
VARCHAR2(10),
PUB
VARCHAR2(50),
QTY
NUMBER(10),
PRICE
NUMBER(10) );
ALTER TABLE LIBRARY
ADD ( CONSTRAINT LIBRARY_PK PRIMARY KEY (NO));
22.
23.
24.
25.

SELECT * FROM LIBRARY WHERE TYPE=PROG AND PUB=BPB;


SELECT TITLE FROM LIBRARY WHERE PRICE > 130 ORDER BY QTY;
SELECT TITLE FROM LIBRARY ORDER BY PRICE ASC;
SELECT NO,PRICE,(PRICE*1.25) AS MISPLACEMENT_CHARGES FROM
LIBRARY;
26. SELECT SUM(QTY) FROM LIBRARY WHERE PUB=PHI;

27.
28.
29.
30.
31.
32.
33.
34.
35.

INSERT INTO LIBRARY VALUES (11,'Control Systems','Praveena','PROG','BPB',3,300);


SELECT SUM(QTY),TYPE FROM LIBRARY GROUP BY TYPE;
ALTER TABLE LIBRARY ADD (NO_OF_COPIES NUMBER(10));
UPDATE LIRARY SET NO_OF_COPIES=2;
SELECT COUNT(DISTINCT PUB) FROM LIBRARY;
DROP TABLE LIBRARY;
6
40
The query will give an error because the column that is part of select clause is not part of
group by.
36. 145
37.
No
Title
Author
Type
Pub
Qty
Price
5
Mastering C++
Manav
PROG BPB
3
295
6
Guide Network
Robin
NET
ZPress
3
200
8
DOS Guide
Ankit
OS
PH1
3
175
9
Basic for Beginners Ankita
PROG BPB
3
40
38.
39.
40.

Title ( Type = PROG (Library


Pub ( Type = FND (Library
Type ( PUB = PHI (Library

You might also like