-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* day15
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
1번 : 3월에 태어난 여성 회원 목록 출력하기 | ||
SELECT MEMBER_ID,MEMBER_NAME,GENDER,DATE_FORMAT(DATE_OF_BIRTH,"%Y-%m-%d") as DATE_OF_BIRTH | ||
from MEMBER_PROFILE | ||
where GENDER ='w' and month(DATE_OF_BIRTH)= 03 and TLNO is not null | ||
order by MEMBER_ID | ||
|
||
2번 :카테고리 별 상품 개수 구하기 | ||
SELECT LEFT(PRODUCT_CODE, 2) AS CATEGORY,COUNT(PRODUCT_CODE) AS PRODUCTS | ||
FROM PRODUCT | ||
GROUP BY CATEGORY | ||
ORDER BY CATEGORY | ||
|
||
3번 :가격대 별 상품 개수 구하기 | ||
SELECT TRUNCATE(PRICE,-4) AS PRICE_GROUP, | ||
COUNT(PRODUCT_CODE) AS PRODUCTS | ||
FROM PRODUCT | ||
GROUP BY PRICE_GROUP | ||
ORDER BY PRICE_GROUP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
1번 :상품 별 오프라인 매출 구하기 | ||
SELECT p.PRODUCT_CODE, SUM(P.PRICE* OFS.SALES_AMOUNT) AS SALES | ||
FROM PRODUCT P | ||
INNER JOIN OFFLINE_SALE OFS | ||
ON P.PRODUCT_ID = OFS.PRODUCT_ID | ||
GROUP BY p.PRODUCT_CODE | ||
ORDER BY SALES DESC,P.PRODUCT_CODE | ||
|
||
2번 :재구매가 일어난 상품과 회원 리스트 구하기 | ||
SELECT USER_ID,PRODUCT_ID | ||
FROM ONLINE_SALE | ||
GROUP BY USER_ID,PRODUCT_ID | ||
HAVING COUNT(USER_ID) > 1 AND COUNT(PRODUCT_ID) > 1 | ||
ORDER BY USER_ID, PRODUCT_ID DESC | ||
|
||
3번 :진료과별 총 예약 횟수 출력하기 | ||
SELECT MCDP_CD AS 진료과코드,count(APNT_YMD) AS 5월예약건수 | ||
FROM APPOINTMENT | ||
WHERE MONTH(APNT_YMD) = '5' | ||
GROUP BY MCDP_CD | ||
ORDER BY 5월예약건수 ,MCDP_CD |