sqlite related commands notes

1, sqlite sql modify / exchange column names

Quote: https://blog.csdn.net/qq_37059136/article/details/80886110

① modify the original name of the table

alter table HOUSE_DETAILS rename to HOUSE_DETAILS_BAK;

② modify the table after the new column name

create table if not exists `HOUSE_DETAILS` (ID integer primary key autoincrement,HSID integer unique not null,AREA real,MARKETING date);

③ query sequence data from the old table and insert a new table, select the note

insert into HOUSE_DETAILS select ID,HSID,MARKETING,AREA from HOUSE_DETAILS_BAK;

④ delete the old table

drop table HOUSE_DETAILS_BAK

 

2, table join

Left connection

select * from HOUSE_INFO left join HOUSE_DETAILS on HOUSE_INFO.HSID=HOUSE_DETAILS.HSID



Guess you like

Origin www.cnblogs.com/qvbrgw/p/11489346.html