dbms tutorials

14
Tutorial 1 Q1. What are various components of Database System ? Explain in detail. Q2. 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 Codd’s 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

Upload: sharmarockstar

Post on 18-Apr-2015

448 views

Category:

Documents


31 download

TRANSCRIPT

Page 1: DBMS Tutorials

Tutorial 1Q1. What are various components of Database System ? Explain in detail.

Q2. 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 Codd’s 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 capabilitiesQ-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.

Page 2: DBMS Tutorials

Tutorial 2Q1. 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 chef’s 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, addressand 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.

Page 3: DBMS Tutorials

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 3Q-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.

Page 4: DBMS Tutorials

Tutorial 4Q.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 databaseCourse(course_name,room,instructor)Enrollment (course_name,student_name,grade)

Q-7 Give a network datastructure diagram for the following relational databaseLives(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 5Q1. 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

Page 5: DBMS Tutorials

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 following1. Simple selection and projectioni. Who are the patients 10 years old or younger?ii. Who are the surgeonsiii. What are the phone numbers of doctorsiv. What are the phone numbers of surgeonsCartesian products and Joini. 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. Divisoni. Who has seen all the surgeons in the past two months?ii. Find all patients excepts for the youngest ones.

Q-7Consider the employee databaseEmployee( 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

Page 6: DBMS Tutorials

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 6Q1 Discuss the various types of join operations? Why are these joins required?

Q-2ConsiderSTUDENT ID NAME YEAR 43 Jones 2 32 Burns 1 34 Cairns 3

21 Hughes 2LECTURER NAME OFFICE Black 1017

Welsh 1024 Holt 2014 Quinn 1010

COURSE C# TITLE LNAME 216 Databases Black

312 Software Black 251 Numerical Quinn 121 Compilers HoltNEW-STUDENT ID NAME YEAR 42 Smith 3

Page 7: DBMS Tutorials

98 Turner 2 23 Murphy 2 34 Cairns 3 90 Noble 1REPORT 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 Holt’s 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)

Page 8: DBMS Tutorials

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 1Query 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 7Q-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 following1. Simple selection and projectioni. Who are the patients 10 years old or younger?ii. Who are the surgeonsiii. What are the phone numbers of doctorsiv. What are the phone numbers of surgeons2. Cartesian Product and Joini. 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. Divisoni. 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.

Page 9: DBMS Tutorials

(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 8Q1.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->BCCD->EB->DE->A

Q-7Why are certain functional dependencies called trivial functional dependencies.

Page 10: DBMS Tutorials

Q-8List all functional dependencies satisfied by the relationA B CA1 B1 C1A1 B1 C2A2 B1 C1A2 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->BCCD->EB->DE->AList the candidate keys for R

Q-10 How does multivalued dependency differ from functional dependency

Q-11 Given the relationR (Country,City,Pincode,Continent)and the functional dependenciescountry continentpincode continentcountrycitypincodecityIdentify whether R is in 2NF,3NF

Q-12 Let there be a relation R(A,B,C,D,E) with AB as keyLet the following hold:AB->CB->EB->CConvert R into a representation in 2NF Q-13 Let there be a relation R(A,B,C,D,E) with A as keyLet the following holdA->BO->EA->DB->CNormalize the relation in 3 NF

Q-14 Explain Canonical cover and Extraneous Attributes with examples.

Tutorial 9Q1. Why is concurrency control needed? Explain lost update, Inconsistent retrievals and uncommitted dependency anomalies.

Page 11: DBMS Tutorials

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 answerQ-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 10Q-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)OLAPQ-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.

Page 12: DBMS Tutorials