Question

Consider a database schema with three relations: Provide Movies (movie_id:integer, title:string, year:integer, studio:string) Actors (actor_id:integer, name:string,...

Consider a database schema with three relations:

Provide

Movies (movie_id:integer, title:string, year:integer, studio:string)
Actors (actor_id:integer, name:string, nationality:string)
StarsIn(actor_id:integer, movie_id:integer, character:string)

SQL statements for the following:

1.find the nationalities of actors that worked for all studios. Ensure that a

nationality appears only once in the result.

2. Find for each year the number of distinct actors that played a character that starts with letter“A”

and has at least three letters in the character name.

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

Question 1.

Answer : SELECT nationality
FROM Actors INNER JOIN starsln ON actor_id
INNER JOIN movies ON movie_id
GROUP BY studio;

Question 2.

Answer : SELECT COUNT(DISTINCT actors)
FROM Actors
WHERE name LIKE A__% ;

Add a comment
Know the answer?
Add Answer to:
Consider a database schema with three relations: Provide Movies (movie_id:integer, title:string, year:integer, studio:string) Actors (actor_id:integer, name:string,...
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
  • SQL (no outer joins or windows, please): 1. Find the number of movies per country (using...

    SQL (no outer joins or windows, please): 1. Find the number of movies per country (using nationality of any actor in the movie). Note: you shouldn’t count movies twice; if two or more actors from a country have appeared in a given movie, make sure to count that movie only once. Assume a database with schema ACTOR(name, age, address, nationality) MOVIE(title, year,genre, budget, director-name,studio) APPEARS(name, title,salary) where the table ACTOR contains information about actors and actresses, and name is the...

  • 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.

  • Consider a database schema with three relations: - Parts (pid:integer, pname:string, year:integer, price:integer) -Suppliers (sid:integer, sname:...

    Consider a database schema with three relations: - Parts (pid:integer, pname:string, year:integer, price:integer) -Suppliers (sid:integer, sname: string, state:string, zipcode:string) -Orders (pid:integer, sid:integer, quantity:integer) The description is as follows: a factory keeps a database with parts that it uses, the suppliers of those parts, and purchase orders. Each part is uniquely identified by pid. Each part has a string description pname, year of fabrication and price per unit. Parts are provided by suppliers, and each supplier is uniquely identified by sid....

  • 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...

  • Problem 1 : Movies ER Model Consider a Database that keeps track of scenes filmed for...

    Problem 1 : Movies ER Model Consider a Database that keeps track of scenes filmed for different movies. A movie uses a screenplay (or story) which is broken down into scenes. The movie will also have the same scenes because it is a movie of that screenplay. Not all screenplays in the database become movies, but every movie is of a particular screenplay. Also, a screenplay is used for only one movie. That is, there are not two different movies...

  • 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...

  • Problem 1 (25 points) Consider the following database schema: Employee (fname, Iname, ssn, address, salary, mgrssn,...

    Problem 1 (25 points) Consider the following database schema: Employee (fname, Iname, ssn, address, salary, mgrssn, dnumber) Department (dname, dnumber, mgrssn, mngrstartdate) Project (pname, pnumber, plocation, dnumber) Works_On (ssn, pnumber, hours_per_week) Dependent (ssn, dependent name, bdate, relationship) The above relations store information about a company. The meaning of most of the relations and attributes is straightforward. For example, the first relation stores information about employees. The mgrssn is the SSN of the manager (supervisor) of the given employee. A manager...

  • Question 3 refers to the relational database with a schema described below: The hospital database contains...

    Question 3 refers to the relational database with a schema described below: The hospital database contains information about the treatments of patients performed by the doctors. The database also contains information on the prescriptions ordered by the doctors. The schemas of relational tables, the meanings of attributes and specifications of primary, candidate, and foreign keys are given below. HOSPITAL HospitalCd Name Address Estate PostalCode EstablishedDate Hospital Code Name of the hospital Address of the hospital The estate where the hospital...

  • 4. Consider the following schema for an online streaming service, where users are allowed to play...

    4. Consider the following schema for an online streaming service, where users are allowed to play (stream) songs performed by different artists. Primary and foreign key constraints are also listed for the schema of each table. User (ID, Password, Name, Location) Primary key = ID Artist (ID, Name, Birthyear) Primary key = ID Song (ID, Title, Album, ArtistID) Primary key = ID Song(ArtistID) references Artist(ID) Play (ID, UserID, SongID, Timestamp) Primary key = ID Play(UserID) references User(ID) Play(SongID) references Song(ID)...

  • Consider a database with the following schema. Return SQL code for the following queries.

    Consider a database with the following schema.BARS(name,license,city,phone,addr);BEERS(name,manf);DRINKERS(name,city,phone,addr);LIKES(drinker,beer); FREQUENTS(drinker,bar); SELLS(bar,beer,price); Return SQL code for the following queries.1.  Find all distinct drinkers whose phone numbers come from area code 917 and who like Budweiser or Bud (synonim!)2. What beers does Mike like?3. Which town has the most drinkers?4. What bars are frequented by drinkers from that town (3)?5. Provide all bars which serve beers that Mike likes6. Who likes the at least one same beer that Joe or Mike like?7.  All bars...

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