基于oracle,SQL,Mysql的影片租赁管理系统数据库设计
当今社会,人们的日常生活越来越丰富,小型音像租赁店逐渐成长起来,业务量也在不断扩大,传统低效的人工管理已经不合时宜。可以通过 建立一个 易于访问并便于更新的 音像租赁数据库管理系统,实现 随时掌握影碟租赁的情况, 管理顾客, 快速有效地 查询顾客
当今社会,人们的日常生活越来越丰富,小型音像租赁店逐渐成长起来,业务量也在不断扩大,传统低效的人工管理已经不合时宜。可以通过建立一个易于访问并便于更新的音像租赁数据库管理系统,实现随时掌握影碟租赁的情况,管理顾客,快速有效地查询顾客租赁记录和电影出租记录等功能。
1 系统需求分析
1.1本系统的业务和任务
音像租赁店承接影碟的租借和归还业务,它的任务是为所有的会员提供优质服务,方便快捷地完成影碟租赁业务。
1.2信息需求
音像租赁店需要掌握其所拥有的所有的电影的信息,包括编号、名字、类型、国家、导演、演员等,可以存储为DVD或者VHS格式,因此每个电影都有其对应的DVD或VHS编号。每部电影会有多个拷贝,并且每部电影至少有一个DVD或者VHS版本。每一个DVD或者VHS都是某一个单独特定的电影的拷贝,即一部电影不会需要多张DVD或者VHS。
还需要跟踪每部电影中的明星演员。顾客希望知道每一个演员的信息,包括演员的艺名、真实的名字和生日等。
音像租赁店需要掌握每一位成为会员的顾客的详细信息,包括他们的名和姓,电话号码和当前住址等。
最重要的是,音像租赁店要跟踪每一个会员的租赁情况,包括该会员当前租赁了什么电影,租借日期和归还日期等。在任何时间,顾客可以租赁多个DVD和磁带。通过了解租赁历史,音像租赁店还能够分析其租赁模式,如可以确定每一个会员租借了多少个DVD/tapes, 以及每个会员推迟归还的次数,也能知道每个特定的DVD或者tape被使用的次数,从而确定它什么时候报废,也能分析音像租赁店会员的整体的电影喜好。
1.3本系统的业务规则
音像租赁店店主或管理员可为任何会员提供服务,会员是指加入video club的顾客。店主或管理员能够根据需要输入、保存和查询每张影碟及每位会员的相关信息。
采用Oracle SQL developer data modeler设计,进而生成代码。
由于不能插入图片等内容,先只发布生成的代码。
第一次发布内容,高手见笑了
-- 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


MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

Use the EXPLAIN command to analyze the execution plan of MySQL queries. 1. The EXPLAIN command displays the execution plan of the query to help find performance bottlenecks. 2. The execution plan includes fields such as id, select_type, table, type, possible_keys, key, key_len, ref, rows and Extra. 3. According to the execution plan, you can optimize queries by adding indexes, avoiding full table scans, optimizing JOIN operations, and using overlay indexes.

Subqueries can improve the efficiency of MySQL query. 1) Subquery simplifies complex query logic, such as filtering data and calculating aggregated values. 2) MySQL optimizer may convert subqueries to JOIN operations to improve performance. 3) Using EXISTS instead of IN can avoid multiple rows returning errors. 4) Optimization strategies include avoiding related subqueries, using EXISTS, index optimization, and avoiding subquery nesting.

Methods for configuring character sets and collations in MySQL include: 1. Setting the character sets and collations at the server level: SETNAMES'utf8'; SETCHARACTERSETutf8; SETCOLLATION_CONNECTION='utf8_general_ci'; 2. Create a database that uses specific character sets and collations: CREATEDATABASEexample_dbCHARACTERSETutf8COLLATEutf8_general_ci; 3. Specify character sets and collations when creating a table: CREATETABLEexample_table(idINT

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

Renaming a database in MySQL requires indirect methods. The steps are as follows: 1. Create a new database; 2. Use mysqldump to export the old database; 3. Import the data into the new database; 4. Delete the old database.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
