Write a recursive sql query

Assignment Help Database Management System
Reference no: EM1318591

Question 1. Consider the relational schema

part(part-id, name, cost)

subpart(part-id, subpart-id, count)

A tuple (p1, p2, 3) in the subpart relation denotes that the part with part-id p2 is a direct subpart of

the part with part-id p1, and p1 has 3 copies of p2. Note that p2 may itself have further subparts.

Write a recursive SQL query that outputs the names of all subparts of the part with part-id "P-100".

Question 2. Consider the relation, r, shown below. Give the result of the following query:

1738_sql.png

 SELECT building, room_number, time_slot_id, count(*)

FROM r

GROUP BY ROLLUP (building, room_number, time_slot_id)

Question 3. Consider an employee database with two relations

employee(employee-name, street, city)

works(employee-name, company-name, salary)

where the primary keys are underlined. Write a query to find companies whose employees earn a

higher salary, on average, than the average salary at "First Bank Corporation".

a. Using user defined SQL functions as appropriate.

b. Without using user defined SQL functions (you can use built-in SQL functions such as

avg(), min()).

Question 4. Write the following queries in both relational algebra and SQL, using the university schema.

(Appendix A, page 1271, look at that .zip file) Attachment:- DDL.zip

a. Find the names of all students who have taken at least one Comp. Sci. course.

b. Find the IDs and names of all students who have not taken any course offering before

Spring 2009.

c. For each department, find the maximum salary of instructors in that department. You

may assume that every department has at least one instructor.

d. Find the lowest, across all departments, of the per-department maximum salary

computed by the preceding query.

Question 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.

Question 6. Explain the distinction between disjoint and overlapping constraints.

Question 7. Explain the distinction between total and partial constraints.

Question 8. Consider the following set F of functional dependencies on the relation schema

r(A,B,C,D,E,F):

A --> BCD

BC --> DE

B --> D

D--> A

a. Compute B+.

b. Prove (using Armstrong's axioms) that AF is a superkey.

c. Compute a canonical cover for the above set of functional dependencies F; give each step

of your derivation with an explanation.

d. Give a 3NF decomposition of r based on the canonical cover.

 

Reference no: EM1318591

Questions Cloud

Bell-shaped curve for sampling distribution of sample : How does bell-shaped curve for sampling distribution of sample means for samples of size n =120 compare tobell-shaped curve for sampling distribution of sample means for samples of size n =95?
Distribution of the average or median of the sample : What can we say about the form or way of the distribution of the average or median of the sample?
Design configuration of building : Discuss the layout and design configuration of a building you would like to use to house your business, including how you would comply with the Americans with Disabilities Act.
Probability of success using binomial distribution : Consider binomial distribution with 14 identical trials, and probability of success of 0.4.
Write a recursive sql query : MCIS 630 Database Systems: -  Write a recursive SQL query that outputs the names of all subparts of the part with part-id “P- 100”.
Online procurement technologies : Identify and explain two major initiatives undertaken by Australian government (at federal/ state/local government level) in order to introduce the online procurement technologies.
Explaining the distribution of mean of samples : Explain the distribution of mean of samples of size 15.
Computer instruction format : In the computer instruction format, the instruction length is 11 bits and size of an address field is 4 bits? Is it possible to have the 5 2-address instructions 45 1-address instructions 32 0-address instructions utilizing the format.
Values and rights of stakeholders : What decision making criteria were ultimately used? What steps were taken to identify the values and rights of stakeholders? How were policy and legal requirements recognized?

Reviews

Write a Review

Database Management System Questions & Answers

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Explain the datawarehouse and data mining concepts

There are six major types of information systems which organisations use in their operations. Discuss how these information systems support managers in their decision making role Explain the datawarehouse and data mining concepts using appropria..

  Description of the relationship represented by scatterplot

Produce a scatterplot of Rent vs. Size (square meters of the apartment) for the rental data in rent.

  Create a database using oracle packaged procedure

Create a database using Oracle packaged procedure

  Computing functional dependencies

Compute the functional dependencies which exist in following table. After determining the functional dependencies, transform this table to an equivalent collection of the tables which are in third normal form.

  Prepare the relational schema for database

Prepare the relational schema for database

  Evaluate the success wellco and pharmacare shareholders

Evaluate the success WellCo and PharmaCARE shareholders

  Design a set of 3nf tables for database scenario

Draw an ER diagram for your database scenario. Design a set of 3NF tables for your database scenario.

  Design and build a prototype data warehouse

Design and build a prototype data warehouse using the data on Spend over £25,000 in the Science and Technology Facilities Council

  Spreadsheet and database

Explain the differences between the storing data in Access and Excel. Why you would use a spreadsheet over the database?

  Explain why data flow diagrams are developed in a hierarchy

Explain why data flow diagrams are developed in a hierarchy? What are the names of some levels in the hierarchy?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd