研究データベースのウェブサイトへの直接アクセス
https://www.runoob.com/sqlite/sqlite-tutorial.html (ルーキー チュートリアル)
ここでは、基本的な操作、データベースの作成と開き方などのみを共有します
。ルーキー チュートリアルを確認してください。
記事ディレクトリ
データベースを作成する
方法1
次のコマンドを入力します
1. sqlite3
2. .open test.db
3. .quit
データベースが終了したら、コマンドの現在のパスにデータベース test.db を作成します。
方法 2
sqlite3 test.db //在命令运行当前窗口创建数据库test.db
//在数据库命令下
.databases //列出当前打开的数据库
.quit //退出
テーブルを作成する
create table stu2(id Integer,name char,score Integer);
//创建 表 名称 id 整形 name 字符型 score 整形
レコードを挿入する
insert into stu values(1550488,'zhang',99);
insert into stu2 values(1550489,"shun",100); //''和""都行
insert into stu(name,score) values("strange",98); //插入部分字段内容
データベースレコードの表示
select * from stu; //查询所有字段的结果
select name,score from stu; //查询数据库中部分字段的内容
レコードを削除する
delete from stu where id = 1550488;
記録を変える
update stu set name = 'hand' where id = 1550489;
テーブルを削除する
drop table stu;
列を追加する
alter table stu add column sex char;
仕上げる
ご質問がございましたら、お気軽にご質問いただき、一緒に前進してください。