Last active
October 2, 2019 20:18
-
-
Save Khazbs/9f826669986b3242ec2b43a542f42316 to your computer and use it in GitHub Desktop.
Hotel Homework queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Arthur Khazbulatov (BBI1803) | |
-- Task 1 | |
/* | |
π Number, rtName ( | |
σ s > 32 ( | |
Room ⨝ RoomType | |
) | |
) | |
*/ | |
-- Task 2 | |
/* | |
π Number, rtName ( | |
σ ¬ isFinished ( | |
Stay ⨝ Room ⨝ RoomType | |
) | |
) | |
*/ | |
-- Task 3 | |
/* | |
π Number, gName, email ( | |
σ Stay1.sid ≠ Stay2.sid | |
∧ Stay1.gid = Stay2.gid ( | |
Guest ⨝ ( | |
ρ Stay1 (Stay) | |
⨯ ρ Stay2 (Stay) | |
) ⨝ Room | |
) | |
) | |
*/ | |
-- Task 4 | |
/* | |
π country ( | |
σ tid = 4 ( | |
Guest ⨝ Stay ⨝ Room ⨝ RoomType | |
) | |
) \ | |
π country ( | |
σ tid ≠ 4 ( | |
Guest ⨝ Stay ⨝ Room ⨝ RoomType | |
) | |
) | |
*/ | |
-- Task 5 | |
/* | |
π gid ( | |
σ totalNights < 3 ( | |
γ gid; sum(nights) -> totalNights ( | |
σ tid = 1 ( | |
Guest ⨝ Stay ⨝ Room ⨝ RoomType | |
) | |
) | |
) | |
) | |
*/ | |
-- Task 6 | |
/* | |
π Number, nightPrice ( | |
σ ¬ isFinished ∧ ¬ seaView | |
∧ (nightPrice < 10 ∨ nightPrice > 80) ( | |
Stay ⨝ Room ⨝ RoomType | |
) | |
) | |
*/ | |
-- Task 7 | |
/* | |
π gName, email ( | |
Guest ⨝ | |
σ StayRoomType1.start < StayRoomType2.start | |
∧ StayRoomType1.tid = 2 | |
∧ StayRoomType2.tid = 3 ( | |
ρ StayRoomType1 (Stay ⨝ Room ⨝ RoomType) | |
⨯ ρ StayRoomType2 (Stay ⨝ Room ⨝ RoomType) | |
) | |
) | |
*/ | |
-- Task 8 | |
/* | |
π gName, email ( | |
σ Stay1.start < Stay2.start | |
∧ Stay1.nights ≤ Stay2.nights ( | |
Guest ⨝ ( | |
ρ Stay1 (Stay) | |
⨯ ρ Stay2 (Stay) | |
) | |
) | |
) | |
*/ | |
-- Task 9 | |
π gName, email ( | |
Guest ⨝ Stay ⨝ Room ÷ RoomType | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment