Run the .go project locally and check the additions, deletions and modifications of SQlite database users

Tip: After the article is written, the table of contents can be automatically generated. For how to generate it, please refer to the help document on the right.


Preface

Run the .go project locally and check the additions, deletions and modifications of SQlite database users


1. Run the .go project,

Download .go from the official website and install it.
Download the database from the official website and install sqlite3.


go run main.go // 运行项目

Insert image description here

View data content

// 打开db文件
 .open data.db;
// 列出所有表
.tables
// 查看 table_name表的数据,并优化格式
.header on
.mode column
select * from users ;

// 按从左到右添加字段数据
insert into users values(1001, 'zhangsan', 18);
//对应字段添加数据
insert into users (id, name) values(1002, 'lisi');

//删除id为1001的这条数据
delete from users where id=1001;

//更新表格字段的内容
update users set age=30, name='lisi' where id=1001;

Insert image description here

Summarize

Guess you like

Origin blog.csdn.net/yang20000222/article/details/132617296