SET NAMES
UTF8;
DROP DATABASE IF EXISTS
tmooc;
CREATE DATABASE tmooc CHARSET=UTF8;
USE tmooc;
CREATE TABLE stu(
sid INT PRIMARY KEY AUTO_INCREMENT,
sname VARCHAR(32) UNIQUE,
score DOUBLE,
schoolTime DATE
);
INSERT INTO stu(sname,schoolTime)values("shu",now());
INSERT INTO stu(sname,schoolTime)values("EN",now());
INSERT INTO stu(sname,schoolTime)values("huang",now());
INSERT INTO stu(sname,schoolTime)values("hse",now());
--解决问题,创建表失误,少了一列,下面语句可以补一句
ALTER TABLE stu ADD score DOUBLE(10,2);
--给分数赋初值,不然都会默认为null
UPDATE stu SET score=0;