SQL - SQLite - 複数テーブルのデータベース設計 - 現行テーブルからの脱却 - やり直し
Head First SQL ―頭とからだで覚えるSQLの基本、 Lynn Beighley(著)、 佐藤 直生(監訳)、 松永 多苗子(翻訳)、 オライリージャパンの 7章(複数テーブルのデータベース設計 - 現行テーブルからの脱却)、p.291(エクササイズ)の解答を求めてみる。
sample5.sql
select * from
where gender = '女性'
and status = '独身'
and state = 'マサチューセッツ州'
and seeking like '%独身男性%'
and birthday > '1950/03/20'
and birthday < '1960/03/20'
and (
interest1 = '動物' or
interest2 = '動物' or
interest3 = '動物' or
interest4 = '動物'
)
and (
interest1 = 'トレーディングカード' or
interest2 = 'トレーディングカード' or
interest3 = 'トレーディングカード' or
interest4 = 'トレーディングカード'
)
and (
interest1 = 'ジオキャッシング' or
interest2 = 'ジオキャッシング' or
interest3 = 'ジオキャッシング' or
interest4 = 'ジオキャッシング'
);