CREATE DATABASE `video_website`;
USE `video_website`;
CREATE TABLE admin
(
aid INT AUTO_INCREMENT
PRIMARY KEY,
admin_name VARCHAR(20) NOT NULL,
PASSWORD VARCHAR(50) NOT NULL
);
INSERT INTO admin(admin_name, PASSWORD) VALUE ('管理员甲','glyj123');
INSERT INTO admin(admin_name, PASSWORD) VALUE ('管理员乙','glyy123');
INSERT INTO admin(admin_name, PASSWORD) VALUE ('管理员丙','glyb123');
INSERT INTO admin(admin_name, PASSWORD) VALUE ('管理员丁','glyd123');
CREATE TABLE film
(
fid INT AUTO_INCREMENT
PRIMARY KEY,
title VARCHAR(20) NOT NULL,
protagonist VARCHAR(300) NOT NULL,
director VARCHAR(200) NOT NULL,
TYPE VARCHAR(10) NOT NULL,
release_date VARCHAR(20) NOT NULL,
synopsis VARCHAR(1000) NOT NULL,
location VARCHAR(20) NOT NULL,
film_source VARCHAR(10) NOT NULL
);
CREATE TABLE upfilm
(
id INT AUTO_INCREMENT
PRIMARY KEY,
DATE DATETIME NOT NULL,
title VARCHAR(20) NOT NULL,
TYPE VARCHAR(20) NOT NULL,
ip_location VARCHAR(50) NOT NULL,
STATUS VARCHAR(10) NOT NULL,
delete_film VARCHAR(10) DEFAULT 'no' NULL,
userid INT NOT NULL
);
CREATE TABLE USER
(
uid INT AUTO_INCREMENT
PRIMARY KEY,
username VARCHAR(20) NOT NULL,
PASSWORD VARCHAR(50) NOT NULL,
email VARCHAR(50) NULL,
jurisdiction VARCHAR(300) DEFAULT '在线播放影片 下载影片 上传影片和分集,收藏影片' ,
registration_date DATETIME NOT NULL,
user_type VARCHAR(100) DEFAULT '普通用户'
);
CREATE TABLE user_favorite_movie
(
user_id INT NOT NULL,
movie_id INT NOT NULL,
PRIMARY KEY (user_id, movie_id)
);