jagomart
digital resources
picture1_Powerpoint Presentation Exercise 80153 | Oct4part2


 221x       Filetype PPT       File size 0.62 MB       Source: www.cs.ucr.edu


File: Powerpoint Presentation Exercise 80153 | Oct4part2
exercise 5 2 problem consider the following schema suppliers sid integer sname string address string parts pid integer pname string color string catalog sid integer pid integer cost real the ...

icon picture PPT Filetype Power Point PPT | Posted on 07 Sep 2022 | 3 years ago
Partial capture of text on file.
     Exercise 5.2
    Problem
     Consider the following schema
       Suppliers(sid: integer, sname: string, 
       address: string)
       Parts(pid: integer, pname: string, color: 
       string)
       Catalog(sid: integer, pid: integer, cost: real)
     The Catalog relation lists the prices 
      charged for parts by Suppliers. Write the 
      following queries in SQL:
    Exercise 5.2
    Problem
      Suppliers(sid: integer, sname: string, address: string)
      Parts(pid: integer, pname: string, color: string)
      Catalog(sid: integer, pid: integer, cost: real)
    1. Find the pnames of parts for which there 
     is some supplier.
    Exercise 5.2
   Solution for (1)
    SELECT DISTINCT P.pname
    FROM Parts P, Catalog C
    WHERE P.pid = C.pid
    Exercise 5.2
    Problem
      Suppliers(sid: integer, sname: string, address: string)
      Parts(pid: integer, pname: string, color: string)
      Catalog(sid: integer, pid: integer, cost: real)
    4. Find the pnames of parts supplied by 
     Acme Widget Suppliers and no one else.
    Exercise 5.2
   Solution for (4)
    SELECT P.pname
    FROM Parts P, Catalog C, Suppliers S
    WHERE P.pid = C.pid AND C.sid = S.sid
    AND S.sname = ‘Acme Widget Suppliers’
    AND NOT EXISTS ( SELECT *
               FROM Catalog C1, Suppliers S1
               WHERE P.pid = C1.pid AND C1.sid = 
             S1.sid AND
               S1.sname <> ‘Acme Widget Suppliers’ )
The words contained in this file might help you see if this file matches what you are looking for:

...Exercise problem consider the following schema suppliers sid integer sname string address parts pid pname color catalog cost real relation lists prices charged for by write queries in sql find pnames of which there is some supplier solution select distinct p from c where supplied acme widget and no one else s not exists...

no reviews yet
Please Login to review.