-
Notifications
You must be signed in to change notification settings - Fork 0
/
Assignment8.txt
64 lines (52 loc) · 1.36 KB
/
Assignment8.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--Alexander Phosykeo
--CIT 28
--Assignment #8 - Chapter 11
--Using SQLQFMM2
--Sales Orders Database: #2
select *
from Customers
where exists
(select *
from Orders
inner join Order_Details
on Order_Details.OrderNumber = Orders.OrderNumber
inner join Products
on Products.ProductNumber = Order_Details.ProductNumber
where CategoryID in (2) and Orders.CustomerID = Customers.CustomerID)
--Entertainment Agency Database: #2
select *
from Customers
where exists(
select *
from Entertainers
inner join Engagements
on Entertainers.EntertainerID = Engagements.EntertainerID
inner join Entertainer_Styles
on Entertainer_Styles.EntertainerID = Entertainers.EntertainerID
where StyleID in (6,11) and Customers.CustomerID = Engagements.CustomerID
)
--School Scheduling Database: #2
select *
from Students
where exists(
select *
from Classes
where TuesdaySchedule in ('true')
)
--Bowling League Database: #2
select *
from Tournaments
where exists(
select *
from Tourney_Matches
inner join Match_Games
on Tourney_Matches.MatchID = Match_Games.MatchID
where WinningTeamID not in (0,1,2,3,4,5,6,7) and Tournaments.TourneyID = Tourney_Matches.TourneyID
)
--Recipes Database: #2
select RecipeTitle, Preparation
from Recipes
where exists(
select *
from Ingredients
where IngredientID in (9) and Recipes.RecipeID=Ingredients.IngredientID)