MySQL 영화 리뷰 서비스 개발
use movie_test_db; -- 1. 테이블 만들기 -- 2. 더미 데이터 insert 했다고 가정하고 진행한다. -- 3. 화면 기획서를 보고, 필요한 slq문을 작성. -- 중요! 순서 : 단일 테이블 처리 가능한 것부터 작성하고 -- 메인 화면처럼, 여러 테이블 조인하는 것은 맨 나중에 작성한다. -- 회원가입 insert into user ( email, password, nickname, gender) values ( 'aksl@naver', '1234', '김닉네임', 1); -- 영화명을 탭하면 리뷰 작성 화면 -- 100번 영화의 10번유저 리뷰 예시 insert into review ( movie_id, user_id, content, rating) values ( 100, 10 ..
2022. 12. 12.
MySQL !=, group by having, between A and B, not like, case, if ,not in, not null
-- 테이블 생성을 위한 코드 INSERT INTO books (title, author_fname, author_lname, released_year, stock_quantity, pages) VALUES ('The Namesake', 'Jhumpa', 'Lahiri', 2003, 32, 291), ('Norse Mythology', 'Neil', 'Gaiman',2016, 43, 304), ('American Gods', 'Neil', 'Gaiman', 2001, 12, 465), ('Interpreter of Maladies', 'Jhumpa', 'Lahiri', 1996, 97, 198), ('A Hologram for the King: A Novel', 'Dave', 'Eggers', 2012,..
2022. 12. 7.
MySQL 날짜처리 day(),dayname(),now(),date_format(),date_add( , interval ), on update now()
-- 날짜 관련 처리하는 방법 -- insert into people2 (name, birthdate, birthtime, birthdt) values ('Mike', '1990-11-11', '10:07:35','1990-11-11 10:07:35'), ('Larry', '1972-12-25', '04:10:42', '1972-12-25 04:10:42'); -- 날짜(일) 정보만 가져오기 select name, day(birthdate) from people2; -- 요일 정보만 가져오기 select name, dayname(birthdate) from people2; -- 1=Sunday, 2=Monday, 3=Tuesday ''' select name, dayofweek(birthdate) fro..
2022. 12. 7.
MySQL group by, count, sum, avg, max, min, sub query 사용법
-- 테스트용 테이블을 만드는 코드 INSERT INTO books (title, author_fname, author_lname, released_year, stock_quantity, pages) VALUES ('The Namesake', 'Jhumpa', 'Lahiri', 2003, 32, 291), ('Norse Mythology', 'Neil', 'Gaiman',2016, 43, 304), ('American Gods', 'Neil', 'Gaiman', 2001, 12, 465), ('Interpreter of Maladies', 'Jhumpa', 'Lahiri', 1996, 97, 198), ('A Hologram for the King: A Novel', 'Dave', 'Eggers', 20..
2022. 12. 7.
MySQL 유니크,정렬,n개만가져오기, 문자열안에 원하는 문자를 검색, 자리수로 가져오기
-- 연습용 테이블 생성을 위한 코드 INSERT INTO books (title, author_fname, author_lname, released_year, stock_quantity, pages) VALUES ('The Namesake', 'Jhumpa', 'Lahiri', 2003, 32, 291), ('Norse Mythology', 'Neil', 'Gaiman',2016, 43, 304), ('American Gods', 'Neil', 'Gaiman', 2001, 12, 465), ('Interpreter of Maladies', 'Jhumpa', 'Lahiri', 1996, 97, 198), ('A Hologram for the King: A Novel', 'Dave', 'Eggers', 2..
2022. 12. 7.
MySQL 문자열 컬럼의 데이터를 가공하는, 여러함수들
-- 연습용 테이블 생성을 위한 코드 INSERT INTO books (title, author_fname, author_lname, released_year, stock_quantity, pages) VALUES ('The Namesake', 'Jhumpa', 'Lahiri', 2003, 32, 291), ('Norse Mythology', 'Neil', 'Gaiman',2016, 43, 304), ('American Gods', 'Neil', 'Gaiman', 2001, 12, 465), ('Interpreter of Maladies', 'Jhumpa', 'Lahiri', 1996, 97, 198), ('A Hologram for the King: A Novel', 'Dave', 'Eggers', 2..
2022. 12. 6.