본문 바로가기

SQL9

Leetcode SQL 50 - 1321. Restaurant Growth 문제 사이트: @leetcode Table: Customer +---------------+---------+ | Column Name | Type | +---------------+---------+ | customer_id | int | | name | varchar | | visited_on | date | | amount | int | +---------------+---------+ In SQL,(customer_id, visited_on) is the primary key for this table. This table contains data about customer transactions in a restaurant. visited_on is the date on which the cus.. 2024. 3. 23.
[SQL] 데이터 캠프 수강 (10) - Analyzing Business Data in SQL Chapter 1: Revenue, cost and profit Chapter 2: User-centric metrics Chapter 3: Unit economics and distributions Chapter 4: Generating an executive report Chapter1 DATE_TRUNC(date_part, date) ex) DATE_TRUNC('week', '2018-06-12')::DATE -> '2018-06-11' Chapter2 MAU (Monthly Active User) : 한 달 동안 유저의 활동 수 월별 고유 유저 수를 구하면 된다. DAU (Daily Active User): 하루동안 유저의 활동 수 일별 고유 유저 수를 구하면 된다. 증감률 : 기준 대비 증감 비.. 2021. 5. 9.
[SQL] 데이터 캠프 수강 (9) - Applying SQL to Real-World Problems 9번째 SQL 강의를 들어보자 ! 해당 강의는 아래 4개의 단원으로 이루어져 있다. Chapter1 : Use Real World SQL Chapter2 : Find Your Data Chapter3 : Manage Your Data Chapter4 : Best Practices for Writing SQL [Chapter2] DB의 Table을 탐색하는 방법 PostgreSQL 경우 SELECT * FROM pg_catalog.pg_tables -- schemaname, tablename, tableowner 열을 반환해준다. SQL Server 경우 SELECT * FROM INFORMATION_SCHEMA.TABLES; MySQL 경우 SHOW TABLES; DB의 Table & Column을 모두.. 2021. 5. 2.
[SQL] 데이터 캠프 수강 (7) - Exploratory Data Analysis in SQL SQL Fundermentals 과정을 완료하고 SQL for Business Analysts 과정을 시작했다. 😄 SQL for Business Analysts의 과정은 5개의 과정으로 이루어져 있다. Exploratory Data Analysis in SQL Data-Driven Decision Making in SQL Applying SQL to Real-World Problems Anaylizing Business Data in SQL Reporting in SQL 이번 글에서는 EDA in SQL을 들었던 것을 정리할 예정이다. PostgreSQL을 사용하여 해당 과정을 진행한다. 컬럼의 제약 조건 Foreign key : Unique + Null 도 포함 가능 Primary key : Not .. 2021. 4. 2.