반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 메디패치
- 습윤밴드
- 달리기
- github
- 드림코딩
- 독서 리뷰
- node
- 홈트
- 걷기
- 박스점프
- node.js
- 크로스핏
- 위코드
- SQL
- wecode
- 활동 킬로칼로리
- nodejs
- git
- 월별 운동일지
- axios
- dml
- Til
- 운동일지
- 러닝
- express
- JavaScript
- MySQL
- code kata
- Udemy
- dql
Archives
- Today
- Total
RISK IT
[TIL8_23.1.16.] SQL Advanced | Assignment 3 본문
반응형
ASSIGNMENT 3
과제 1
MySQL의DQL(Data Query Language)를 사용하여, 아래 결과가 출력될 수 있는 쿼리문을 작성해주세요. ‘2022-03-01’ 이후에 개봉한 영화들의 기본 정보와 해당 영화의 배급사의 정보를 다음과 같은 형태로 출력해주세요.
✍️💻 입출력
mysql> SELECT
-> movies.id,
-> movies.title,
-> movies.rate,
-> movies.open_date,
-> distributors.business_name
-> FROM movies
-> INNER JOIN distributors
-> ON movies.distributor_id=distributors.id
-> WHERE movies.open_date >= "2022-03-01";
+----+-----------------------------+------+------------+------------------+
| id | title | rate | open_date | business_name |
+----+-----------------------------+------+------------+------------------+
| 3 | Result Of The Past | 6.8 | 2022-03-01 | Nolan Unlimited |
| 4 | Equality Of Time Travellers | 7.0 | 2022-04-01 | Thornhill and Co |
| 5 | Alerted By The Eyes | 8.2 | 2022-05-01 | Nolan Unlimited |
+----+-----------------------------+------+------------+------------------+
과제 2
페이지 하단 참고자료의 SQL 키워드들과 MySQL의DQL(Data Query Language)를 사용하여, 아래 결과가 출력될 수 있는 쿼리문을 작성해주세요. 특정 에이전시 회사(Agencyfluent)의 소속 배우들 정보와 해당 배우들이 출연한 영화 목록을 다음과 같은 형태로 출력해주세요.
✍️💻 입출력
mysql> SELECT
-> actors.id AS actor_id,
-> actors.name AS actor_name,
-> JSON_ARRAYAGG(movies.title) AS filmography
-> FROM movies_actors
-> INNER JOIN movies ON movies.id = movies_actors.movie_id
-> INNER JOIN actors ON movies_actors.actor_id = actors.id
-> INNER JOIN agencies ON actors.agency_id = agencies.id
-> WHERE actors.agency_id = 1
-> GROUP BY actors.id;
+----------+------------------+-------------------------------------------------------------------------+
| actor_id | actor_name | filmography |
+----------+------------------+-------------------------------------------------------------------------+
| 1 | Lottie Stevenson | ["Intruders In The Center Of The Earth", "Pilots With Spaceships"] |
| 3 | Bret Blevins | ["Intruders In The Center Of The Earth", "Equality Of Time Travellers"] |
| 5 | Aditya Malone | ["Intruders In The Center Of The Earth"] |
| 7 | Gabriella Nava | ["Result Of The Past"] |
| 9 | Alexandre Boyd | ["Alerted By The Eyes"] |
+----------+------------------+-------------------------------------------------------------------------+
5 rows in set (0.01 sec)
반응형
'IT > TIL' 카테고리의 다른 글
[TIL10_23.1.18.] [Node] Express 초기 환경세팅 중 Express 분석 (0) | 2023.01.18 |
---|---|
[TIL9_23.1.17.] [Node] Express 초기 환경세팅 (0) | 2023.01.17 |
[TIL7_23.1.15.] mySQL Database Schema & Table 구축 | Assignment 1 (0) | 2023.01.15 |
[TIL6_23.1.14.] mySQL 데이터 추가/수정/삭제/조회 (0) | 2023.01.14 |
[TIL5_23.1.13.] mySQL - DDL 이용하여 데이터베이스 생성, 접근, 변경 (0) | 2023.01.14 |