基于oracle,SQL,Mysql的影片租赁管理系统数据库设计

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

-- Generated by Oracle SQL Developer Data Modeler 3.0.0.653
--   at:        2012-09-06 12:18:46 CST
--   site:      Oracle Database 10g
--   type:      Oracle Database 10g



CREATE TABLE actor 
    ( 
     actor_id INTEGER  NOT NULL , 
     actor_name VARCHAR2 (20 CHAR)  NOT NULL , 
     actor_first_name VARCHAR2 (20 CHAR)  NOT NULL , 
     actor_last_name VARCHAR2 (20 CHAR)  NOT NULL , 
     actor_birthday DATE 
    ) 
;



ALTER TABLE actor 
    ADD CONSTRAINT actor_PK PRIMARY KEY ( actor_id ) ;


CREATE TABLE actorlist 
    ( 
     actorlist_datetime DATE  NOT NULL , 
     actor_actor_id INTEGER  NOT NULL , 
     cinema_cinema_is INTEGER  NOT NULL 
    ) 
;




CREATE TABLE cinema 
    ( 
     cinema_is INTEGER  NOT NULL , 
     cinema_name VARCHAR2 (10 CHAR)  NOT NULL , 
     cinema_type VARCHAR2 (10 CHAR)  NOT NULL , 
     cinema_country VARCHAR2 (20 CHAR)  NOT NULL , 
     type_type_id INTEGER  NOT NULL 
    ) 
;



ALTER TABLE cinema 
    ADD CONSTRAINT cinema_PK PRIMARY KEY ( cinema_is ) ;


CREATE TABLE customer 
    ( 
     customer_id INTEGER  NOT NULL , 
     customer_first_name VARCHAR2 (20 CHAR)  NOT NULL , 
     customer_last_name VARCHAR2 (20 CHAR)  NOT NULL , 
     customer_phone_number VARCHAR2 (20 CHAR)  NOT NULL , 
     customer_address VARCHAR2 (40 CHAR)  NOT NULL 
    ) 
;



ALTER TABLE customer 
    ADD CONSTRAINT customer_PK PRIMARY KEY ( customer_id ) ;


CREATE TABLE rental 
    ( 
     rental_datetime DATE  NOT NULL , 
     return_datetime DATE , 
     customer_customer_id INTEGER  NOT NULL , 
     video_video_id INTEGER  NOT NULL 
    ) 
;



ALTER TABLE rental 
    ADD CONSTRAINT rental_PK PRIMARY KEY ( rental_datetime ) ;


CREATE TABLE type 
    ( 
     type_id INTEGER  NOT NULL , 
     type_description VARCHAR2 (40 CHAR) 
    ) 
;



ALTER TABLE type 
    ADD CONSTRAINT type_PK PRIMARY KEY ( type_id ) ;


CREATE TABLE video 
    ( 
     video_id INTEGER  NOT NULL , 
     video_format VARCHAR2 (10 CHAR)  NOT NULL , 
     video_deadline DATE  NOT NULL , 
     cinema_cinema_is INTEGER  NOT NULL 
    ) 
;



ALTER TABLE video 
    ADD CONSTRAINT video_PK PRIMARY KEY ( video_id ) ;



ALTER TABLE actorlist 
    ADD CONSTRAINT actorlist_actor_FK FOREIGN KEY 
    ( 
     actor_actor_id
    ) 
    REFERENCES actor 
    ( 
     actor_id
    ) 
;


ALTER TABLE actorlist 
    ADD CONSTRAINT actorlist_cinema_FK FOREIGN KEY 
    ( 
     cinema_cinema_is
    ) 
    REFERENCES cinema 
    ( 
     cinema_is
    ) 
;


ALTER TABLE cinema 
    ADD CONSTRAINT cinema_type_FK FOREIGN KEY 
    ( 
     type_type_id
    ) 
    REFERENCES type 
    ( 
     type_id
    ) 
;


ALTER TABLE rental 
    ADD CONSTRAINT rental_customer_FK FOREIGN KEY 
    ( 
     customer_customer_id
    ) 
    REFERENCES customer 
    ( 
     customer_id
    ) 
;


ALTER TABLE rental 
    ADD CONSTRAINT rental_video_FK FOREIGN KEY 
    ( 
     video_video_id
    ) 
    REFERENCES video 
    ( 
     video_id
    ) 
;


ALTER TABLE video 
    ADD CONSTRAINT video_cinema_FK FOREIGN KEY 
    ( 
     cinema_cinema_is
    ) 
    REFERENCES cinema 
    ( 
     cinema_is
    ) 
;


    
    
    
    
    
    
    

-- Oracle SQL Developer Data Modeler Summary Report: 
-- 
-- CREATE TABLE                             7
-- CREATE INDEX                             0
-- ALTER TABLE                             12
-- CREATE VIEW                              0
-- CREATE PACKAGE                           0
-- CREATE PACKAGE BODY                      0
-- CREATE PROCEDURE                         0
-- CREATE FUNCTION                          0
-- CREATE TRIGGER                           0
-- CREATE STRUCTURED TYPE                   0
-- CREATE COLLECTION TYPE                   0
-- CREATE CLUSTER                           0
-- CREATE CONTEXT                           0
-- CREATE DATABASE                          0
-- CREATE DIMENSION                         0
-- CREATE DIRECTORY                         0
-- CREATE DISK GROUP                        0
-- CREATE ROLE                              0
-- CREATE ROLLBACK SEGMENT                  0
-- CREATE SEQUENCE                          0
-- CREATE MATERIALIZED VIEW                 0
-- CREATE SYNONYM                           0
-- CREATE TABLESPACE                        0
-- CREATE USER                              0
-- 
-- DROP TABLESPACE                          0
-- DROP DATABASE                            0
-- 
-- ERRORS                                   0
-- WARNINGS                                 0