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

  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.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

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