Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
61 views

Assignment - 01dbms

The document provides answers to multiple questions related to database concepts. It defines external, internal, and conceptual schemas and how they relate to logical and physical data independence. It translates an ER diagram to relational tables with key constraints. It provides short notes on NULL values, database views, constraints, and weak entities. It explains the differences between aggregation vs generalization and file system vs DBMS. It constructs an ER diagram for a hospital database. It defines the ACID properties of transactions in databases and how they ensure consistent concurrency with examples. It finds the minimal set of candidate keys for a given relation with attributes and functional dependencies.

Uploaded by

Pragyakta Singh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Assignment - 01dbms

The document provides answers to multiple questions related to database concepts. It defines external, internal, and conceptual schemas and how they relate to logical and physical data independence. It translates an ER diagram to relational tables with key constraints. It provides short notes on NULL values, database views, constraints, and weak entities. It explains the differences between aggregation vs generalization and file system vs DBMS. It constructs an ER diagram for a hospital database. It defines the ACID properties of transactions in databases and how they ensure consistent concurrency with examples. It finds the minimal set of candidate keys for a given relation with attributes and functional dependencies.

Uploaded by

Pragyakta Singh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment :01

1). Explain the difference between external, internal, and conceptual schemas. How are these different
schema layers related to the concepts of logical and physical data independence?

Ans:- External Schema represents data accessed by end-users or application programs, it provides
customized information to the end-users.

Conceptual Schema is a high-level description of a business's informational needs which represent the
logical , how data is stored in a database is represented by conceptual schema. Conceptual schema
provides information to the external schema which is customized and is accessed by application
programs.

Internal Schema: - is a very low-level representation of the entire database which represents the
physical storage of data on a disk or a physical storage device. Conceptual schema maps internal schema
data to the external schema.

2). Translate ER diagram given below to Relational tables (You have to mention the relational schemas
and key constraints only).

Ans:- patients (patient-id, name, insurance, date-admitted, date-checked-out)

doctors (doctor-id, name, specialization)

test (testid, testname, date, time, result)

doctor-patient (patient-id, doctor-id)

test-log (testid, patient-id)

performed-by (testid, doctor-id)

3.Write short notes on the following:


a). NULL Values.
b). Database Views.
c).Different constraints in RDBMS .
d).Weak Entities.
Ans:-a). A NULL value is a special marker used in SQL to indicate that a data value does not exist in the
database. In other words, it is just a placeholder to denote values that are missing or that we do not
know.

b).A database view is a searchable object in a database that is defined by a query. Though a view doesn't
store data, some refer to a views as “virtual tables,” you can query a view like you can a table. A view
can combine data from two or more table, using joins, and also just contain a subset of information.

c).Constraints are the rules enforced on the data columns of a table. These are used to limit the type of
data that can go into a table. This ensures the accuracy and reliability of the data in the database.
Following are some of the most commonly used constraints available in SQL:

 NOT NULL constraint:− Ensures that a column cannot have NULL value.
 DEFAULT constraint: − Provides a default value for a column when none is specified.
 UNIQUE constraint:− Ensures that all values in a column are different.
 PRIMARY key :− Uniquely identifies each row/record in a database table.
 FOREIGN key:− Uniquely identifies a row/record in any of the given database table.
 CHECK key:− The CHECK constraint ensures that all the values in a column satisfies certain
conditions.
 INDEX:− Used to create and retrieve data from the database very quickly.
 Dropping Constraints:Any constraint that you have defined can be dropped using the ALTER
TABLE command with the DROP CONSTRAINT option.
 Integrity Constraints:--Integrity constraints are used to ensure accuracy and consistency of the
data in a relational database. Data integrity is handled in a relational database through the
concept of referential integrity.

d). Weak Entities: A weak entity is an entity that cannot be uniquely identified by its attributes alone;
therefore, it must use a foreign key in conjunction with its attributes to create a primary key. The foreign
key is typically a primary key of an entity it is related to.

4).Explain the difference between the following pairs of terms :


a). Aggregation vs. Generalization
b). File System vs. DBMS

Ans: AGGREGATION:

 Aggregation relates instances (involves two or more different group).


 Two distinct objects are involved, one of them is a part of the other

 An aggregation tree is composed of object instances that are all part of a composite object.
 "part-of relationship".

GENERALIZATION:

 Generalization relates classes (a way to structure the description of a single object)


 It is a way of structuring the description of a single object.
 An generalization tree is composed of classes that describe an object
 a-kind-of'is-a relationship.

FILE SYSTEM:

 A file system is a software that manages and organizes the files in a storage medium. It controls
how data is stored and retrieved.
 The file system provides the details of data representation and storage of data.
 Storing and retrieving of data can't be done efficiently in a file system.
 It does not offer data recovery processes.
 The file system doesn't have a crash recovery mechanism.
 Protecting a file system is very difficult.
 In a file management system, the redundancy of data is greater.
 Data inconsistency is higher in the file system.
 The file system offers lesser security.
 File System allows you to stores the data as isolated data files and entities.

DBMS :

 DBMS or Database Management System is a software application. It is used for accessing,


creating, and managing databases.
 DBMS gives an abstract view of data that hides the details
 DBMS is efficient to use as there are a wide variety of methods to store and retrieve data.
 There is a backup recovery for data in DBMS.
 DBMS provides a crash recovery mechanism
 DBMS offers good protection mechanism.
 The redundancy of data is low in the DBMS system.
 Data inconsistency is low in a database management system.
 Database Management System offers high security.
 Database Management System stores data as well as defined constraints and interrelation.

5). Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors. Associate
with each patient a log of the various tests and examinations conducted.

Ans:- figure below-


6). What are ACID properties of transaction in data base? How they ensure consistent concurrency
explain with suitable examples.

Ans:- ACID Properties: A transaction is a very small unit of a program and it may contain several lowlevel
tasks. A transaction in a database system must maintain Atomicity, Consistency, Isolation, and Durability
− commonly known as ACID properties − in order to ensure accuracy, completeness, and data integrity.

Atomicity − This property states that a transaction must be treated as an atomic unit, that is, either all of
its operations are executed or none. There must be no state in a database where a transaction is left
partially completed. States should be defined either before the execution of the transaction or after the
execution/abortion/failure of the transaction.

Consistency − The database must remain in a consistent state after any transaction. No transaction
should have any adverse effect on the data residing in the database. If the database was in a consistent
state before the execution of a transaction, it must remain consistent after the execution of the
transaction as well.

Durability − The database should be durable enough to hold all its latest updates even if the system fails
or restarts. If a transaction updates a chunk of data in a database and commits, then the database will
hold the modified data. If a transaction commits but the system fails before the data could be written on
to the disk, then that data will be updated once the system springs back into action.

Isolation − In a database system where more than one transaction are being executed simultaneously
and in parallel, the property of isolation states that all the transactions will be carried out and executed
as if it is the only transaction in the system. No transaction will affect the existence of any other
transaction.

8). We are given relation R with attributes A, B, C, D, E, F, and the FDs

A->BC
B ->E
CD ->EF

Find the minimal set of candidate keys.


Ans:- Given figure :

You might also like