ysql> show databases;
+--------------------+
| Database |
+--------------------+
| article |
| exam_result |
| information_schema |
| libiary |
| mysql |
| performance_schema |
| student |
| sys |
+--------------------+
8 rows in set (0.00 sec)
mysql> use article;
Database changed
mysql> drop table if exists article;
Query OK, 0 rows affected (0.03 sec)
mysql> create table article (
-> id int,
-> create_date datetime,
-> name varchar(20)
-> );
Query OK, 0 rows affected (0.03 sec)
mysql> insert into article (id,create_date,name) values
-> (1,20190101113031,'平凡的世界'),
-> (2,20190203103032,'钢铁是怎样炼成的'),
-> (3,20190304103000,'假如给我三天光明'),
-> (4,20220309113020,'朗读者');
Query OK, 4 rows affected (0.01 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> select * from article where create_date between '2019-1-1 10:30:00' and '2019-11-10 4:02:00';
+------+---------------------+--------------------------+
| id | create_date | name |
+------+---------------------+--------------------------+
| 1 | 2019-01-01 11:30:31 | 平凡的世界 |
| 2 | 2019-02-03 10:30:32 | 钢铁是怎样炼成的 |
| 3 | 2019-03-04 10:30:00 | 假如给我三天光明 |
+------+---------------------+--------------------------+
3 rows in set (0.01 sec)