View the module 2 videos as an introduction to creating relational databases and
ID: 3915525 • Letter: V
Question
View the module 2 videos as an introduction to creating relational databases and querying using joins:
Maroon Box ERD Discussion
Constraints and Joins
1.) Create the database
2.) Create the tables in including appropriate data types (Actors, Movies, ActorMovies, Directors)
3.) Create appropriate foreign key constraints
4.) Add data including at least 5 movies, the director, and at least 3 actors from each movie (put yourself in as an actor in at least two movies)
5.) Create and run the following queries. For each query copy and paste or screenshot the query and submit the result to assignment:
a query that joins the tables and displays all actors and all movies
a query that joins the tables and displays all actors in a particular movie
a query that joins the tables and displays only the movies in which you are an actor
create two additional queries of your choice that displays the data in a way that could be useful
3.) Submit your queries and the results they produce.
Dump your database to a .sql file and submit it to the assignment along with your queries and their results.
https://una.instructure.com/courses/31521/files/4642298/download?download_frd=1
http://www.screencast.com/t/9pChQ4jm
Explanation / Answer
1.
Above statement will create the database named movieDb.
2.
Below are the create table statements for the given ERD
3.
Below are the statements which will add foreign keys to the respective tables.
4.
Below are the insert statements which inserts sample values into the tables. Just change the values and execute as many times as you want to insert the records into the tables.
insert into Movies values (1,'Titanic','Love','12-01-1994','4.75',11);
insert into Movies values (2,'Life','11-09-2017','3.0',12);
insert into Movies values (3,'Sherloc Homes','23-05-2000','4.5',12);
insert into Movies values (4,'Batman','21-06-2007','4.25',13);
insert into Movies values (5,'Batmna Returns','25-03-2009','4.5',13);
insert into Actor values(21,'Praveen','Kumar','25-11-1990','M');
insert into Actor values(22,'Kumar','Praveen','24-10-1989','M');
insert into Director values (11,'Sai','Ram','12-02-1989','M');
insert into ActorMovies values(21,11,200000);
insert into ActorMvoies values(22,12,300000);
As per chegg policy I am allowed to answer only 4 parts . Kindly understand and repost the remaining as new post.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.