Question

a) [1 pt] Import data (SQL code is provided. Test prog3_createTable.sql on your server): Each of...

a) [1 pt] Import data (SQL code is provided. Test prog3_createTable.sql on your server): Each of you will work in your own database with the name cs4402xx;; Import the movie data movie-­name_score.txt into a new table called movies with the schema: movies(movie_id integer, name varchar(1000), score integer)

Import the movie cast data at movie-­cast.txt into a new table called cast with the schema:

cast(movie_id integer, cast_id integer, cast_name varchar(1000)).

j) [10 pt] Finding good collaborators: Create a view (virtual table) called ‘good collaboration’ that lists pairs of stars who appeared in movies. Each row in the table describes one pair of stars who have appeared in at least 4 movies together AND each of the movie has score >= 75. The view should have the format: collaboration (cast_member_id1, cast_member_id2, num_movies, avg_movie_score). Exclude self pairs: (cast_member_id1 == cast_member_id2). Keep symmetrical or mirror pairs. For example, keep both (A, B) and (B, A). Hint: Self-­Joins will likely be a necessary. After creating a view, list (cast_member_id1, cast_member_id2, num_movies, avg_movie_score) sorted by average movie scores from the view.

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

a)

USE SW
CREATE TABLE EMPLOYEES
(
EmployeeNo                      CHAR(10)             NOT NULL           UNIQUE,
DepartmentName            CHAR(30)             NOT NULL           DEFAULT “Human Resources”,
FirstName                           CHAR(25)             NOT NULL,
LastName                            CHAR(25)             NOT NULL,
Category                              CHAR(20)             NOT NULL,
HourlyRate                         CURRENCY          NOT NULL,
TimeCard                             LOGICAL              NOT NULL,
HourlySalaried                   CHAR(1)               NOT NULL,
EmpType                             CHAR(1)               NOT NULL,
Terminated                       LOGICAL              NOT NULL,
ExemptCode                       CHAR(2)               NOT NULL,
Supervisor                           LOGICAL              NOT NULL,
SupervisorName                CHAR(50)             NOT NULL,
BirthDate                             DATE                     NOT NULL,
CollegeDegree                     CHAR(5)               NOT NULL,
CONSTRAINT                     Employee_PK    PRIMARY KEY(EmployeeNo
);

j)

select distinct
    Movie
from 
    CastMember
where 
    Movie in (
        select Movie
        from CastMember
        where Actor = 1
    )
    and Movie in (
        select Movie
        from CastMember
        where Actor = 2
    ) 
    and Movie in (
        select Movie
        from CastMember
        where Actor = 3
    )
Add a comment
Know the answer?
Add Answer to:
a) [1 pt] Import data (SQL code is provided. Test prog3_createTable.sql on your server): Each of...
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
  • Overview This lab provides you the opportunity to insert and update data with the use of SQL comm...

    Overview This lab provides you the opportunity to insert and update data with the use of SQL commands. The lab will utilize the FLIX2YOU problem, the current schema. In order to start this lab, you must have successfully completed Lab # 6. In Lab # 6, you executed a script that was provided to you. This script created 7 of the FLIX2YOU tables as documented in the Entity Relationship Diagram in the FLIX2YOU problem document. The second part of lab...

  • Python coding exercise: please include comments Goal #1: import financial data given into your program provided...

    Python coding exercise: please include comments Goal #1: import financial data given into your program provided to you as a CSV formatted text file Use the following data for testing (the following is only a sample of the data; there are over 4000 rows of data): *Note: The data you will read in is linear by date (but, non-contiguous due to holidays and weekends,) reflecting a timeline of stock performance in chronological order; however your program should run through the...

  • Python coding exercise: please include comments Goal #1: import financial data given into your pr...

    Python coding exercise: please include comments Goal #1: import financial data given into your program provided to you as a CSV formatted text file Use the following data for testing (the following is only a sample of the data; there are over 4000 rows of data): *Note: The data you will read in is linear by date (but, non-contiguous due to holidays and weekends,) reflecting a timeline of stock performance in chronological order; however your program should run through the...

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