UDEMY - The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert강의를 들으며 정리
-- 1번 'Why does my cat look at me with such hatred?'를 뒤집고 전부 대문자로 바꿔라
SELECT UPPER(REVERSE('Why does my cat look at me with such hatred?'));
-- 2번
-- 'I-like-cats'
-- 3번 title칼럼의 빈칸을 모두 -> 로 바꿔라 그리고 칼럼 이름은 title로 표시해라
SELECT
REPLACE(title, ' ', '->') as 'title'
FROM books;
-- 4번 first name을 forwards라는 칼럼이름으로 원래대로, backwards라는 이름으로 거꾸로 표시하라
SELECT
author_fname as 'forwards',
REVERSE(author_fname) as 'backwards'
FROM books;
-- 5번 풀네임(퍼스트 네임 + 라스트네임)을 대문자로.(중간에 space하나 두고) 칼럼 이름은 full name in caps
SELECT
UPPER(
CONCAT(
author_fname,
' ',
author_lname
)
) AS 'full name in caps'
FROM books;
-- 6번 title과 released_year를 문장으로 표시하라. 칼럼 이름은 blurb ex) The Namesake was released in 2003
SELECT
CONCAT(
title,
' was released in ',
released_year
) AS 'blurb'
FROM books;
-- 7번 print book titles and the length of each title
SELECT
title,
CHAR_LENGTH(title) AS 'character count'
FROM books;
-- 8번
select * from books;
SELECT
CONCAT(
SUBSTRING(title, 1, 10),
'...'
) AS 'short title',
CONCAT(
author_lname,
author_fname
) AS 'author',
CONCAT(
stock_quantity,
' in stock'
) AS 'quantity'
FROM books;