0% found this document useful (0 votes)
0 views1 page

Lab 9 - RA and SQL

The document outlines a lab exercise for computer science students focusing on relational algebra and SQL queries using a schema involving suppliers, parts, and a catalog of prices. It includes specific tasks to find suppliers of red and green parts, as well as queries to identify the most expensive parts and parts supplied under certain pricing conditions. Students are required to write both relational algebra and SQL queries for the given tasks.

Uploaded by

plutoagcorp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views1 page

Lab 9 - RA and SQL

The document outlines a lab exercise for computer science students focusing on relational algebra and SQL queries using a schema involving suppliers, parts, and a catalog of prices. It includes specific tasks to find suppliers of red and green parts, as well as queries to identify the most expensive parts and parts supplied under certain pricing conditions. Students are required to write both relational algebra and SQL queries for the given tasks.

Uploaded by

plutoagcorp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Department of Computer Science

Lab 9 – Relational Algebra and SQL Queries Exercises

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 relational algebra and in SQL.

1. Find the names of the suppliers who supply some red part.

2. Find the sids of suppliers who supply some red or green part.

3. Find the sids of suppliers who supply some red and some green part.

Write the following queries in SQL

4. Find the pids of the most expensive parts.

5. Find the pids of parts supplied by every supplier at less than P200. (If any supplier either
does not supply the part or charges more than P200 for it, the part is not selected).

You might also like