笔记
MySQL如何创建时间数据类型以及插入时间数据。
mysql> create table choices
-> (
-> no int not null,
-> sid int not null,
-> cid int not null,
-> Takedate date null,
-> score int null
-> );
Query OK, 0 rows affected (0.02 sec)
mysql> select * from choices;
+-----+------+-------+------------+-------+
| no | sid | cid | Takedate | score |
+-----+------+-------+------------+-------+
| 58 | 1201 | 10001 | 2022-09-01 | 76 |
| 253 | 1205 | 10006 | 2021-03-01 | 87 |
| 640 | 1215 | 10002 | 2022-09-06 | NULL |
+-----+------+-------+------------+-------+
3 rows in set (0.00 sec)
mysql> insert into takecourse.choices
-> values
-> (984,1205,10001,'2022-09-01',54),
-> (1270,1201,10005,'2021-03-01',92),
-> (2143,1205,10005,'2022-09-01',82),
-> (2371,1201,10002,'2022-09-01',77),
-> (2715,1207,10001,'2022-09-01',67),
-> (3262,1207,10005,'2022-09-01',90),
-> (4144,1207,10004,'2022-09-01',60),
-> (5519,1205,10002,'2021-03-01',NULL),
-> (5935,1215,10001,'2022-09-01',70),
-> (5987,1201,10004,'2021-03-01',82),
-> (6353,1205,10006,'2022-09-01',76),
-> (6805,1201,10003,'2021-03-01',88),
-> (6824,1205,10004,'2022-09-01',72),
-> (7004,1207,10002,'2022-09-01',64),
-> (7901,1215,10002,'2021-09-01',75),
-> (8311,1215,10006,'2022-09-01',63);
Query OK, 16 rows affected (0.01 sec)
Records: 16 Duplicates: 0 Warnings: 0
mysql> drop table choices;
Query OK, 0 rows affected (0.03 sec)
mysql> show tables;
Empty set (0.00 sec)