Deliverables:
1. You should submit your four SQL scripts satisfying each steps in the project. Feel free to compress the files using WinZip and save as YournameProject2.zip.
2. Submit in your WebTycho portfolio in the Project 2 area before the due date. Please contact the instructor before the due date if you have any questions or concerns.
I strongly suggest you also submit your spool files.
Project Grading Overview
In the grade book, the total number of points will be set to 100. The project elements will be assessed as follows:
Attributes
Value
Insert Statements
25 points
SelectStatements
35 points
Update Statements
25 points
Delete Statements
15 points
Project Grading Rubric
Attribute
(0-12) Points
(12-20) Points
(21-25) Points
Points
Inserts
- Poor SQL insert statements minimally addressing the functionality
- Poor design and formatting
- Commits not included
- Major integrity constraint violations present
- Good SQL insert statements addressing most functionality
- Statement has a good design but could be clearer or better formatted
- Commits included
- Minor integrity constraint violations may be present
- Excellent, efficient SQL insert statements addressing all functionality
- Statement is designed well, clear and neatly formatted
- Commits included
- No integrity constraint violations
Attribute
(0-17) Points
(18-27) Points
(28-35) Points
Points
Selects
- Poor SQL select statements minimally addressing the functionality
- Poor design and formatting
- Multi-table joins are mostly incorrect
- Output display missing or of poor quality
- Good SQL select statements addressing most functionality
- Statement has a good design but could be clearer of better formatted
- Multi-table joins are reasonable but may include some non-standard syntax or inefficiencies.
- Good output display but could provide minor areas difficult to follow
- Excellent, efficient SQL select statements addressing all functionality
- Statement is designed well, clear and neatly formatted
- Multi-table joins are efficient using correct syntax
- Excellent clean and well-organized output display
Attribute
(0-12) Points
(12-20) Points
(21-25) Points
Points
Updates
- Poor SQL update statements minimally addressing the functionality
- Poor design and formatting
- Commits not included
- Major integrity constraint violations present
- Good SQL update statements addressing most functionality
- Statement has a good design but could be clearer or better formatted
- Commits included
- Minor integrity constraint violations may be present
- Excellent, efficient SQL update statements addressing all functionality
- Statement is designed well, clear and neatly formatted
- Commits included
- No integrity constraint violations
Attribute
(0-7) Points
(8-11) Points
(12-15) Points
Points
Deletes
- Poor SQL delete statements minimally addressing the functionality
- Poor design and formatting
- Commits not included
- Major int.
Deliverables1. You should submit your four SQL scripts s.docx
1. Deliverables:
1. You should submit your four SQL scripts satisfying each
steps in the project. Feel free to compress the files using
WinZip and save as YournameProject2.zip.
2. Submit in your WebTycho portfolio in the Project 2 area
before the due date. Please contact the instructor before the due
date if you have any questions or concerns.
I strongly suggest you also submit your spool files.
Project Grading Overview
In the grade book, the total number of points will be set to 100.
The project elements will be assessed as follows:
Attributes
Value
Insert Statements
25 points
SelectStatements
35 points
Update Statements
25 points
Delete Statements
15 points
Project Grading Rubric
Attribute
(0-12) Points
(12-20) Points
(21-25) Points
Points
Inserts
- Poor SQL insert statements minimally addressing the
functionality
2. - Poor design and formatting
- Commits not included
- Major integrity constraint violations present
- Good SQL insert statements addressing most functionality
- Statement has a good design but could be clearer or better
formatted
- Commits included
- Minor integrity constraint violations may be present
- Excellent, efficient SQL insert statements addressing all
functionality
- Statement is designed well, clear and neatly formatted
- Commits included
- No integrity constraint violations
Attribute
(0-17) Points
(18-27) Points
(28-35) Points
Points
Selects
- Poor SQL select statements minimally addressing the
functionality
- Poor design and formatting
- Multi-table joins are mostly incorrect
- Output display missing or of poor quality
3. - Good SQL select statements addressing most functionality
- Statement has a good design but could be clearer of better
formatted
- Multi-table joins are reasonable but may include some non-
standard syntax or inefficiencies.
- Good output display but could provide minor areas difficult to
follow
- Excellent, efficient SQL select statements addressing all
functionality
- Statement is designed well, clear and neatly formatted
- Multi-table joins are efficient using correct syntax
- Excellent clean and well-organized output display
Attribute
(0-12) Points
(12-20) Points
(21-25) Points
Points
Updates
- Poor SQL update statements minimally addressing the
functionality
- Poor design and formatting
- Commits not included
- Major integrity constraint violations present
- Good SQL update statements addressing most functionality
4. - Statement has a good design but could be clearer or better
formatted
- Commits included
- Minor integrity constraint violations may be present
- Excellent, efficient SQL update statements addressing all
functionality
- Statement is designed well, clear and neatly formatted
- Commits included
- No integrity constraint violations
Attribute
(0-7) Points
(8-11) Points
(12-15) Points
Points
Deletes
- Poor SQL delete statements minimally addressing the
functionality
- Poor design and formatting
- Commits not included
- Major integrity constraint violations present
- Good SQL delete statements addressing most functionality
- Statement has a good design but could be clearer or better
formatted
- Commits included
5. - Minor integrity constraint violations may be present
- Excellent, efficient SQL delete statements addressing all
functionality
- Statement is designed well, clear and neatly formatted
- Commits included
- No integrity constraint violations
Janelle Chpaman – Project 1 April 13, 2014
List of entities:
Actor Actor
Borrowing Rental History
Cast Actor in MovieTitle
Customer Customer
Discount Discount prices for certain movies or types of movies
Distributor Distributor of Movies
DistributorMovieType What movie types distributor provides
DVD Descendant of Movie format
Fee Late and damaged fees, failure to rewind fees and so on for
6. each Borrowing
Movie Video or DVD of Movie
MovieAward Academy Awards won (by the movie, the actors,
the actresses and/or the directors)
MovieAwardType Academy Award type
MovieTitle Name of Movie
MobieTitleType Movie classification
MovieType Types of Movie (suspense, horror, mystery, comedy,
etc.)
Video Descendant of Movie format
Relationships:
Actor Cast Actor takes part in many movie Casts.
Borrowing Fee When custmer Borrows a movie, one or more
Fees are connected with this action.
Borrowing Customer One Customer Borrows zero or more
movies (with assumption that customer can only chose to
register).
Borrowing Movie Movie can be Borrowed by one or more
customers.
Cast MovieTitle Each MovieTitle can play multiple Actors
(M:N relationship replaced by Cast entity).
7. Discount MovieTitle One MovieTitle can take part in several
(time limited) Discount offers.
Discount MovieType One MovieType can take part in several
(time limited) Discount offers.
Distributor Movie Each Distributor provides one or more
Movies.
Distributor DistributorMovieType Each Distributor provides
one ore more MovieTypes and each MovieType can be provided
by multiple
Distributors so this M:N relationship was replaced by the
DistributorMovieType entity.
Janelle Chpaman – Project 1 April 13, 2014
DistributorMovieType MovieType Each Distributor provides
one ore more MovieTypes and each MovieType can be provided
by more
Distributors so this M:N relationship was replaced by
DistributorMovieType entity
DVD Movie DVD is descendant of Movie.
Video Movie Video is descendant of Movie.
Movie MovieTitle Each MovieTitle exists on one or more media
types.
MovieAward MovieAwardType Movie Award is one of the
Movie Award Types.
8. MovieAward MovieTitle One MovieTitle can win zero or
multiple Awards.
MovieTitle MovieTitleType Each MovieTitle can be assigned to
multiple MovieTypes and multiple Movies of each MovieType
exists
so this M:N relationship was replaced by MovieTitleType
entity.
MovieTitleType MovieType Each MovieTitle can be assigned to
multiple MovieTypes and multiple Movies of each MovieType
exists
so this M:N relationship was replaced by MovieTitleType
entity.
Janelle Chpaman – Project 1 April 13, 2014
erd MomAndPop
Movie
DVD Video
MovieT itle
Distributor
MovieT ype
DistributorPrice
13. Janelle Chpaman – Project 1 April 13, 2014
create table CUSTOMER
( CUST_ID bigint not null,
FIRST_NAME varchar(50) not null,
LAST_NAME varchar(50) not null,
STREET varchar(50),
CITY varchar(50) not null,
ZIP varchar(10),
EMAIL varchar(50),
PHONE varchar(20)
PRIMARY KEY (CUST_ID)
)
GO
create table DISTRIBUTOR
( CODE varchar(15) not null,
NAME varchar(50)
PRIMARY KEY (CODE)
)
GO
create table MOVIE_TYPE
( CODE char(5) not null,
NAME varchar(50)
PRIMARY KEY (CODE)
)
GO
create table ACTOR
( ACTOR_ID int not null,
FIRST_NAME varchar(50) not null,
14. LAST_NAME varchar(50) not null
PRIMARY KEY (ACTOR_ID)
)
GO
create table MOVIE_TITLE
( ID_NUMBER bigint not null,
NAME varchar(50) not null,
RATING smallint,
RUNNING_LENGTH smallint,
Janelle Chpaman – Project 1 April 13, 2014
CATALOG_DESCRIPTION text,
YEAR_RELEASED smallint
PRIMARY KEY (ID_NUMBER)
)
GO
create table MOVIE_TITLE_TYPE
( MOVIE_TITLE_ID bigint not null FOREIGN KEY
REFERENCES MOVIE_TITLE(ID_NUMBER),
MOVIE_TYPE_CODE char(5) not null FOREIGN KEY
REFERENCES MOVIE_TYPE(CODE),
PRIMARY KEY (MOVIE_TITLE_ID, MOVIE_TYPE_CODE)
)
GO
create table MOVIE
( ID_NUMBER bigint not null,
MEDIA_TYPE char(1) not null CHECK (MEDIA_TYPE in
('D', 'V')), -- D=DVD, V=Video
DISTRIBUTOR_PRICE numeric(5,2) not null,
15. SERIAL_NUMBER varchar(30) not null,
CUSTOMER_PRICE numeric(5,2) not null,
MOVIE_TITLE_ID bigint not null FOREIGN KEY
REFERENCES MOVIE_TITLE(ID_NUMBER)
PRIMARY KEY (ID_NUMBER)
)
GO
create table [CAST]
( ACTOR_ID int not null FOREIGN KEY REFERENCES
ACTOR(ACTOR_ID),
MOVIE_TITLE_ID bigint not null FOREIGN KEY
REFERENCES MOVIE_TITLE(ID_NUMBER),
[ROLE] varchar(100)
PRIMARY KEY (ACTOR_ID, MOVIE_TITLE_ID)
)
GO
create table MOVIE_AWARD_TYPE
( ID smallint not null,
NAME varchar(50) not null,
PRIMARY KEY (ID)
)
GO
create table MOVIE_AWARD
Janelle Chpaman – Project 1 April 13, 2014
( MOVIE_TITLE_ID bigint not null FOREIGN KEY
REFERENCES MOVIE_TITLE(ID_NUMBER),
[YEAR] smallint not null,
MOVIE_AWARD_TYPE_ID smallint not null FOREIGN KEY
16. REFERENCES MOVIE_AWARD_TYPE(ID)
PRIMARY KEY (MOVIE_TITLE_ID,
[YEAR],MOVIE_AWARD_TYPE_ID)
)
GO
create table DISCOUNT
( ID bigint not null,
MOVIE_TITLE_ID bigint null FOREIGN KEY REFERENCES
MOVIE_TITLE(ID_NUMBER),
MOVIE_TYPE_CODE char(5) FOREIGN KEY REFERENCES
MOVIE_TYPE(CODE),
DATE_FROM datetime not null,
DATE_TO datetime not null,
AMOUNT numeric(5,2)
PRIMARY KEY (ID)
)
GO
create table DISTRIBUTOR_MOVIE_TYPE
( DISTRIBUTOR_CODE varchar(15) not null FOREIGN KEY
REFERENCES DISTRIBUTOR(CODE),
MOVIE_TYPE_CODE char(5) not null FOREIGN KEY
REFERENCES MOVIE_TYPE(CODE),
DATE_FROM datetime not null,
DATE_TO datetime not null,
AMOUNT numeric(5,2)
PRIMARY KEY (DISTRIBUTOR_CODE,
MOVIE_TYPE_CODE)
)
GO
create table BORROWING
( ID bigint not null,
CUSTOMER_ID bigint not null FOREIGN KEY
REFERENCES CUSTOMER(CUST_ID),
17. MOVIE_ID bigint not null FOREIGN KEY REFERENCES
MOVIE(ID_NUMBER),
DATE_RENTED datetime not null,
TO_DATE datetime not null,
DATE_RETURNED datetime
PRIMARY KEY (ID)
)
GO
create table FEE
Janelle Chpaman – Project 1 April 13, 2014
( BORROWING_ID bigint not null FOREIGN KEY
REFERENCES BORROWING(ID),
FEE_TYPE char(1) CHECK (FEE_TYPE in ('L', 'D', 'F')), --
L=Late, D=Damage, F=Failure
FEE_DATE numeric(5,2) not null,
AMOUNT numeric(5,2) not null,
PRIMARY KEY (BORROWING_ID, FEE_TYPE, FEE_DATE)
)
GO