Banner

 

5 - The Many-to-Many Relationship
Slide Exercises

A keen field hockey fan wants to keep track of which countries won which medals in the various summer Olympics for both the men’s and women’s events


Report all brown items that have been sold.
SELECT itemname, itemcolor FROM item 	
  WHERE itemcolor = 'Brown' 		
  AND EXISTS (SELECT * FROM lineitem 		
  WHERE lineitem.itemno = item.itemno); 

Report all brown items that have not been sold
SELECT itemname, itemcolor FROM item 	
  WHERE itemcolor = 'Brown' 		
  AND NOT EXISTS (SELECT * FROM lineitem 		
  WHERE lineitem.itemno = item.itemno); 

This page is part of the promotional and support material for Data Management (open edition) by Richard T. Watson
For questions and comments please contact the author

Date revised: 02-Dec-2022