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?

SQL WHERE句 何を書く? 【SQL初学者】

0
Posted at

WHERE句には何を書く?

きっかけ

基本的な練習問題を解いていた

 「価格(price)が1000円以上2000円以下」という条件を、
 BETWEENを使わずにANDで書くと? 

といった問題を解いていた

自分の回答

SELECT * FROM store WHERE price >=1000, price <=2000;

正しい回答

SELECT * FROM store WHERE price >=1000 AND price <=2000;

なぜ間違いだったのか?

WHERE句内に絞り込み条件が複数ある場合は、条件を「AND または OR」で記述する。
WHERE句ではテーブルレコードを述語(条件式)でTRUEのレコードのみを返却する。
条件式を複数並べる場合は、AND or ORで記述する。

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?