`sage` datetime DEFAULT NULL,
  `Ssex` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
# Data for table "student"
#INSERT INTO `student` VALUES ('01','赵磊','1990-01-01 00:00:00','男');DROP TABLE IF EXISTS `emp_pay_trmp`;
CREATE TABLE `emp_pay_trmp` (
  `city` char(20) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci NOT NULL DEFAULT '',
  `last_name` char(23) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci NOT NULL DEFAULT '',
  `first_na` varchar(255) DEFAULT NULL,
  `pay_rate` double(2,0) DEFAULT NULL,
  `salary` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
# Data for table "emp_pay_trmp"
#INSERT INTO `emp_pay_trmp` VALUES ('greenwood','stephens','tina',NULL,NULL),('indianapolis','plew','linda',NULL,NULL),('whiteland','glass',NULL,NULL,NULL),('indianapolis','plew','linda',NULL,NULL),('indianapolis','plew','linda',NULL,NULL),('indianapolis','plew','linda',NULL,NULL);#
# Structure for table "employe1"
#DROP TABLE IF EXISTS `employe1`;
CREATE TABLE `employe1` (
  `emp_id` char(9) NOT NULL,
  `position` varchar(15) NOT NULL,
  `emp_name` varchar(20) NOT NULL,
  `emp_page` int(10) DEFAULT NULL,
  `emp_phone` int(13) DEFAULT NULL,
  `pay_rate` double(4,2) NOT NULL,
  UNIQUE KEY `emp_phone` (`emp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
# Data for table "employe1"
#INSERT INTO `employe1` VALUES ('112','mysql>  select ','晓丽',21112,212,99.99),('113','2255','战台',456,NULL,0.00),('114','1213','董静',45,NULL,59.00),('118','1200','华斯',8966,1546,66.00);#
# Structure for table "employe2"
#DROP TABLE IF EXISTS `employe2`;
CREATE TABLE `employe2` (
  `emp_id` char(9) NOT NULL,
  `position` varchar(15) NOT NULL,
  `emp_name` varchar(20) NOT NULL,
  `emp_page` int(10) DEFAULT NULL,
  `emp_phone` char(12) DEFAULT NULL,
  `pay_rate` double(4,2) NOT NULL,
  UNIQUE KEY `emp_phone` (`emp_phone`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
# Data for table "employe2"
#INSERT INTO `employe2` VALUES ('','','',NULL,NULL,22.00),('','','',NULL,NULL,11.00),('101','','',NULL,NULL,0.00),('101','','',NULL,NULL,0.00);#
# Structure for table "employee_tb2"
#DROP TABLE IF EXISTS `employee_tb2`;
CREATE TABLE `employee_tb2` (
  `emp_id` char(9) NOT NULL,
  `emp_name` varchar(20) NOT NULL,
  `emp_page` int(10) DEFAULT NULL,
  `emp_phone` int(13) DEFAULT NULL,
  PRIMARY KEY (`emp_id`),
  UNIQUE KEY `emp_phone` (`emp_phone`)

解决方案 »

  1.   

    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
    # Data for table "employee_tb2"
    #INSERT INTO `employee_tb2` VALUES ('1001','123',NULL,1000),('1002','123',NULL,1001);#
    # Structure for table "employee_tbl"
    #DROP TABLE IF EXISTS `employee_tbl`;
    CREATE TABLE `employee_tbl` (
      `emp_id` char(9) NOT NULL,
      `emp_name` varchar(20) NOT NULL,
      `emp_page` int(10) DEFAULT NULL,
      PRIMARY KEY (`emp_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
    # Data for table "employee_tbl"
    #INSERT INTO `employee_tbl` VALUES ('101','dongjinghanng',NULL);#
    # Structure for table "employee1"
    #DROP TABLE IF EXISTS `employee1`;
    CREATE TABLE `employee1` (
      `emp_id` char(9) NOT NULL,
      `position` varchar(15) NOT NULL,
      `emp_name` varchar(20) NOT NULL,
      `emp_page` int(10) DEFAULT NULL,
      `emp_phone` int(13) DEFAULT NULL,
      UNIQUE KEY `emp_phone` (`emp_phone`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
    # Data for table "employee1"
    #INSERT INTO `employee1` VALUES ('112','','张好',NULL,123456);#
    # Structure for tab
      

  2.   

    注意:建表数据后期因为讲解习题插入的数值改动较大,数值只供参考alter table student add Snam varchar(10)  null;
    alter table student drop Snam ;
    create database Test1;//创建数据库
    use test1;//使用数据库
    create table Student(//创建表
    Student_id char(9) not null,
    Student_sname varchar(10) not null,
    Student_city varchar(10) not null,
    Student_phone integer(10) null);
    alter table student add Student_st varchar(10)  null;
    alter table student add Student_age datetime  null;insert into student values('100','赵雷','1997-01-09','北京','1234','m');
    insert into student values('101','王楠','1997-01-09','北京','','');
    insert into student(Student_sname) values('gdsa'),('s'),('sdh');
    select *from student;
    create table employee_tbl(
    emp_id char(9) not null primary key,
    emp_name varchar(20) not null,
    emp_page integer(10) null);
    create table employee_tbl(
    emp_id char(9) not null ,
    emp_name varchar(20) not null,
    emp_page integer(10) null,
    primary key(emp_id));
    alter table student add constraint student_st primary key (student_id);
    create table employee_tb