DBMS Tutorials
DBMS Tutorials
DBMS Tutorials
Explain architecture of DBMS and its advantages ? state two main disadvantages of DBMS ? Q3. What is DBA ? What are major responsibilities of DBA and database designers ? Q4. What are problems with traditional file processing system ? How they are removed in database system ? Explain Q5. Explain the Codds Rule in detail. Q6. What do you mean by RDBMS ? What are its characteristics ? Q7. What is the difference between DBMS and RDBMS ? Which of them is more suitable? Q-8 Define the three-tiered architecture for internet database applications. Indicate what the function of each layer is, and give an example of a piece of software that might be used in each layer. How does this notion relate to the concepts of thick and thin clients? What are advantages of the three-tiered architecture. Q9.Describe the three-level architecture of DBMS ? Also explain its importance in a database environment. Q10 Explain various levels of Data abstraction in database system ? Q-11Discuss concept of database language and interfaces. Q-12 How does database management system overcome the problem with data redundancy. Q-13 What is meant by data independence. Make a list of data independence capabilities Q-14 Explain with the help of suitable example : (i)Generalization (ii)Aggregation Q-15 With the help of suitable diagram explain database system structure . Q-16 What is the difference between logical and physical data independence.
Tutorial 2 Q1. What do you mean by Entity-Relationship Diagram ? Explain Q-2 Use an Entity-Relationship Diagram to depict the following requirements for a restaurant: The restaurant employs a number of chefs. A record is kept of each chefs name, address, phone number and salary. Each chef can prepare a number of meals. The name of the meal and the price of the meal is recorded. Each meal consists of a number of ingredients. The name of the ingredient and the quantity required for that particular meal is recorded. These meals are ordered by customers. A record is kept of the customers name, address and phone number. A record is kept of the time and date the meal is ordered. State any assumptions made in the design of the E-R diagram. Q3 What is meant by term relationship between entities ? Q4.Explain the concept of dependent entities? give example. Q-5 Music database contains information about Songs (identified by a unique song id# and the title of the song), Bands (identified by a unique band name and the number of members in the band), and Albums (identified by a unique album id#, the title of the album, the number of songs on the album).Bands sing Songs and produce Albums. Songs are parts of an Album. Draw an ER diagram for each of the situations below: - A Song may be part of more than one Album. - A Song must be part of at least one Album. - A Song appears on one and only one Album. - Each Album must have at least one Song. - A Band may sing more than one version of a Song, but each version must appear on a different Album. Q-6 Define the terms primary key, candidate key, foreign key. Explain giving example. Q-7 Discuss Entity, Entity set (in an ER model), Relationship, Relationship set (in an ER model),Key constraint (in an ER model),Participation constraint (ER), Weak entity (ER),ISA hierarchy (ER) Q-8What are the Extended E-R Features? Q-9 What is a Constraint? What do you understand by Mapping Cardinalities? Q-10 Draw a Venn diagram showing the relation between primary, candidate and Alternate keys. Q-11 What is the difference between Unary and Binary relation.
Q-12 How do the following constraints work (i)Primary keys (ii) Mapping Cardinalities (iii) Referential Integrity. Q-13 What is a foreign key? List the properties of a foreign key. Q-14 Explain the different types of relationships that can exist with examples ?
Tutorial 3 Q-1Explain the following terms (i)DDL (ii)VDL (iii)SDL (iv)DML (v) Data Storage - Definition Language Q-2Explain the following terms (i)DML compiler (ii)Query Evaluation Engine (iii)DDL Interpreter Q-3Explain the following terms (i) Record-at-a-time (ii) Set-at-a-time or Set-oriented (iii)Meta Data (iv)Data Dictionary Q-4 Which subdivision of SQL is used to put values in tables and which one to create a table.
Tutorial 4 Q.1 What do you mean by data models? Explain network, hierarchical and relational model in detail. Q-2 Why Relational Data Model is more popular as compared to others like OO, Network and hierarchical? Discuss reasons for that (any three) and describe any one that you think is the most critical / important factor. Q-3 Draw the diagram of DBTG Codasyl model and explain. Q-4 Explain DBTG data structure and architecture. Also discuss the DBTG data retrieval facility. Q5. Give the various advantages and disadvantages of the network model Q-6 Give a network datastructure diagram for the following relational database Course(course_name,room,instructor) Enrollment (course_name,student_name,grade) Q-7 Give a network datastructure diagram for the following relational database Lives(person_name,street,city) Works(person_name,company_name,city) Located_in(company_name,city) Manges(person_name,manger_name) Q-8 Design the relational,hierarchical,network for a simple real world of a university described as follows: Departments offer courses, employs both students and faculty members and have students who receive scholarship from their department. Further faculty members teach courses and advice students. Also , student enroll in courses and for each courses taken by each student there is a course grade.
Tutorial 5 Q1. What is relational algebra? Discuss the various operations of relational algebra. Q2. Describe the different types of relational calculus in detail. Q-3 What do you mean by Null values? Explain with suitable examples. Q-4. Define the following operations in relational algebra: Selection, Projection, Cross Product, Intersection, Union, Natural Join, Division
Q-5What is relational calculus? Differentiate between relational algebra and relational calculus. Q-6Consider the following relation patients (pnum, pname, age) doctors (dnum, dname, rank) visits (pnum, dnum, date, diagnosis) Construct the relational algebraic expressions for the following 1. Simple selection and projection i. Who are the patients 10 years old or younger? ii. Who are the surgeons iii. What are the phone numbers of doctors iv. What are the phone numbers of surgeons Cartesian products and Join i. Form peer groups for patients, where a peer group is a pair of patients where age difference is less than 10 years (can use the rename operator rA(R) ). ii. Who are the surgeons who visited the patient 101 (i.e. pnum = 101)? iii. Who has seen a surgeon in the past two years? iv. Is there any non-surgeon doctors who performed a surgeon (a doctor performed a surgeon if the visit record shows diagnosis=operation for him)? 3. Divison i. Who has seen all the surgeons in the past two months? ii. Find all patients excepts for the youngest ones. Q-7Consider the employee database Employee( employee_name, street, city) Works(employee_name, company_name, salary) Company(company_name, city) Manages(employee_name, manager_name) Write relation algebra expressions to 1. find the names of residence of all employees who work for First Bank Corporation 2. Find the names, street and cities of residence of all employees who work for First Bank corporation and earn more than $10000 3. Find all the employees in the database who earn more than each employee of Small Bank Corporation. 4. Find the company that has the most employees. 5. Find those companies whose employees earn a higher salary, on average, than the average salary at First Bank Corporation. Q-8Conside the following relational schema Employee(empno, name, office, age) Books(isbn, title, authors, publisher) Loan(empo, isbn, date) Write relation algebra expressions
1. Print the names of employees who have borrowed any book published by McGraw-Hill. 2. Print the names of employees who have borrowed all books published by McGraw-Hill. 3. For each publisher print the names of employees who have borrowed more than 5 books of that publisher. 4. Print all the records stored in all 3 tables of database. Q-9 Explain Composition Operations in Relational Algebra. Q-10 List and explain the rules that must be used to get more efficient relational algebra query from the original one , with suitable examples Q-11 What is referential integrity? Give its mathematical definition. List and explain the test that must be made for insertion deletion and updation type of modifications in order to preserve the following referential integrity constraint . Q-12 Define the following terms (i) Domain (ii) Alternate Keys (iii) Composite Key (iv) Tuple (v) Cardinality
Tutorial 6 Q1 Discuss the various types of join operations? Why are these joins required? Q-2Consider STUDENT ID NAME YEAR 43 Jones 2 32 Burns 1 34 Cairns 3 21 Hughes 2 NAME OFFICE Black 1017 Welsh 1024 Holt 2014 Quinn 1010 C# TITLE LNAME 216 Databases Black 312 Software Black 251 Numerical Quinn 121 Compilers Holt ID NAME YEAR 42 Smith 3 98 Turner 2
LECTURER
COURSE
NEW-STUDENT
Murphy 2 Cairns 3 Noble 1 REPORT S# C# MARKS 43 216 82 32 216 75 32 312 71 34 121 49 21 312 39 43 251 70 32 251 69 32 121 78 Using the above relations, write out the relational algebraic expressions (do NOT write programs) that would derive the following results. 1. List the ID, NAME and YEAR of both new and current students who are in year 2. 2. What is Holts office number? 3. Generate a list containing, for all the current students only, their IDS, NAMES, YEARS, COURSE NUMBER and MARK for that course. 4. Find the names of all current students taking course 251. 5. Find the room number of the lecturer who teaches course 999. 6. Find the names of all current students who take all courses. 7. Find the ids of those current students each of whom take all courses taken by Cairns. Q-3Can the union of two different keys of a relation be a key? Explain why/why not. Q-4 Is the intersection of two superkeys necessarily a key? Explain why/why not. Q-5Discuss the various update operation on relation and types of integrity constraints that must be checked for each update operation? Q-6 Consider the following relation database Employee(employee_name,street,city) Works(employee_name,company_name,salary) Company(company_name,city) Manages(employee_name,manager_name) Give an SQL DDL definition of this database .Identify referential integrity constraint that should hold, and include them in the DDL definition. Q-7 Consider the COMPANY relational database schema EMPLOYEE (SSN, Name, Bdate, Address, Salary, DeptId) DEPARTMENT(DeptId, Dname, Office, Mng-SSN) PROJECT(Code, Name, Budget, DeptId) JOIN(ESSN, PCode, StartDate) EMP-DEPENDENT(ESSN, Dependent-Name, Bdate, Relationship) Using Tuple relational Calculus Query 1: Find all employees whose salary is greater than 30.000 Query 2: Find the name, address of employees who works for department number 1
23 34 90
Query 3: Find the name of the department that employee John works for. Query 4: Find the SSN, start date of the employees who works for project number 1 or project number 2
Tutorial 7 Q-1A SQL query may have five different clauses, a SELECT, FROM, WHERE, GROUP BY and HAVING clause. Explain how each of these clauses works and how they are evaluated in an SQL query. Give an example using all five clauses. Q-2 Consider the following relation patients (pnum, pname, age) doctors (dnum, dname, rank) visits (pnum, dnum, date, diagnosis) Construct the SQL queries for the following 1. Simple selection and projection i. Who are the patients 10 years old or younger? ii. Who are the surgeons iii. What are the phone numbers of doctors iv. What are the phone numbers of surgeons 2. Cartesian Product and Join i. Form peer groups for patients, where a peer group is a pair of patients where age difference is less than 10 years (can use the rename operator rA(R) ). ii. Who are the surgeons who visited the patient 101 (i.e. pnum = 101)? iii. Who has seen a surgeon in the past two years? iv. Is there any non-surgeon doctors who performed a surgeon (a doctor performed a surgeon if the visit record shows diagnosis=operation for him)? 3. Divison i. Who has seen all the surgeons in the past two months? ii. Find all patients excepts for the youngest ones. Q-3How are the concepts of primary key, candidate key, foreign key introduced using SQL?Give an example of a relation definition or definitions in SQL that includes all of these concepts. Q-4Consider the following relational database.Give expressions in QBE for each of the following queries. Employee(personname,street,city) Works(personname,companyname,salary) Company(companyname,city) Manages(personname,managername) (i) Modify the databse so that Jones now lives in Newtown. (ii) Give all employees of First Bank Corporation a 10 % raise (iii) Give all mangers in the database a 10% raise. (iv) Give all mangers in the database a 10 % raise unless the salary would be greater than Rs.100,000. In such a case give only a 3% raise.
Q-5 Let the following relation schemes be given: First(C1,C2,C3) Second(C11,C12,C13) What functions would the following relational expression perform (a) C1(first) (b) C2=17 (first) (c ) First * Second (d) C1,C12( C3 = C11(First *Second)) Q-6 What is a relation ? Define the properties of a relation Q-7 What is the difference between Table constraints and Column Constraints Q-8Compare DISTINCT and ALL keywords when used with SELECT command Q-9 What is the difference between SELECT INTO and CREATE VIEW command Q-10 What are views.Can we create view of a view. Tutorial 8 Q1.What do you mean by normalization ? Explain. Q2.What do you mean by BCNF ? Why it is used and how it differ from 3 NF ? Q3. Define term anomalies.Explain BCNF in detail. Q-4 Explain why 4NF normal form is more desirable than BCNF Q-5 Explain how dangling tuples may arise .Explain problems that they may cause. Q-6Suppose that we decompose the schema R-(A,B,C,D,E) into (A,B,C) (A,D,E) Show that this decomposition is a lossless join decomposition if the following set F of functional dependencies holds: A->BC CD->E B->D E->A Q-7Why are certain functional dependencies called trivial functional dependencies. Q-8List all functional dependencies satisfied by the relation A B C A1 B1 C1 A1 B1 C2 A2 B1 C1
A2 B1 C3 Q-9Compute the closure of the following set F of functional dependencies for the relational schema R=(A,B,C,D,E) A->BC CD->E B->D E->A List the candidate keys for R Q-10 How does multivalued dependency differ from functional dependency Q-11 Given the relation R (Country,City,Pincode,Continent) and the functional dependencies country continent pincode continent countrycity pincodecity Identify whether R is in 2NF,3NF Q-12 Let there be a relation R(A,B,C,D,E) with AB as key Let the following hold: AB->C B->E B->C Convert R into a representation in 2NF Q-13 Let there be a relation R(A,B,C,D,E) with A as key Let the following hold A->B O->E A->D B->C Normalize the relation in 3 NF Q-14 Explain Canonical cover and Extraneous Attributes with examples.
Tutorial 9 Q1. Why is concurrency control needed? Explain lost update, Inconsistent retrievals and uncommitted dependency anomalies. Q-2 What benefits does strict two phase locking protocol provides. Q-3 Consider the following two transactions T31: Read (A)
Read (B) If A=0 then B:=B+1; Write (B) T32: Read (B) Read (A) If B=0 than A:=A+1 Write(A) Add lock and unlock instructions to transactions T31 and T32 so that they observe the two phase locking protocol. Can the execution of these transactions result in a deadlock. Q-4What benefits does rigorous two phase locking provides? How does it compare with other forms of two phase locking? Q-5 Explain Conflict Serializability and View Serializability. Q-6 If deadlock is avoided by deadlock avoidance scheme, is starvation still possible? Explain your answer Q-7 Under what circumstances is it less expensive to avoid deadlocks than to allow deadlocks to occur and then to detect it. Q-8 Explain Phantom Phenomenon. Why may this phenomenon lead to an incorrect concurrent execution despite the use of the two phase locking protocol. Q-9 What is conflict serializability ? Q-10Explain the test that need to be performed for testing conflict serializability Tutorial 10 Q-1 Discuss the relative advantages of centralized and distributed databases. Q-2How might a distributed database designed for a LAN differ from one designed for a WAN. Q-3 Explain the difference between Object Oriented database systems and Relational database systems Q-4 Explain the following terms related to Data Warehousing and Mining (i)Association Rules (ii) Clustering(iii)Classification(iv)Support of a rule (V)OLAP Q-5 Explain client server system . Also explain categorization of server system in detail with suitable diagram . Q-6Many advanced database technologies have changed the database scenario. Data warehousing and data mining are two of them. Discuss the role and significance of these database technologies.