21.2.28 / SQL / SQLD, SQL 강의 실습

pjk·2021년 2월 28일
0

[매일코딩 스터디]

목록 보기
28/62

Today

강의

MySQL 데이터베이스 한번에 끝내기 SQL Full Tutorial Course using MySQL Database (40:39)

스터디 내용

  • SQLD 1과목 종료
  • SQL 실습 강좌 수강

결과

show databases;

use world;
show tables;
show table status;
describe city;
DESC countrylanguage;

select * from city where Population <= 8000000
and population > 7000000;

select * from city where CountryCode = 'KOR';
select * from city where CountryCode = 'USA';

select * from city where CountryCode = 'KOR' and population > 3000000;
select * from city where Population between 4000000 and 8000000;

select * from city where Name IN('Seoul', 'New York', 'Tokyo');
select * from city where CountryCode IN('KOR', 'USA', 'JPN');

select * from city where CountryCode like 'KO_';
select * from city where Name like 'Tel';
select * from city where Name like 'Tel';

select * from city where CountryCode = (select CountryCode From city where name = 'Seoul') ;
select * from city where Population > ANY (select Population From city where District = 'New York') ;
select * from city where Population > SOME (select Population From city where District = 'New York') ;
select * from city where Population > ALL (select Population From city where District = 'New York') ;

select * from city order by Population desc;
select * from city order by CountryCode, Population desc;
select * from city where CountryCode = 'KOR' order by Population desc;
desc country;
select * from Country order by SurfaceArea desc;

select distinct CountryCode From city;
select * from city order by Population desc limit 10;

select CountryCode, AVG(Population) as 평균 from city group by CountryCode;
select CountryCode, MAX(Population) as 최대인구 from city group by CountryCode;

select count(*) from city;
select avg(population) from city;

select CountryCode, MAX(Population) as 최대인구 from city group by CountryCode having 최대인구 > 8000000;
select CountryCode, NAME, sum(Population) as 최대인구 from city group by CountryCode, name with rollup;

select * from city join country on city.CountryCode = country.Code
join Countrylanguage on city.CountryCode = Countrylanguage.CountryCode;

Select length('asdfawedsfasf');
select concat('My ', 'SQl op', ' ENee');
select locate('abc', 'asadfsefadsfaabcasfw');
select left('Mysql is an open source relational database management system', 5);
select right('Mysql is an open source relational database management system', 5);

select lower('Mysql is an open source relational database management system');
select upper('Mysql is an open source relational database management system');

select replace('mssql','ms','my');

select trim('         Mysql       '),
trim(leading '#' from '###Mysql###'),
trim(trailing '#' from '###Mysql###');

Tomorrow

  • SQL 실습 강좌 복습
  • SQLD 2과목 풀이

Summary

  • sqld 1과목 마무리했는데 대부분 암기내용이라 틈틈히 봐야겠다.
  • 2과목 내용은 실습과 병행하며 익혀야겠다.
profile
성장

0개의 댓글