KINGS COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING QUESTION BANK Subject: Database Management System Year/Sem : II / IV
UNIT I INTRODUCTION AND CONCEPTUAL MODELLING PART-A ( 2 Marks) 1. Define Entity and entity sets. •
•
•
•
•
An entity is an object that exists and is distinguishable from other objects. For instance, John Harris with S.I.N. 890-12-3456 is an entity, as he can be uniquely identified as one particular person in the universe. An entity may be concrete (a person or a book, for example) or abstract (like a holiday or a concept). An entity set is a set of entities of the same type (e.g., all persons having an account at a bank). Entity sets need not be disjoint. For example, the entity set employee (all employees of a bank) and the entity set customer (all customers of the bank) may have members in common. An entity is represented by a set of attributes. ○ ○
•
E.g. name, S.I.N., street, city for ``customer'' entity. The domain of the attribute is the set of permitted values (e.g. the telephone number must be seven positive integers).
Formally, an attribute is a function which maps an entity set into a domain. ○
Every entity is described by a set of (attribute, data value) pairs.
○
There is one pair for each attribute of the entity set.
○
E.g. a particular customer entity is described by the set {(name, Harris), (S.I.N., 890-123456), (street, North), (city, Georgetown)}.
An analogy can be made with the programming language notion of type definition. •
The concept of an entity set corresponds to the programming language type definition.
•
A variable of a given type has a particular value at a point in time.
•
Thus, a programming language variable corresponds to an entity in the E-R model.
Figure 2-1 shows two entity sets. We will be dealing with five entity sets in this section: •
•
•
branch, the set of all branches of a particular bank. Each branch is described by the attributes branch-name, branch-city and assets. customer , the set of all people having an account at the bank. Attributes are customername, S.I.N., street and customer-city. employee , with attributes employee-name and phone-number .
•
•
account , the set of all accounts created and maintained in the bank. Attributes are accountnumber and balance. transaction, the set of all account transactions executed in the bank. Attributes are transactionnumber , date and amount .
2. Define role in Database Administrator. A Database Adminstrator, Database Analyst or Database Developer is the person responsible for managing the information within an organization. As most companies continue to experience inevitable growth of their databases, these positions are probably the most solid within the IT industry. In most cases, it is not an area that is targeted for layoffs or downsizing. On the downside, however, most database departments are often understaffed, requiring adminstrators to perform a multitude of tasks. Depending on the company and the department, this role can either be highly specialized or incredibly diverse. The primary role of the Database Administrator is to adminster, develop, maintain and implement the policies and procedures necessary to ensure the security and integrity of the co rporate database. Sub roles within the Database Administrator classification may include security, architecture, warehousing and/or business analysis. Other primary roles will include: •
Implementation of data models
•
Database design
•
Database accessibility
•
Performance issues
•
Capacity issues
•
Data replication
•
Table Maintainence
Database Administrators are often on-call and required to work as needed. This position carries an enormous eno rmous amount of responsibility.
3. Define DBMS.what are the advantages of DBMS? A Database Management System (DBMS) is a set of computer of computer programs that controls the creation, maintenance, and the use of the database in a computer platform or of an organization and its end users. users. It allows organizations to place control of organization-wide database development in the hands of database of database administrators (DBAs) and other specialists. A DBMS is a system software package that helps the use of integrated collection of data records and files known as databases. It allows different user application programs to easily access the same database. DBMSs may use any of a variety of database of database models, models, such as thenet thenetwor work k mod model el or relational or relational model. model. In large systems, a DBMS allows users and other software to store and retrieve data in astructured astructured way. Instead of having to write computer programs to extract information, user can ask simple questions in a query language. language. Thus, many DBMS packages provide Fourthgeneration programming language (4GLs) and other application development features. It helps to specify the logical organization for a database and access and use the information within a database. It provides facilities for controlling data access, access, enforcing data integrity, integrity, managing concurrency controlled, restoring database. Using a DBMS to manage data has many advantages: Data independence: Application programs should be as independent as possible from details of data representation and storage. The DBMS can provide an abstract view of the data to insulate application code from such details. Efficient data access: A DBMS utilizes a variety of sophisticated techniques to store and retrieve data eficiently. This feature is especially important if the data is stored on ex ternal storage devices. Data integrity and security: If data is always accessed through the DBMS, the DBMS can enforce integrity constraints on the data. For example, before inserting salary information for an employee, the DBMS can check that the department budget is not exceeded. e xceeded. Also, the DBMS can enforce access controls that govern what data is visible to different classes of users.
Data administration: When several users share the data, centralizing cen tralizing the administration of data can offer significant improvements. Experienced professionals who understand the nature of the data being managed, and how di erent groups of users use it, can be responsible for organizing the data representation to minimize redundancy and for retuning the storage of the data to make retrieval efficient. Concurrent access and crash recovery: A DBMS schedules concurrent accesses to the data in such a manner that users can think of the data as being accessed by only one user at a time. Further, the DBMS protects users from the effects of system failures. Reduced application development time: Clearly, the DBMS supports many important functions that are common to many applications accessing data stored in the DBMS. This, in conjunction with the high-level interface to the data, facilitates quick development of applications. Such applications are also likely to be more robust than applications developed from scratch because many important tasks are handled by the DBMS instead of being implemented by the application.
Given all these advantages, is there ever a reason not to use a DBMS? A DBMS is a complex piece of software, optimized for certain kinds of workloads (e.g., an swering complex queries or handling many concurrent requests), and its performance may not be adequate for certain specialized applications. Examples include applications with tight real-time constraints or applications with just a few well-defined critical operations for which eficient custom code must be written. Another reason for not using a DBMS is that an application may need to manipulate the data in ways wa ys not supported by the query language. In such a situation, the abstract view of the data presented by the DBMS does not match the application’s needs, and actually gets in the way. As an example, relational databases do not support flexible analysis of text data (although vendors are now extending their products in this direction). If specialized performance or data manipulation requirements are central to a n application, the application may choose cho ose not to use a DBMS, especially if the added benefits’ of a DBMS (e.g., flexible querying, security, concurrent access, and crash recovery) are not required. In most situations calling for large-scale data management, however, DBMSs have become an indispensable tool.
4. What is meant by E-R model? Why? In software engineering, engineering, an Entity-Relationship Model (ERM) is an abstract and conceptual representation of data of data.. Entity-relationship modeling is a database modelingmethod, modelingmethod, used to produce a type of conceptual of conceptual schema or semantic or semantic data model of a system, often a relational database, database, and its requirements in a top-down fashion. Diagrams created using this process are called entity-relationship diagrams, diagrams, or ER ER diagrams or ERDs ERDs for short. The definitive reference for entity relationship modelling is generally given as Peter Chen' Chen's 1976 paper [1]. However, variants of the idea existed previously (see for example A.P.G. Brown[2]) and have been devised subsequently. The first stage of information of information system design uses these models during the requirements analysis to describe information needs or the type of information of information that is to be stored in a database database.. The data modeling technique can be used to describe any ontology ontology(i.e. (i.e. an overview and classifications of used terms and their relationships) for a certain area of interest. interest. In the case of the design of an information system that is based on a database, the conceptual data model is, at a later stage (usually called logical design), mapped to a logical data model, model, such as the relational model;; this in turn is mapped to a physical model during physical design. Note that sometimes, both of these phases model are referred to as "physical design". There are a number of conventions for entity-relationship diagrams (ERDs). The classical notation mainly relates to conceptual modeling. modeling. There are a range of notations employed in logical and physical database design, design, such as IDEF1X.
The building blocks: entities, relationships, and attributes
Two related entities
An entity with an attribute
A relationship with an attribute
Primary key
An entity may be defined as a thing which is recognized as being capable of an independent existence and which can be uniquely identified. An entity is an abstraction from the complexities of some domain. When we speak of an entity we normally speak of some aspect of the real world which can be distinguished from other aspects of the real world.[3] An entity may be a physical object such as a house or a car, an event such as a house sale or a car service, or a concept such as a customer transaction or order. Although the term entity is the one most commonly used, following Chen we should really distinguish between an entity and an entity-type. An entity-type is a category. An entity, strictly speaking, is an instance of a given entity-type. There are usually many instances of an en tity-type. Because the term entity-type is somewhat cumbersome, most people tend to use the term entity as a synonym for this term. Entities can be thought of as nouns nouns.. Examples: a computer, an employee, a song, a mathematical theorem. Entities are represented as rectangles. A relationship captures how two or more entities are related to one another. Relationships can be thought of asverbs as verbs,, linking two or more nouns. Examples: an owns relationship between a company and a computer, a supervises relationship between an employee and a department, a performs a performs relationship between an artist and a song, proved relationship between a mathematician and a theorem. Relationships are represented as diamonds, connec ted a proved relationship by lines to each of the entities in the relationship. The model's linguistic aspect described above is utilized in the database query language ERROL ERROL.. Entities and relationships can both have attributes. Examples: an employee entity might have a Social Security Number (SSN) Number (SSN) attribute; the proved the proved relationship relationship may have a date attribute. Attributes are represented as ellipses connected to their owning entity sets by a line. Every entity (unless it is a weak entity) entity) must have a minimal set of uniquely u niquely identifying attributes, which is called the entity's prim p rimar ary y ke key y. Entity-relationship diagrams don't show single entities or single instances of relations. Rather, they show entity sets and relationship sets. Example: a particular song is song is an entity. The collection of all songs in a database is an entity set. The eatenrelationship eatenrelationship between a child and her h er lunch is a single relationship. The set of all such child-lunch relationships in a database is a relationship set. In o ther words, a relationship set corresponds to a relation in mathematics,, while a relationship corresponds to a member of the relation. mathematics Certain cardinality constraints on relationship sets may be indicated as well.
5. Give some shapes for which purpose in E-R model? 6. What is meant by Aggregation in E-R? 7. Define File system. 8. When we realize DBMS better to FS? 9. How we overcome inconsistency problem? 10. Example query for DDL and DML? 11. Compare Procedural and Non Procedural languages? 12. Define super key and candidate keys with suitable example. 13. Define instances and schemas.
14. Define data dictionary. 15. Define procedural language and non procedural language. PART-B 1. a. Explain the architecture of DBMS (8) b. Compare File systems with database systems . (8) 2. What is meant by Relational calculus? Query examples for touples and domain relational calculus? (16) 3. Explain all types of data models (16) 4. Explain E-R Model concept and extended E-R model. (16) 5. Define relational algebra. With suitable example. (16) 6. Roles of data base administrator and the details of aggregate function queries (16) 7. a. With relevant examples discuss the following in SQL i. DDL ii. DML iii. DCL iv. Views (8) b. Construct an ER diagram for a car insurance company that has a set of customers, each of whom owns one/more cars. Each car has associated with it zero to any number of recorded accidents. (8) UNIT II RELATIONAL MODEL PART- A ( 2 Marks) 1. Name the different types of joins supported in SQL 2. Why it is necessary to decompose a relation? 3. Define view and their syntax 4. What are the types of join operation. 5. What is meant by 1NF? 6. What is meant by 2NF? 7. Why we go for decomposition? 8. Define Domain constraints, General constraints. 9. How we provide lossless join? 10. What is meant by Functional dependency? PART-B 1. What is normalization? Explain all Normal forms. (16) 2. a) What is meant by Selection and projection used in Relational algebra? (8) b) How we made lossless and lossy-join in relational model? (8) 3. a) Define class Hierarchies and Aggregation? (8) b) Write about decomposition preservation algorithm for all FD’s. (8) 4. a)Explain the strength and weakness of the Triggers mechanism (8) and update views in stored procedure. b)What is meant by Integrity and security? (8) Employee(empno,name,office,age) Books(isbn,title,authors,publisher) Loan(empno,isbn,date) Write the following queries in relational algebra. a. Find the names of employees who have borrowed a book published by McGraw-Hill. (4) b. Find the names of employees who have borrowed all books
published by McGraw-Hill. (4) c. Find the names of employees who have borrowed more than five different books published by McGraw-Hill. (4) d. For each publisher, find the names of employees who have borrowed more than five books of that publisher. (4) 6.Explain the details about embedded and dynamic SQL (16) 7.Explain functional dependency concepts (16) UNIT III DATA STORAGE AND QUERY PROCESSING PART-A ( 2 Marks) 1. What is meant by fixed and variable record length? 2. How heap files are formed as page directory? 3. What is meant by RAID? 4. How we done Buffer replacement policy? 5. List out Disk components. 6. Define Buffer size. 7. Why we not stored everything in main memory? 8. DBMS Vs. OS file system. 9. What is meant by Disk storage. 10. What is meant by redundant data. PART-B 1. a) What is Raid? List the different levels in Raid technology and explain its features (8) b) Discuss about primary file storage system (8) 2. Explain static and dynamic Hashing Techniques? (16) 3. Briefly describe about B+ tree index file structure. (16) 4. What are the steps involved in Query processing? How would you (16) estimate the cost of query. 5. Discuss selection operation techniques (16) 6. Explain structure of file indices (16) 7. Explain different properties of indexes in detail (16) UNIT IV TRANSACTION MANAGEMENT PART-A ( 2 Marks) 1. Define Transaction. 2. How many states are in Transaction system? 3. Define Centralized DBMS. 4. What is a collaborating server? 5. Horizontal Fragmentation vs Vertical Fragmentation? 6. Difference between Homogeneous and Heterogeneous ? 7. How the data is distributed across sites? 8. What is meant by Synchronous and Asynchronous replication? 9. Explain three solutions of Distributed Deadlock detection? How? 10. What is meant by peer-peer communication. PART-B 1. a) How Transactions are possible in Distributed database? Explain briefly (8) b) what is Transaction state and its ACID properties? (8) 2. a) Discuss about two phase locking and commit protocol (8)
b) Explain various recovery technique during transaction in detail. (8) 3. a)How can we achieve concurrency control achieved in DBMS through serializability? (8) b)Explain Recovery schemas in detail (8) 4. a) What is deadlock prevention and dead lock detection method (10) b) Explain the deadlock recovery technique (6) 5. Explain the following protocols for concurrency control i) Lock based protocols (8) ii) Time stamp based protocols (8) 6. What is concurrency control? how is it implemented in DBMS? (16) 7. a. Write short notes on shadow paging (8) b. Explain the deffered and immediate-modification version of the log-based (8) recovery scheme UNIT V CURRENT TRENDS PART- A ( 2 Marks) 1. Define complex data types in OODBMS? 2. Give four examples for middle tier? 3. Abbrevation for HTTP? Examples. 4. What about presentation layers in web database? 5. Give structure of URL? 6. what is XML?Give confluence. 7. What is XML DTD? 8. How XML and HTML differs? 9. How Xpath followed in Xquery? 10. What about FLWOR? PART-B 1. a. Explain the structure of XML with suitable example (8) b. Explain the following i) Xpath (2) ii) XSLT (4) iii) Xquery. (2) 2. Explain the architecture of data warehousing techniques (16) 3. What are the types of knowledge discovered during data mining with example (16) 4. Highlight the features of object oriented databases (16) 5. a. Explain distributed databases and their types. (8) b. Explain the distributed data storage methods. (8)