0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SQLite Dotinstall メモ

Posted at

コメントアウト方法

-- コメント
or
/* コメント*/

スキーマ

.schema
データベースの構造

データ型

・blob(Binary Large OBject)
→小さい画像やファイルなど保存できる

select関連

.headers on
カラム名を表示

select id, name as user_name from users;
id| user_name

select * from users
*すべて

where関連

複数の値のどれかに合致するものを抽出したい場合は in
select * from users where name in ('taguchi', 'fkoji');
taguchiとfkojiに当てはまるものすべて抽出

like関連

文字列に関して前方一致とか部分一致で抽出したい場合には like を用いる

select * from users where name like 's___';
文字列にsを含むものすべて

order by、limit関連

select * from users where score is not null order by score desc limit 3;
スコアの降順に並び替えて、3件表示に制限する。

viewで抽出条件を保存

hiscoreの定義
create view hiscore as select * from users order by score desc limit 5;

hiscoreの呼び出し
select * from hiscore;

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?