Skip to content

Instantly share code, notes, and snippets.

@sezemiadmin
Created March 26, 2019 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sezemiadmin/1c669ed6cbda8551f3739ae168ec581d to your computer and use it in GitHub Desktop.
Save sezemiadmin/1c669ed6cbda8551f3739ae168ec581d to your computer and use it in GitHub Desktop.
「体験レベル」を終えたあなたの為のSQL入門 次の一歩 のサンプルクエリ
select code, max(price) from grpsample group by code;
select cust_id from sales where amount>1000;
select code, count(*) , sum(price) from grpsample group by code;
select code, min(price), max(price), avg(price) from grpsample group by code;
select code, max(price) from grpsample group by code
having max(price) >= 500;
select * from pref
join area on (pref.area_id = area.id);
select * from pref
left outer join area on (pref.area_id = area.id);
select * from pref, area
where pref.area_id = area.id;
select * from cust where id IN (
select cust_id from sales where amount>1000
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment