celeb
Table, snl_show
Table 사용SELECT CONCAT('string1', 'string2', ...);
SELECT CONCAT('concat', ' ', 'test');
SELECT CONCAT('이름:', name) FROM celeb;
SELECT column as alias
FROM tablename;
SELECT column1, column2, ...
FROM tablename as alias;
SELECT name as '이름' FROM celeb;
SELECT CONCAT(name, ' : ', job_title) as PROFILE FROM celeb;
SELECT CONCAT(s.season, '-', s.episode, '(', s.broadcast_date, ')') as '방송정보',
CONCAT(c.name, '(', c.job_title, ')') as '출연자정보'
FROM celeb as c, snl_show as s
WHERE c.name = s.host;
※
as
는 생략도 가능
SELECT CONCAT(s.season, '-', s.episode, '(', s.broadcast_date, ')') as '방송정보',
CONCAT(c.name, '(', c.job_title, ')') as '출연자정보'
FROM celeb c, snl_show s
WHERE c.name = s.host;
SELECT DISTINCT column1, column2, ...
FROM tablename;
SELECT agency FROM celeb;
SELECT DISTINCT agency FROM celeb;
SELECT DISTINCT sex, agency FROM celeb
ORDER BY sex, agency DESC;
SELECT column1, column2, ...
FROM tablename
WHERE condition
LIMIT number;
SELECT * FROM celeb LIMIT 3;
SELECT * FROM celeb
ORDER BY age ASC
LIMIT 4;
SELECT CONCAT('SNL 시즌', s.season, ' 에피소드 ', s.episode, ' 호스트 ', s.host) as 'SNL 방송정보', c.age
FROM celeb as c, snl_show as s
WHERE c.name = s.host
ORDER BY c.age DESC, s.broadcast_date DESC
LIMIT 2;