Learning with online/SQL
-
SQL 학습(3) - Group by, Order by(작성중)Learning with online/SQL 2022. 11. 2. 23:49
SELECT name, count(*) from users group by name -- group by 이후, count(*) 집계함수를 작성 select name,count(*) from users group by name; select name, count(*) from users where name = '신**' group by name; -- where 절과 group by 같이 쓰기 select name, email, count(*) from users where email like '%naver.com' and name = '이**' group by name; -- 주차별(week)로 코멘트(데이터) 갯수 구하기 select week, count(*) from checkins group by..
-
SQL 학습(2) - Where절 조건문Learning with online/SQL 2022. 10. 30. 17:14
select * from point_users where point > 20000 *** select 추출할 행 from 테이블 where 조건식 -- '아닌' != select * from orders where course_title = '웹개발 종합반' and payment_method != 'CARD'; -- '범위' between ~ and select * from orders where created_at between '2020-07-13' and '2020-07-15'; -- '포함' in ( ) select * from checkins where week in (1, 3) -- '패턴' like select * from users where email like '%@daum.net'; -..
-
SQL 학습(1) - 설치 및 환경설정Learning with online/SQL 2022. 10. 30. 17:14
1. DBeaver 설치 DBeaver는 SQL 클라이언트이자 데이터베이스 관리 도구 Download | DBeaver Community 2. 학습 환경설정 1) 좌측 상단 플러그인 모양의 아이콘을 통해 MySQL 환경으로 설정 2) 아래 정보를 입력하고, 'Test Connection' 버튼 클릭 후 'Connected' 확인 Server Host: sparta.cbt9ceqjwlr9.ap-northeast-2.rds.amazonaws.com Database: sparta Username: sparta_student Password: sparta99 * 해당 DB는 스파르타 교육에서 제공하는 데이터베이스 이다. 3) 데이터베이스 확인 -- 전체 테이블 리스트 보기 show tables; -- 테이블의 ..