Question

Suppose a database has the following three relations Movie (mid: integer, title: string, director: string, relcaseDate: date) PlaysAt (theaterID: integer. movieId:integer. showDate: date) Theater (tID: integer, name: string, phone: string, screencount: integer) movielD in PlaysAt is a foreign key referencing mid in Movie. theaterlD in PLaysAt is a foreign key referencing tID in Theater.Write the following query in SQL

0 0
Add a comment Improve this question Transcribed image text
Answer #1

select tID,NAME from Theater where tID in (select theaterID from PlaysAt where showDate='11/9/2018' group by theaterID having count(*)>3)

Add a comment
Know the answer?
Add Answer to:
Write the following query in SQL Suppose a database has the following three relations Movie (mid:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Suppose a database has the following three relations. Movie (mid: integer, title: string, director: string, releaseDate:...

    Suppose a database has the following three relations. Movie (mid: integer, title: string, director: string, releaseDate: date) PlaysAt (theaterID: integer, movieId: integer, showDate: date) Theater (tID: integer, name: string, phone: string, screencount: integer) "movieID" in PlaysAt is a foreign key referencing "mid" in Movie. "theaterID" in PLaysAt is a foreign key referencing "tID" in Theater. Write the following queries in both relational algebra and SQL. Find the titles of movies playing on 2 / 26 / 2019 and the IDs...

  • Suppose a database has the following three relations. Museum (mid: integer, name: string, address: string, website:...

    Suppose a database has the following three relations. Museum (mid: integer, name: string, address: string, website: string) Displays (museumID: integer, artID: integer, startDate: date) ArtItem (aid: integer, title: string, weightPnd: integer, type: string) Artist (pid: integer, firstname: string, lastname: string, birthdate: date, deathdate: date) Creates (artistID: integer, artID: integer, year: integer) (The "bit" data type stores 0 or 1. False or true. Booleans.) "museumID" in Displays is a foreign key referencing "mid" in Museum. "artistID" in Creates is a foreign...

  • May I ask the SQL code as follows? The relational database moviedb has the following database...

    May I ask the SQL code as follows? The relational database moviedb has the following database schema: Movie(title, production year, country, run time, major genre) primary key : {title, production year} Person(id, first name, last name, year born) primary key : {id} Award(award name, institution, country) primary key : {award name} Restriction Category(description, country) primary key : {description, country} Director(id, title, production year) primary key : {title, production year} foreign keys : [title, production year] ⊆ Movie[title, production year] [id]...

  • Write a query in SQL to list the following information of the artists in movie industry....

    Write a query in SQL to list the following information of the artists in movie industry. Limit this information to only 5 artists. Sort the information by age descending order.          Full name : first name and last name separated by space          Age: Current age          Address: State that he resides          Contact number: Phone number This is from an artist table, where first_name, last_name, contact_no, address, birth_date are the fields in the table. Birth date in the table...

  • Consider a database schema consisting of two tables, Employee (ID, Name, Address), Project(PID, Name, Deadline), Assign...

    Consider a database schema consisting of two tables, Employee (ID, Name, Address), Project(PID, Name, Deadline), Assign (EID, PID, Date). Assign.EID is a foreign key referencing employee's ID and Assign.PID is a foreign key reference the project. Write the SQL query for 1. Find Projects that are not assigned to any employees(PID and Name of the project).

  • Consider the following relational schemas: Employee (eid: integer, ename: string, Job_title: string, Years_of_experience: integer) Project (pid:...

    Consider the following relational schemas: Employee (eid: integer, ename: string, Job_title: string, Years_of_experience: integer) Project (pid: integer, pname: string, parea: string, mid: integer, budget: integer) Works_on (eid: integer, pid: integer) Manger (mid: integer, mname: string, deptid: integer) The meaning of these relations is straightforward; for example, Works_on has one record per Employee-Project pair such that the Employee Works_on the Project. 1. Write the SQL statements required to create these relations, including appropriate versions of all primary and foreign key integrity...

  • 2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query...

    2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query the following Hotel Room Booking Database Tables. "cid" is Customer ID. "rid" is Room ID. "bid" is Booking ID. "dob" means Date of Vwwww Birth; "beds" means the number of beds in the room which is normally 1 or 2 beds. "DueDate" and "DueAmount" are the payment due dates and due amounts of this booking. Customers fname name phone email cid dob zipcode Rooms...

  • Write an SQL query to return the users who posted the most number of jokes on...

    Write an SQL query to return the users who posted the most number of jokes on 1/1/2019. Database: create table User( userid varchar(30) not null, password varchar(30), firstname varchar(30), lastname varchar(50), email varchar(50), gender char(1), age integer, banned boolean, primary key(userid), unique(email)); create table MyFriends( userid varchar(30), friendid varchar(30), primary key(userid,friendid), foreign key(userid) references User, foreign key(friendid) references User(userid)); Create table Jokes( Jokeid integer, title varchar(100), description varchar(255), authorid varchar(30) not null, primary key(jokeid), posttime Datetime, foreign key(authorid) references User(userid));...

  • Express the query with Tuple Relational Calculus Consider the Movies, Stars, Studios Database with the following...

    Express the query with Tuple Relational Calculus Consider the Movies, Stars, Studios Database with the following 5 relations: Movies (title, year, length, genre, studioName, producerC#) Stars (movie Title, movie Year, starName ) MovieStar (name, address, gender, birthdate) MovieExec (name, cert#, address, networth) Stud (name, address, presC#) Find names of movie stars who starred in every movie produced by “MGM” studios in 2019.

  • 2) Consider the database schema on the relations (where key attributes have been underlined): PROJECTS(Number, Department,...

    2) Consider the database schema on the relations (where key attributes have been underlined): PROJECTS(Number, Department, ProjectName) EMPLOYEES(Number, Surname, FirstName, Department) ALLOCATIONSEmplovee, Project, Function, Date) NOTE: relation ALLOCATIONS stores the registration number (attribute Employee) of employees that are assigned to a given project (attribute Project is the number of the project, not the name of the project), the function the employee has in that project (i.e., technician, manager, etc.) and the date when the employee has been assigned to that...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT