Write SQL query considering below schema of databaseFilm(film_id, title, legth, rental_rate), Actor(film_id, actor_id, first_name, last_name)Category(film_id, rating, language, release_year)Create tables with Primary Key, foreign key constraints in given schemas.i.Give the name of actors whose actor id is 23.ii.Give the title of films whose id is between 25 and 40.iii.Give the name of actor whose last name contains Kapoor.iv.Give the title of film which was released in 2022.v.Give the name of actors played who have role in film title ‘Chhello divas’
Question
Write SQL query considering below schema of databaseFilm(film_id, title, legth, rental_rate), Actor(film_id, actor_id, first_name, last_name)Category(film_id, rating, language, release_year)Create tables with Primary Key, foreign key constraints in given schemas.i.Give the name of actors whose actor id is 23.ii.Give the title of films whose id is between 25 and 40.iii.Give the name of actor whose last name contains Kapoor.iv.Give the title of film which was released in 2022.v.Give the name of actors played who have role in film title ‘Chhello divas’
Solution
i. To get the name of actors whose actor id is 23, you can use the following SQL query:
SELECT first_name, last_name
FROM Actor
WHERE actor_id = 23;
ii. To get the title of films whose id is between 25 and 40, you can use the following SQL query:
SELECT title
FROM Film
WHERE film_id BETWEEN 25 AND 40;
iii. To get the name of actor whose last name contains Kapoor, you can use the following SQL query:
SELECT first_name, last_name
FROM Actor
WHERE last_name LIKE '%Kapoor%';
iv. To get the title of film which was released in 2022, you can use the following SQL query:
SELECT title
FROM Film
JOIN Category ON Film.film_id = Category.film_id
WHERE release_year = 2022;
v. To get the name of actors who have role in film title ‘Chhello divas’, you can use the following SQL query:
SELECT Actor.first_name, Actor.last_name
FROM Actor
JOIN Film ON Actor.film_id = Film.film_id
WHERE Film.title = 'Chhello divas';
Please note that the creation of tables with Primary Key, foreign key constraints in given schemas is not included in the above queries. You would need to create the tables first before you can run these queries.
Similar Questions
Given a database for a movie production company. The database includes information about actors, directors, movies, movie cast, and ratings. Write a query to retrieve the titles of all movies directed by 'Martin Scorsese' from the Movie Database.Your task is to identify and display the movies associated with the director with the name 'Martin Scorsese.'The following table is already created, and the records are inserted into the table.Table Details:
Given a database for a movie production company. The database includes information about actors, directors, movies, movie cast, and ratings. Write a query to retrieve a list of actors who have participated in movies either before the year 2005 or after the year 2015. The data is stored in a prepopulated database with tables for actors, directors, movies, movie casts, and ratings
(d) A database, FILMS, stores information about films and actors. Part of the databaseis shown:ACTOR (ActorID, FirstName, LastName, DateOfBirth)FILM_FACT (FilmID, FilmTitle, ReleaseDate, Category)FILM_ACTOR (ActorID, FilmID)(i) A composite primary key consists of two or more attributes that together form theprimary key. Explain why the table FILM_ACTOR has a composite primary key.
Consider the following database:MOVIE(id,title,yr)ACTOR(id,name)CASTING(movieid,actorid)Identify the SQL command which will return the titles of all 1959 Marilyn Monroe films.Option 1. The following SQL...SELECT title FROM movie,casting,actor WHERE movieid = movie.id<> AND name = 'Marilyn Monroe' ; Option 2. The following SQL...SELECT title FROM movie,actor WHERE name = 'Marilyn Monroe' AND yr = 1959 ; Option 3. The following SQL...SELECT title FROM movie,casting,actor WHERE movieid = movie.id AND actor.id = actorid AND name = 'Marilyn Monroe' AND yr = 1959 ; Option 4. The following SQL...SELECT title FROM movie,casting,actor WHERE movieid = movie.id AND actor.id = actorid AND movie.yr = casting.yr AND name = 'Marilyn Monroe' AND yr = 1959 ; Question 5Select one:a.Option 1b.Option 2c.Option 3d.Option 4
List titles of films with 10 or more actors playing the act. Sort the output on descending order of actors per film.will the below query will provide you the correct result SELECT title as Film_Name, count(actor_id) as Total_ActorsFROM filmINNER JOINfilm_actorONfilm.film_id=film_actor.film_idGroup by film.film_idhaving Total_Actors > 9ORDER BYTotal_Actors DESC, titlea.Trueb.False
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.