怎么没有学习课件
你跟着视频,自己动手去敲,重在理解
自己建的,和老师有一丢丢不一样,数据也插入了,自取,可参考。
-- 师徒四人
CREATE TABLE user1(
id TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
user_name VARCHAR(20),
user_over VARCHAR(20),
mobile VARCHAR(20)
)
INSERT INTO user1 VALUES(NULL,'唐僧','功德佛',NULL);
INSERT INTO user1 VALUES(NULL,'猪八戒','净坛使者',NULL);
INSERT INTO user1 VALUES(NULL,'孙悟空','斗战胜佛',NULL);
INSERT INTO user1 VALUES(NULL,'沙僧','金身罗汉',NULL);
SELECT * FROM user1;
-- 悟空结拜兄弟
CREATE TABLE user2(
id TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
user_name VARCHAR(20),
user_over VARCHAR(20)
);
INSERT INTO user2 VALUES(NULL,'孙悟空','成佛');
INSERT INTO user2 VALUES(NULL,'牛魔王','被降伏');
INSERT INTO user2 VALUES(NULL,'蛟魔王','被降伏');
INSERT INTO user2 VALUES(NULL,'鹏魔王','被降伏');
INSERT INTO user2 VALUES(NULL,'狮驼王','被降伏');
SELECT * FROM user2;
-- 打怪记录表
CREATE TABLE user_kills(
id TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
user_id TINYINT UNSIGNED,
timestr DATETIME,
kills SMALLINT UNSIGNED
)
INSERT INTO user_kills VALUES(NULL,2,'2013-01-10',10);
INSERT INTO user_kills VALUES(NULL,2,'2013-02-01',2);
INSERT INTO user_kills VALUES(NULL,2,'2013-02-05',12);
INSERT INTO user_kills VALUES(NULL,4,'2013-01-10',3);
INSERT INTO user_kills VALUES(NULL,4,'2013-02-11',5);
INSERT INTO user_kills VALUES(NULL,4,'2013-02-06',1);
INSERT INTO user_kills VALUES(NULL,3,'2013-01-11',20);
INSERT INTO user_kills VALUES(NULL,3,'2013-02-12',10);
INSERT INTO user_kills VALUES(NULL,3,'2013-02-07',17);
SELECT * FROM user_kills;
自己建表也不麻烦
最基本的原始表都没有 模拟起来都很麻烦,你也要人性化一点吧