본문 바로가기
  • 공부한 것들과 여러가지를 기록해요

SQL17

개념적 데이터 모델링, ERD 관계형 데이터베이스(RDB) 모델링 개념적 데이터 모델링 : 파악한 업무에서 개념을 뽑아내는 과정 ERD(Entity Relationship Diagram) - 현실에서 개념을 추출하는 필터 적용 - 개념에 대해서 다른 사람들과 대화하게 해주는 언어 - 현실을 3개의 관점으로 바라볼 수 있는 finder 제공 정보 - 정보를 발견하고 다른 사람들에게 표현할 수 있게 도와줌 그룹 - 서로 연관된 정보를 그루핑해서 인식하고 이것을 다른 사람들에게 표현할 수 있게 도와줌 관계 - 정보, 그룹 사이의 관계를 인식하고 다른 사람들에게 표현할 수 있게 도와줌 현실로부터 개념을 인식하는 도구, 그것을 다른 사람들도 알아볼 수 있게 표현하는 도구 -> ERD ERD 만들기 - RDB는 내포관계를 허용하지 않음. 포함관.. 2023. 2. 7.
Codecademy - Multiple Tables subscriptions.descriotion 에서 subscriptions를 빼도 무방. 하지만 이걸 주의해야할 때가 있음. inner join subscrptions.descriptions subscriptions.description Primary keys have a few requirements: None of the values can be NULL. Each value must be unique (i.e., you can’t have two customers with the same customer_id in the customers table). A table can not have more than one primary key column. Note that customer_id (the.. 2023. 2. 5.
Codecademy - Aggregate Functions 'downloads' 하면 안됨 그룹화 해줘야함 avg함수 없이 그냥 downloads라고만 하면 각 그룹의 첫번 째 값으로 반환됨 We can’t use WHERE here because we don’t want to filter the rows; we want to filter groups COUNT(): count the number of rows SUM(): the sum of the values in a column MAX()/MIN(): the largest/smallest value AVG(): the average of the values in a column ROUND(): round the values in the column Aggregate functions combine multi.. 2023. 2. 5.
Codecademy - Queries A% matches all movies with names that begin with letter ‘A’ %a matches all movies that end with ‘a’ 디폴트는 오름차순 리밋 맨 마지막에 가독성을 위해 들여쓰기 하는 게 좋음 sql의 if then 로직이라고 생각하면 됨 마지막에 end as 'mood'로 열 이름 설정 해줘야함. SELECT is the clause we use every time we want to query information from a database. AS renames a column or table. DISTINCT return unique values. WHERE is a popular command that lets you filter the.. 2023. 2. 5.
sql select문, join (생활코딩) SQL과 테이블 구조 표 < 데이터베이스 < 데이터베이스 서버 SQL(Structured Query Language) 쿼리 - 데이터베이스에 요청(질의)하는 것 관계형 데이터베이스, 데이터베이스를 제어할 때 사용하는 표준화된 언어 table, 표 row, record, 행 - 데이터 하나하나, 자체 column, 열 - 데이터의 타입, 구조 조회(select) SELECT 칼럼명1, 칼럼명2 [FROM 테이블명 ] [GROUP BY 칼럼명] [ORDER BY 칼럼명 [ASC | DESC]] [LIMIT offset, 조회 할 행의 수] 대괄호는 생략 가능. 생략가능하다고 할지라도 저 순서대로 명령이 내려져야함. SELECT * FROM student; : student 테이블의 모든 컬럼에 들어있는 각각.. 2023. 2. 4.