List the names and locations city of all suppliers

Assignment Help Database Management System
Reference no: EM133302137

Data and Information Management Relational Data Retrieval: SQL

Practice Questions

S (SUPPLIER) P (PART): Stock Info

S#

SNAME

CITY(location)

 

P#

PNAME

UNIT

COST

S1

Smith

London

P1

Screw

10

$100

S2

Jones

Rome

P2

Hinge

20

$150

S3

Lee

Tokyo

P3

Pin

30

$200

S4

Poston

Rome

P4

Nail

40

$250

S5

Zhang

London

 

 

 

 

 

SP

 

 

 

POP-INFO

 

 

 

SNUM

PNUM

 

Location

Population

 

 

S1

P1

London

2M

 

S1

P3

Rome

1.5M

 

S2

P1

Tokyo

1M

 

S2

P2

Paris

2.5M

 

S1

P2

 

 

S3

P1

 

S1

P4

 

 

a) "SP" is used to keep track of which supplier provides which part(s).

b) "Pop-info" is used to keep track of population of city.

- Try to come up with your own SQL expression for the following questions and then compare yours with the answers on the last pages.

Question I: Working with only one relation

  1. List the names and locations (CITY) of all suppliers.
  2. List the supplier-number (S#) and names of suppliers (SNAME) located in "Rome"
  3. List the current available number of units (UNIT) and price (COST) of "P2" are available?
  4. Which parts (PNUM) does supplier "S1" provide?
  5. Which suppliers (SNUM) does provide "P4"?

          5.1. a) Which part is most expensive? List the highest (MAX) unit price of all parts we currently have.
                 b) List the part number (P#) and part name (PNAME) of the most expensive one.

          5.2. a) What is the average (AVG) unit cost of all parts we currently have?
                b) List the part number (P#) and part name (PNAME) of the parts that cost less than the average unit cost?

Question II: Joining two tables

6. List the suppliers (SNUM) and parts (PNUM) information along with exact part names.
7. List the suppliers (SNUM) and parts (PNUM) information along with suppliers' names and locations (cities).
----- For joining condition and additional search criteria -------
8. Find the exact names of part(s) supplied by "S1."
9. Find the locations (cities) of suppliers who supply "P1."
10. Find the locations (cities) of suppliers who supply "P2" and the populations of the locations (cities).

Question III. Working with Set Operators (UNION, INTERSECTION, EXCEPT) and EXITS

11. Which suppliers (SNUM) do provide P1 or P2?
list the supplier-numbers (SNUM) of the suppliers.
list the supplier-numbers (SNUM) and names (SNAME) of the suppliers.

12.1. Which suppliers (SNUM) do provide both P1 and P2?
a) list the supplier-numbers (SNUM) of the suppliers.
b) list the supplier-numbers (SNUM) and names (SNAME) of the suppliers.

12.2. Which suppliers (SNUM) do provide P1, P2, and P3? Display the supplier number (SNUM) and names (SNAME) of such suppliers.

12.3. Which suppliers (SNUM) are located in "Rome," and do provide both P1 and P2?
a) list the supplier-numbers (SNUM) of the suppliers.
b) list the supplier-numbers (SNUM) and names (SNAME) of the suppliers.

12.4. Which suppliers (SNUM) do provide ALL parts we currently have? Display the supplier number (SNUM) and supplier name (SNAME)? (Use A SQL statement for a DIVISION operator in relational algebra)

SELECT S#, SNAME FROM S
WHERE NOT EXISTS (
(SELECT P.P# FROM P)
EXCEPT
(SELECT SP.PNUM FROM SP WHERE SP.SNUM = S.S#) );

13. Are there any suppliers who do not provide any part currently? If so, list the supplier-numbers (SNUM) and names (SNAME) of the suppliers.

14. Are there any suppliers who provides any part that costs more than $120 ?
a) If so, list the supplier-numbers (SNUM) of the suppliers.
b) If so, list the supplier-numbers (SNUM) and names (SNAME) of the suppliers

Question IV. Working with "Group By" and "Having"

15. For each supplier (SNUM), display the number of parts they provide.

16. Are there any suppliers (SNUM) who provides more than two parts?
a. If so, list the supplier-numbers (SNUM) of the suppliers.
b. If so, list the supplier-numbers (SNUM) and names (SNAME) of the suppliers

Reference no: EM133302137

Questions Cloud

Are colloquial expressions present in the song : Are colloquial expressions, archaic language, unconventional usage, formal vs informal language present in the song 1979 William "Billy" Patrick Corgan?
Why is ecology important : Why is ecology important? What can students of ecology do for the future? Also, what is the relation between God and ecology?
About great black swamp : What did you find most interesting/compelling about the Great Black Swamp and its role in shaping the Great Lakes?
Sunlight exposure across habitat types affect biodiversity : How does sunlight exposure across habitat types affect biodiversity? what factors enhance or impede sunlight reaching each of the 4 habitats above?
List the names and locations city of all suppliers : MIS 7605 Data and Information Management Relational Data Retrieval: SQL - List the current available number of units (UNIT) and price (COST)
What are the many ways the children are involved in story : what are the many ways the children are involved in the story?What instruments and movements could be added for the children to take a more active role in story
Can you write a persuasive speech in running as president : Can you write a Persuasive Speech in running as president.
Design your program with relevant experiences for children : Design your program for one week, with relevant experiences for your focus children. Include all experiences, routines, and transitions.
How will your activity promote creativity in your classroom : How will your activity promote creativity in your classroom? How do you develop and manifest creativity in your own daily activities?

Reviews

Write a Review

Database Management System Questions & Answers

  Find the year when maximum number of faculty

Find the year when maximum number of faculty were hired - List the number of courses (not offerings) taught in 2006 by faculty rank and department excluding the ones with zero courses taught.

  Identify super key of r based on functional dependencies

Identify the Functional Dependencies in R. Be sure to maximize the number of attributes on the right hand side (RHS) and minimize the number of attributes on the left hand side (LHS) of each FD. You should exclude any trivial FDs in your answer.

  Generate scatter plot of age vs charges in database

Use ggplot2 to generate a scatter plot of age vs. charges in the heart attack dataset. Create a 5 by 5 matrix with a sequence of 1 to 5 for the diagonal

  What is the key for schema

CISC 660 Database Management Systems - What is the key for schema and Find the minimal cover of F

  Write sql script which will query your zip-code-data table

Write an SQL script which will query your zip_code_data table as follows: Select just the city and zip code and rating. For which the tourist rating is a 4.

  Identify functional dependencies and derive candidate keys

Display the origin, destination, departure time from origin, and arrival time at destination for all flights that occur in the same time zone.

  Write the proper sequence of activities in the design

Write the proper sequence of activities in the design of a video rental database. The initial ERD is shown in above (or refer to textbook figure 9.9). The design must support all rental activities, customer payment tracking, and employee work sche..

  Create a database from scratch

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

  What is a sql injection vulnerability?

Do you create an ordered file whose records are based on a primary key such as customer name and use a primary index on the attribute?  Explain your reasons.

  Design and implement the best home business database

In this assignment, you are to design and implement The Best Home business database that you have modelled in the assignment-1 and a series of SQL queries to reflect the business logic of The Best Home

  Design tables import data from access and excel

The main portion of the resort is the hotel. The hotel wants to store information about hotel guests, reservations, and rooms. You will design tables, import data from Access and Excel, and create relationships.

  Design a distributed database for dreamhome

Review the "User Requirements Specification for DreamHome Case Study" of Database Systems: A Practical Approach to Design, Implementation and Management.

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