# To change this template, choose Tools | Templates
# and open the template in the editor.


FilmLookup.query.categories = SELECT DISTINCT Category_name, Category.Recognition FROM `Film` , `Cshow` , `Category` , `Cinema` , `City` WHERE Cshow.Film_id = Film.Film_id AND Film.Category_id = Category.Category_id AND Cinema.Cinema_id = Cshow.Cinema_id AND Cinema.City_id = City.City_id
FilmLookup.query.films = SELECT DISTINCT Title, Film.Recognition, Category_name FROM `Film`, `Cshow`, `Category`, `Cinema`, `City` WHERE Cshow.Film_id = Film.Film_id And Film.Category_id = Category.Category_id And Cinema.Cinema_id = Cshow.Cinema_id And Cinema.City_id = City.City_id
Condition.city = \ And City.Name =
Condition.date = \ And Cshow_date >
CinemaLookup.query.cinemas = SELECT DISTINCT Cinema.Name,Cinema.Recognition  FROM `Cinema`, `Cshow`,`City` WHERE Cinema.Cinema_id = Cshow.Cinema_id And Cinema.City_id = City.City_id
FilmLookup.query.date = SELECT DISTINCT Cinema.Name,Cinema.Recognition  FROM `Cinema`, `Cshow`,`City` ,`Film` WHERE Cinema.Cinema_id = Cshow.Cinema_id And Cinema.City_id = City.City_id And Cshow.Film_id = Film.Film_id
Condition.film = \ And Title =
Condition2.date = \ And Cshow_date =
Condition.cinema = \ And Cinema.Name =
Condition.time = \ And Cshow_time =
CinemaLookup.query.date = SELECT DISTINCT Title, Film.Recognition, Category_name FROM `Film`, `Cshow`, `Category`, `Cinema`, `City` WHERE Cshow.Film_id = Film.Film_id And Film.Category_id = Category.Category_id And Cinema.Cinema_id = Cshow.Cinema_id And Cinema.City_id = City.City_id
Query.Time = SELECT DISTINCT Cshow_time FROM `Cshow` , `Film`, `Cinema`, `City` WHERE Cshow.Film_id = Film.Film_id And Cinema.Cinema_id = Cshow.Cinema_id And Cinema.City_id = City.City_id
Query.availale.tickets = SELECT `Cshow`.Cshow_id, Cshow_date, Cshow_time, Cshow_price, `Cinema`.Name, Capacity, (Capacity - ifnull( Sum( NumberOfTickets ) , 0 )) AS "AvailableSeats",Title FROM `City`,`Film` , `Cinema` , `Cshow` LEFT JOIN `Reservation` ON `Cshow`.Cshow_id = `Reservation`.Cshow_id WHERE `Cshow`.Film_id = `Film`.Film_id AND `Cshow`.Cinema_id = `Cinema`.Cinema_id And Cinema.City_id = City.City_id
Orderby.ShowTime = \ ORDER BY Cshow_time
Condition.number = \ Number =
Condition.expirationDate = \ And ExpirationDate =
Condition.last3Digits = \ And Last3Digits =
Condition.digitalSignature = \ And DigitalSignature =
Condition.type = \ And Type =
Condition.Show_id = \ And `Cshow`.Cshow_id =
Condition.Show_price = \ And Cshow_price =
Condition.NumTickets = \ And NumTickets =
Condition.Capacity = \ And Capacity =
Query.show.AvailableSeats = SELECT (Capacity - ifnull( Sum( NumberOfTickets ) , 0 )) AS "AvailableSeats" FROM `Cinema` , `Cshow` LEFT JOIN `Reservation` ON `Cshow`.Cshow_id = `Reservation`.Cshow_id WHERE `Cshow`.Cinema_id = `Cinema`.Cinema_id
Query.balance.owner = SELECT Balance, Owner, CreditCard_id FROM  `CreditCard`
Query.updateBalance.part1 = UPDATE `CreditCard` SET 
Update.DeductBalance = \ Balance = Balance -
Query.updateBalance.part2 = \ Where
Condition.CreditCard_id = \ CreditCard_id =
Query.insertReservation.part1 = INSERT INTO `Reservation` (Reservation_date,Reservation_time,NumberOfTickets,TicketsDelivery_datetime,CreditCard_id,Cshow_id)
Insert.Values.start = \ VALUES (
Insert.Values.end = \ )

