1选择数据库
mysql> USE LY;
Database changed
2创建数据表
mysql> CREATE TABLE ly.studet(
-> id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT '学号',
-> name VARCHAR(20) NOT NULL COMMENT'姓名',
-> gender ENUM('男','女')NOT NULL COMMENT '性别',
-> birth_date DATE NOT NULL COMMENT '出生日期',
-> start_date DATE NOT NULL COMMENT '入学时间 ',
-> adress VARCHAR(255) NOT NULL DEFAULT' ' COMMENT '家庭住址'
-> )DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.01 sec)
3插入数据
mysql> INSERT INTO ly.studet VALUES(
-> '6666666666','LL',
-> '男',
-> '2002-06-19',
-> '2021-09-19',
-> '北京'
-> );
Query OK, 1 row affected (0.02 sec)
4查看表
mysql> SELECT*FROM ly.studet;
+------------+------+--------+------------+------------+--------+
| id | name | gender | birth_date | start_date | adress |
+------------+------+--------+------------+------------+--------+
| 6666666666 | LL | 男 | 2002-06-19 | 2021-09-19 | 北京 |
+------------+------+--------+------------+------------+--------+
1 row in set (0.00 sec)