Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

学习 Go (Part 4: sqlite) #317

Open
nonocast opened this issue Aug 8, 2022 · 0 comments
Open

学习 Go (Part 4: sqlite) #317

nonocast opened this issue Aug 8, 2022 · 0 comments

Comments

@nonocast
Copy link
Owner

nonocast commented Aug 8, 2022

sqlite3

~ sqlite3 hello.db
SQLite version 3.37.0 2021-12-09 01:34:53
Enter ".help" for usage hints.
sqlite> .tables
sqlite> CREATE TABLE IF NOT EXISTS `users` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `age` INTEGER DEFAULT 0);
sqlite> 
sqlite> .tables
users
sqlite> .schema users
CREATE TABLE `users` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `age` INTEGER DEFAULT 0);
sqlite> 
sqlite> .header on
sqlite> .mode column
sqlite> pragma table_info('users');
cid  name  type     notnull  dflt_value  pk
---  ----  -------  -------  ----------  --
0    id    INTEGER  0                    1 
1    name  TEXT     1                    0 
2    age   INTEGER  0        0           0 
sqlite> 
sqlite> 
sqlite> insert into users (name, age) values ('nonocast', 66);
sqlite> insert into users (name, age) values ('minnie', 11);
sqlite> 
sqlite> select * from users;
id  name      age
--  --------  ---
1   nonocast  66 
2   minnie    11 
sqlite> 

program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant