0% found this document useful (0 votes)
276 views14 pages

CS457B Final Project1

This document summarizes a final project for a video store database. It includes entity relationship diagrams using crow's foot notation, entity to table mapping diagrams, definitions for the Customer, DVD, TotalRent, and Payment tables, sample data for the tables, and examples of queries on the database.

Uploaded by

HareshPatel
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
276 views14 pages

CS457B Final Project1

This document summarizes a final project for a video store database. It includes entity relationship diagrams using crow's foot notation, entity to table mapping diagrams, definitions for the Customer, DVD, TotalRent, and Payment tables, sample data for the tables, and examples of queries on the database.

Uploaded by

HareshPatel
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 14

CS457B FINAL PROJECT

VIDEO STORE
Pranav Patel (ID-6798)
Haresh Patel (ID-6746)
Dhvanil Gamit (ID-6902)
ERD in crow’s foot
notation
CUSTOME RENTAL DVD
R CUST_ID DVD_ID
CUST_ID DVD_ID DVD_TITLE
(PK) HISTORY DVD_CAT
CUST_FNAM CATEGORY ACTOR
E ACTRESS
CUST_LNAM
E
CUST_ADD
CUST_PHON PAYMENT
E RECEIPT_ID
CUST_ID
(FK)
METHOD
AMOUNT
Entity To Table mapping
diagrams
 CUST_FNAM
CUST_ID E
Custome (PK)

r CUSTOME CUST_ADD
R

CUST_LNAM CUST_PHON
E E


TotalRen CUST_ID DVD_ID
(FK)
t (FK)

TotalRen
t

HISTORY CATEGORY
Entity To Table mapping
diagrams
 DVD
DVD_ID DVD_TITLE DVD_CAT
(PK)

DVD

ACTOR ACTRESS


Payment RECEIPT_ID CUST_ID
(FK)

PAYMENT

METHOD AMOUNT
TABLES
CUSTOMER Tables
 CREATE TABLE Customer (cust_ID NUMBER(3),cust_fname
VARCHAR(10),cust_lname VARCHAR(10),cust_add CHAR(50),
cust_phone NUMBER(10), CONSTRAINT Customer_pk PRIMARY
KEY (cust_ID));

CUST_ID CUST_FNA CUST_LNA CUST_AD CUST_PH


ME ME D ONE
100 Alok Bhatt Milpitas 408123134
4
101 Mitul Patel Milpitas 408341546
6
102 Trilok Purohit Milpitas 408341553
3
DVD Table
 Create table DVD ( dvd_ID NUMBER(4), dvd_title
VARCHAR(10), dvd_cat VARCHAR(10), Actor CHAR(10),
Actress CHAR(10), CONSTRAINT DVD_pk PRIMARY KEY
(dvd_ID));
DVD_ID DVD_TITL DVD_CAT ACTOR ACTRESS
1001 E
Allmighty Comedy Jim Carrey Aniston
Mike
1002 Love Guru Comedy Alba
Myers
1003 Oceans 11 Drama Brad Pitt Julia

1004 Bond007 Action DanielCrag Eva Green

1005 OutOfSight Thriller Clooney JLopez


1006 AGangster Thriller Rusel Crow JoshBrolin
1007 Hulk Action ENorton Liv Tyler
1008 Titanic Drama LDecaprio KWinslet
TOTAL RENT Table
 Create table TotalRent ( CUST_ID NUMBER(3), DVD_ID
NUMBER(4), History VARCHAR(10), Category CHAR(10),
CONSTRAINT TotalRent_fk1 FOREIGN KEY (CUST_ID) REFERENCES
Customer(CUST_ID), CONSTRAINT TotalRent_fk2 FOREIGN KEY
(DVD_ID) REFERENCES
CUST_ID DVD_IDDVD(DVD_ID));
HISTORY CATEGORY
101 1001 Not Late Comedy
101 1003 Not Late Drama
101 1004 Not Late Drama
102 1004 Not Late Drama
102 1002 Not Late Comedy
102 1008 Not Late Action
102 1007 Late Action
102 1006 Late Thriller
100 1001 Late Comedy
100 1006 Not Late Thriller
PAYMENT Table
 Create table Payment ( Receipt_ID NUMBER(4),CUST_ID
NUMBER(3),Method VARCHAR(10), Amount NUMBER(3),
CONSTRAINT PAYMENT_pk PRIMARY KEY
(Receipt_ID),CONSTRAINT PAYMENT_fk1 FOREIGN KEY
(CUST_ID) REFERENCES Customer(CUST_ID));

RECEIPT_I AMOUNT
CUST_ID METHOD
D ($)
9001 100 CARD 20
9002 101 CASH 30
9003 102 CARD 50
QUERRIES
How many movies a customer
ever rented?

SELECT count(*) FROM TotalRent where


CUST_ID=101;

COUNT(*)

3
How many times a customer
returned a movie late?

SELECT count(*) FROM TotalRent where


HISTORY='Late' and
CUST_ID=101;

COUNT(*)

0
Which category movie a customer
rented out the most times?

SELECT CUST_ID,COUNT(CATEGORY),CATEGORY
from TotalRent WHERE (TotalRent.CUST_ID=102)
group by CUST_ID,CATEGORY;

COUNT(CATEG
CUST_ID CATEGORY
ORY)
102 1 Comedy
102 1 Drama
102 2 Action
102 1 Thriller
Thank You

You might also like