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?

Progate(SQL基礎)学びまとめ

Last updated at Posted at 2026-01-18

SELECT文の基本的な実行手順

order.png

likeとワイルドカード

%="ほにゃほにゃ"

  • sqlという語句を含むデータ
.sql
where カラム like "%sql%";
  • 末尾がsqlという語句のデータ
.sql
where カラム like "%sql";
  • 先頭がsqlという語句のデータ
ex.sql
where カラム like "sql%";

not演算子

ex.sql
where not name = "ポチ";

null

これだけちょっと書き方ちがうので注意

  • nullではないデータの取得
ex.sql
where price is not null
  • nullのデータの取得
ex.sql
where price is null

order by

priceカラムを降順に並び替えて上位5件だけ表示

ex.sql
SELECT *
FROM purchases
order by price desc
limit 5;

and

ex.sql
SELECT *
FROM purchases
where category = "食費" 
and character_name = "ひつじ仙人";
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?