1. 程式人生 > 其它 >video_website建立資料表

video_website建立資料表

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)
);