Computer Programming/AI

TIL_sql 정리(+첫 번째 team project presentation and feedback)

JYCoder 2023. 8. 11. 20:53

오늘 첫 번째 팀 프로젝트의 발표와 피드백을 듣는 날이었다.

'최고오조'의 우리팀, instagram을 모방하여 간단한 팀 소개 페이지를 만들었다.

강의도 함께 들으면서 만든 웹페이지여서 아주 심플한 기능만 들어있었지만, 협업을 통해 github 이용 방법과 venv 폴더는 .gitignore을 통해 관리해야 하는 것도 알 수 있었고, HTML/CSS/기초적인 python을 맛 볼 수 있었던 매우 소중한 경험이었다. 특히, 우리 팀원들 모두 너무 수고 했고, 즐거운 경험이었다.

 

sql 사용 프로그램으로 DBeaver 설치 => MySQL => 테스트 용으로 만들어 놓은 데이터베이스에 connect

 

테이블 보기

Show tables;

#모든 tables 보여줘
show tables

#order table의 모든 걸 보여줘
select * from orders;

#order table에서 payment_method가 kakaopay인 것을 보여줘
select * from orders where payment_method = "kakaopay";

#point_users table에서 point가 20000 초과인 것을 보여줘
select * from point_users where point > 20000;

#order table에서 course_title이 웹개발 인 것과 payment_method가 CARD인 것을 보여줘
select * from orders where course_title = "웹개발" and payment_method="CARD";
#order table에서 payment_method가 CARD가 아닌 것들을 보여줘
select * from orders where payment_method != 'CARD';

#point_users table에서 point가 20000이상 30000 미만 인 것을 보여줘 
select * from point_users where point between 20000 and 30000;

#users table에서 email이 s로 시작하고 com으로 끝나는 것과 name이 이**인 것들을 보여줘
select * from users where email like 's%com' and name = "이**";

#order table에서 payment_method가 kakaopay인 것들을 5개만 보여줘
select * from orders where payment_method = "kakaopay" limit 5;

#users table에서 name의 종류가 몇 개인지 알려줘
select count(distinct(name)) from users;

 

-중복을 없앤 값 나열: distinct

-총 몇 개인지 세는 것: count

select week, count(*) from checkins group by week
#sum, min, max
select week, round(sum(likes), 2) from checkins group by week
select payment_method, count(*) from orders where course_title = '웹개발 종합반' group by payment_method order by count(*) desc

 

 

LIST

'Computer Programming > AI' 카테고리의 다른 글

TIL_python grammer basic  (0) 2023.08.14
WIL_첫 번째 주  (0) 2023.08.13
TIL_github에 있는 폴더 git 명령어로 삭제 방법  (0) 2023.08.10
TIL_Github에 code upload  (0) 2023.08.09
TIL_Python  (0) 2023.08.08