쿼리

    SQL - Multiple Tables

    Join(테이블 결합) • JOIN will combine rows from different tables if the join condition is true. SELECT * FROM orders JOIN subscriptions ON orders.subscription_id = subscriptions.subscription_id WHERE subscriptions.description = 'Fashion Magazine'; Inner Join SELECT COUNT(*) FROM newspaper JOIN online ON newspaper.id = online.id; Left Join A left join will keep all rows from the first table, regardles..

    SQL - Aggregate Functions

    Calculations performed on multiple rows of a table are called aggregates. Count The fastest way to calculate how many rows are in a table is to use the COUNT() function. SELECT COUNT(*) FROM fake_apps WHERE price = 0; Sum SUM() is a function that takes the name of a column as an argument and returns the sum of all the values in that column. SELECT SUM(downloads) FROM fake_apps; Max / Min The MAX..

    SQL - Queries

    Queries allow us to communicate with the database by asking questions and returning a result set with data relevant to the question. SELECT SELECT name, genre, year FROM movies; AS AS is a keyword in SQL that allows you to rename a column or table using an alias. SELECT name AS 'Titles' FROM movies; DISTINCT(중복 제거) DISTINCT is used to return unique values in the output. It filters out all duplic..