본문 바로가기

Sparta/TIL

23.12.28 미니프로젝트 마지막날

배운 점: SQL문 쓰는 법.
아쉬운 점: 프로젝트 최종본에서 미흡한 부분이 보임.

 

 

미니프로젝트 마지막날. 발표가 예정되어 있었고 어제는 프로젝트의 마무리 단계였다. 그래서 오늘은 sql 강의를 보며 오전을 보냈고 점심 먹고 2시부터 발표가 이어졌다.

 

다른 팀이 한 내용을 먼저 봤는데, 확실히 다들 짧은 시간에 많은 것들을 했고 그 팀의 팀원들이 이전에 했던 경험들이 녹아있었다. 그리고 우리 차례가 되었을 때, 나는 약간 아쉬웠다.java script 조건문에서 CSS가 빠진 부분이 보였던 것이다. 버튼을 누르기 전에는 티나지 않았지만 조건문에 있는 배경색을 바꾸는 함수에서 아래 grid 부분이 빠져서 작동하지 않았다. 명백한 내 실수여서 아쉬움이 남았다.

 

 

select restaurant_name,
       price/quantity "단가",
       cuisine_type,
       order_id,
       case when (price/quantity <5000) and cuisine_type='Korean' then '한식1'
            when (price/quantity between 5000 and 15000) and cuisine_type='Korean' then '한식2'
            when (price/quantity > 15000) and cuisine_type='Korean' then '한식3'
            when (price/quantity <5000) and cuisine_type in ('Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '아시아식1'
            when (price/quantity between 5000 and 15000) and cuisine_type in ('Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '아시아식2'
            when (price/quantity > 15000) and cuisine_type in ('Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '아시아식3'
            when (price/quantity <5000) and cuisine_type not in ('Korean', 'Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '기타1'
            when (price/quantity between 5000 and 15000) and cuisine_type not in ('Korean', 'Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '기타2'
            when (price/quantity > 15000) and cuisine_type not in ('Korean', 'Japanese', 'Chinese', 'Thai', 'Vietnamese', 'Indian') then '기타3' end "식당 그룹"
from food_orders

 

 

오늘 배운 sql의 조건문이다. 보다시피 엄청 복잡하게 이루어져 있어서 사실 실용성은 떨어진다. 현업에 가서도 이렇게 복잡한 코드를 칠 일이 있을 지 모르겠지만, 언젠가 SQLD를 응시해야 했기 때문에 열심히 분석해 봤다.

 

sql의 아쉬운 점은 Enter키를 치면 내용이 달라져 꼭 이런 형태로 만들어야 한다는 점이다. 물론 지금은 처음이라서 그렇겠지만 내용을 파악하는 데에 힘이 들었다. 이번주는 sql을 마무리하고 내일부터는 본격적으로 JS 강의가 시작된다. 이번기회에 모자란 기초를 확실히 닦아놓아야겠다는 생각을 했다.