Skip to content

Instantly share code, notes, and snippets.

@y-yu
Created June 13, 2012 17:47
Show Gist options
  • Save y-yu/2925470 to your computer and use it in GitHub Desktop.
Save y-yu/2925470 to your computer and use it in GitHub Desktop.
access
select 氏名, 住所
from 従業員
where 部門番号=1
select 部門名
from 部門
where exists
(select 部門番号
from 従業員
where 氏名='山田一郎')
select 部門番号, 部門名
from 部門
where exists
(select 部門番号
from 従業員
where 年齢<20
)
444
555
select 部門番号, 部門名
from 部門
where not exists
(select 部門番号
from 従業員
where 年齢<30)
-----------------------
select count(*)
from 従業員
where 部門番号=1
select 部門番号, count(*)
from 従業員
group by 部門番号
select 部品番号, max(単価), min(単価), avg(単価)
from 供給
group by 部品番号
select 部品番号, 部品名
from 部品
where exists
(select 部品番号
from 供給
group by 部品番号
having max(単価)-min(単価)>=100)
select 部品番号, max(単価), min(単価), avg(単価)
from 供給
where 部門番号=1
group by 部品番号
select max(単価), min(単価), avg(単価)
from 供給
where 1=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment