(1)時間類型比較,需要添加關鍵字 timestamp
select * from track where create_time > timestamp '2021-08-17 11:41:09';
(2)主鍵自增
A. 建表時采用 SERIAL 關鍵字
create table tes_user ( id SERIAL primary key, user_name varchar(10) null, user_age int null ); insert into tes_user(user_name,user_age) values('張三',19),('李四',20);

查看數據庫是成功插入數據的,并且主鍵id自增。
B. 如果表已經存在(同樣是tes_user表),修改表的字段使其自增

- 創建一個和自增關聯的序列 SEQUENCE
create SEQUENCE tes_user_id_seq START 1;
- 將創建的序列添加到默認值位置 nextval('tes_user_id_seq'::regclass) ,保存即可。

insert into tes_user(user_name,user_age) values('王五',20),('十一',20);

浙公網安備 33010602011771號