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

  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.

  Database system development

The database application project (DAP) for this course consists of the creation of a fully functional Microsoft Access database application for a real client.

  What do you mean by data base scheme

Database Questions:  What do you mean by data base scheme?  What do you mean by cardinality ratio?   What do you mean by degree of relation?

  Evaluate maximum rate at which data can be read from disk

What is the maximum rate at which data can be read from disk, assuming that we can only read data from one surface at a time? What is the average rotational latency?

  Study and modify the postgresql source code

Write a Assignment to study and modify the PostgreSQL source code, with a focus on one of the core modules - the buffer manager

  First - second or third normal form

How many entities are shown by this relation?

  Design a database schema

Design a Database schema

  Analyse a set of data and write a memo

To analyse a set of data, and write a memo, identifying and explaining your insights into the operation of Todd Restaurants.

  Evaluate the success wellco and pharmacare shareholders

Evaluate the success WellCo and PharmaCARE shareholders

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Create a database from scratch

Create a database from scratch that contains, at a minimum, the elements listed below

  Characteristics of database

Describe the database and describe the four characteristics of the database? Explain the Relational Database and generate a relational database for five employees.

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