Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HW2 This SQL query will display the show with ticket price : SELECT show_id,price as ticket_price from Tickets; This SQL query will display show_id and

HW2

This SQL query will display the show with ticket price : SELECT show_id,price as ticket_price from Tickets;

  • This SQL query will display show_id and price from tickets

******************************************

SQL query to display movie details : SELECT m_id,m_name,release_date,actors, director from movie;

  • This SQL query will display movie details

******************************************

SQL query to display number of tickets per customer, show customer with 0 ticket as well : SELECT c_name,count(ticket_no) as number_of_tickets from customer left join booking on customer.cid=booking.cid group by c_name;

  • This SQL query will join two tables customer and booking based on cid

******************************************

SQL query to display movie with show details : SELECT m_name,show_id,st_time,end_time,langauge from movie,show where movie.m_id=show.m_id;

  • This SQL query will join two tables and display details

******************************************

SQL query to display count of Tickets per theatre per seat : SELECT tname as Theatre_Name, seat_name as Seat_name , count(ticket_no) as Ticket_Count FROM Seats,Theatre,Tickets Where Seats.seat_id=Theatre.seat_id and Theatre.tid=Tickets.tid group by tname,seat_name;

  • This SQL query will join three tables Seats,Theatre,Tickets and display count per Theater per seat name

THIS QUESTION

Implement the following types of queries in SQL (at least 2 queries for each category): (a) retrieve all the tuples of a relation. Display all the attribute values. (b) retrieve all the tuples of a relation. Display some but not all attribute values. (c) retrieve the tuples that satisfy some condition. (d) retrieve the tuples that satisfy some condition. Query should include the LIKE operator. (e) retrieve the tuples that satisfy some condition. Output should be sorted sorting on a single attribute. (f) retrieve the tuples that satisfy some condition. Output should be sorted sorting on more than one attribute. (g) implement a query that groups a relation on a specific attribute, and applies SUM, COUNT, MIN, MAX aggregate functions on each group. 1 In this assignment, you will be implementing queries on the database you have created for HW Assignment #2 using SQL.

I Implement the following types of queries in SQL (at least 2 queries for each category): (a) a JOIN combining 2 relations. (b) a JOIN combining 3 relations. (c) a CROSS JOIN (d) A SELF JOIN (if it makes sense for your database).

Implement the following types of queries in SQL (at least 2 queries for each category): (a) a Subquery. (b) a Corelated Subquery. (c) UNION. (d) UNION ALL. (e) INTERSECT. (f) EXCEPT

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+(2,7", P+ ) is the completion of (, , P).

Answered: 1 week ago