푸들푸들

1119 [Sakila] Rental x Customer 본문

구디아카데미/JAVA

1119 [Sakila] Rental x Customer

COCO_develop 2024. 11. 19. 17:49

(rental x inventory) x film

{(rental x inventory) x film } x customer

SELECT 
	c.customer_id customerId
	,t2.film_id
	,t2.title
	,t2.release_year
	,t2.length
	,t2.rating
	,t2.rental_id
	,t2.rental_date
	,t2.return_date
	,t2.rental_duration
	,t2.rental_rate
	,t2.replacement_cost
FROM (SELECT 
			t1.rental_id
		   ,t1.rental_date
		   ,t1.return_date
		   ,t1.customer_id
		   ,t1.film_id
		   ,f.title
		   ,f.release_year
		   ,f.rental_rate
		   ,f.length
		   ,f.rating
		   ,f.rental_duration
		   ,f.replacement_cost
		   ,t1.last_update
		FROM (SELECT 
				r.rental_id
			      ,r.rental_date
			      ,r.return_date
			      ,r.customer_id
			      ,i.inventory_id
			      ,i.film_id
			      ,i.store_id
			      ,r.last_update
				FROM rental r
				INNER JOIN inventory i 
				ON r.inventory_id = i.inventory_id) t1
		INNER JOIN film f
		ON t1.film_id = f.film_id) t2
INNER JOIN customer c
ON t2.customer_id = c.customer_id

'구디아카데미 > JAVA' 카테고리의 다른 글

1209  (0) 2024.12.09
1120 [Mall] 설계  (0) 2024.11.20
1119 [Sakila] 이름 검색  (0) 2024.11.19
1119 [Sakia] Inventory + Rental  (0) 2024.11.19
1112 [Sakila] TODO  (0) 2024.11.12