data sql

Report
Question

Please briefly explain why you feel this question should be reported .

Report
Cancel

Write the SQL code to .

(Assume now that all three tables, S, P, and SP are in place, and they have records as above.)

S                                             P                                                                     SP

S# SNAME STATUS CITY P# PNAME COLOR WEIGHT CITY S# P# QTY
S1

S2

S3

S4

S5

Smith

Jones

Blake

Clark

Adams

20

10

30

20

30

London

Paris

Paris

London Athens

P1

P2

P3

P4

P5

P6

Nut

Bolt

Screw

Screw

Cam

Cog

Red

Green

Blue

Red

Blue

Red

12

17

17

14

12

19

London

Paris

Rome

London

Paris

London

S1

S1

S1

S1

S1

S1

S2

S2

S3

S4

S4

S4

P1

P2

P3

P4

P5

P6

P1

P2

P2

P2

P4

P5

300

200

400

200

100

100

300

400

200

200

300

400

 

 

  1. Display the name of supplier who is from “Paris” and whose status is higher or equal to 20.
  2. Delete suppliers whose name starts with a “D”.
  3. Display all records of the S in descending order of STATUS and ascending order of SNAME (that is, the supplier of the highest STATUS will be displayed at first, the second highest at the second, etc. Among the supplier of the same status, their names will be sorted alphabetically.)

13.In one SQL command, create a new table named S_LONDON. The S_LONDON table has the same structure as the S table, and it contains supplier records of suppliers who are from London.

  1. Delete the S_LONDON table.
  2. Display the names of the suppliers who supply product number P1.
  3. Display the name and weight of parts which are supplied by supplier S3.
  4. Display the quantity of part \”Blue Screw\” supplied by supplier S1.
  5. Display the quantity of part Green Bolt supplied by supplier Smith.
  6. Display the name of suppliers who supply Red Nut.
  7. Display names of parts which are supplied by Blake.
  8. Display names of all parts which are supplied by suppliers whose status is higher than 25.
  9. Display s#, p# pairs of which the supplier and parts are from the same city and the supplier has supplied that part. (You need to use the SP table).

 

 

 

in progress 0
SQL 2 months 1 Answer 147 views 0

Answer ( 1 )

  1. ritwik

    Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    Sure you have not read the note in the sidebar. Where is your SQL code? This kind of ‘how to do it’ without showing any effort is not the way you should post your question in this forum.

Leave an answer

Browse

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>