1.创建表offices、employees两张数据表
mysql> CREATE TABLE offices(
officeCode INT(10) PRIMARY KEY NOT NULL,
city VARCHAR(50) NOT NULL,
address VARCHAR(50),
country VARCHAR(50) NOT NULL,
postalCode VARCHAR(15) UNIQUE
);
查看
CREATE TABLE employees(
employeeNumber INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
lastName VARCHAR(50) NOT NULL,
firstName VARCHAR(50) NOT NULL,
mobile VARCHAR(25) UNIQUE,
officeCode INT(10) NOT NULL,
jobTitle VARCHAR(50) NOT NULL,
birth datetime NOT NULL,
note VARCHAR(255),
sex VARCHAR(5),
FOREIGN KEY (officeCode) REFERENCES offices(officeCode)
);
(1) 将表employees的mobile字段修改到officeCode字段后面
(2)将表employees的birth字段改名为employee_birth
(3)修改sex字段,数据类型为CHAR(1),非空约束
(4)删除字段note
(5)增加字段名favoriate_activity,数据类型为VARCHAR(100)