SQL 실습을 위한 사이트입니다. ^^
SQL Tutorial
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com:443
https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all
SQL Tryit Editor v1.6
WebSQL stores a Database locally, on the user's computer. Each user gets their own Database object. WebSQL is supported in Chrome, Safari, Opera, and Edge(79). If you use another browser you will still be able to use our Try SQL Editor, but a different ver
www.w3schools.com

world 데이터베이스에 city 테이블을 사용하여! 문제를 해결하세요.
국가코드가 'KOR'인 도시들의 국가코드를 표시하시오.
select countrycode from city where countrycode = 'KOR';
국가코드가 'KOR'인 도시들의 국가코드를 중복 제거해서 표시하시오.
select distinct countrycode from city where countrycode = 'KOR';
국가코드가 'KOR'이면서 인구가 100만 이상인 도시를 찾으시오.
select * from city where countrycode = 'KOR' and population >=1000000;
국가코드가 'KOR', 'CHN', 'JPN'인 도시를 찾으시오.
select * from city where countrycode = 'KOR' or countrycode = 'CHN' or countrycode = 'JPN';
select * from city where countrycode in ('KOR','CHN','JPN');
국가코드가 'KOR'이 아니면서 인구가 100만 이상인 도시를 찾으시오.
select * from city where countrycode != 'KOR' and population >= 1000000;
city 테이블에서 국가코드가 'KOR'이고, 인구가 100만 이상 500만 이하인 도시를 찾으시오.
select * from city where countrycode = 'KOR' and (population between 1000000 and 5000000);
select * from city where countrycode = 'KOR' and (population >= 1000000 and population <= 5000000);
국가 코드가 'KOR'인 도시를 찾아 인구수를 역순으로 표시하시오.
select * from city where countrycode ='KOR' order by population desc;
city 테이블에서 국가코드와 인구수를 출력하라. 정렬은 국가코드별로 오름차순으로, 동일한 코드(국가) 안에서는 인구 수의 역순으로 표시하라.
select countrycode, population from city order by countrycode, population desc;
city 테이블에서 국가코드가 'KOR'인 도시의 수를 표시하시오.
select count(*) from city where countrycode = 'KOR';
city 테이블에서 국가코드가 'KOR'인 도시들의 인구수 총합을 구하시오.
select sum(population) from city where countrycode = 'KOR';
city 테이블에서 국가코드가 'KOR'인 도시들의 평균을 구하시오.
select avg(population) from city where countrycode = 'KOR';
city 테이블에서 국가코드가 'KOR'인 도시들의 인구수 중 최대값을 구하시오. 단 결과를 나타내는 테이블의 필드는 "최대값"으로 표시하시오.
select max(population) as "최대값" from city where countrycode = 'KOR';
city 테이블에서 국가코드가 'KOR'인 도시들의 인구수 중 최소값을 구하시오. 단 결과를 나타내는 테이블의 필드는 "최소값"으로 표시하시오.
select min(population) as "최소값" from city where countrycode = 'KOR';
정답은?

드래그 해보세요!!! 혹은 Ctrl + A를 눌러보세요.
정답은 투명 글씨로 숨겨져 있어요.
'[IT] 꼭 알아두기' 카테고리의 다른 글
[이클립스-C언어 설치 오류/에러] Launch failed. Binary not found (0) | 2022.03.12 |
---|---|
[이클립스-C언어 ] Eclipse 사용/실행 방법 (0) | 2022.03.12 |
[이클립스-C언어 설치] VS-Code가 아닌 Eclipse 설치해서 사용 (0) | 2022.03.12 |
[오라클 설치] Oracle Database 21c Express Edition (0) | 2022.03.12 |
[파이썬자격증] 파이썬마스터 3급 - 기출 예상 문제 (0) | 2022.03.06 |