SQL 3. Grouping

Here we go through other basic SQL commands for grouping: 1. Aggregate Functions Aggregate functions aggregate values in multiple rows to one value. COUNT in SQL 1. Basics is one of aggregate functions. Here are commonly used aggregate functions: SUM() AVG() MIN() MAX() COUNT() The examples are as follows: SELECT SUM(column_name1) FROM table_name1 You usually need to specify the column name inside the parentheses. COUNT accepts *. Aggregate functions cannot be used with other columns that are not aggregated. This is because aggregation results in only one value while other columns may have multiple values. Thus, the syntax below is not possible: ...

May 31, 2025 · map[name:Minjun Jeon]

SQL 2. Filtering

Here we go through other basic SQL commands for filtering: 1. WHERE WHERE is used to filter the data in the output. It always comes after FROM. The syntax is: SELECT column_name1, column_name2 FROM table_name1 WHERE condition For example, we can filter out all columns where the amount is 10.99. SELECT * FROM payment WHERE amount = 10.99 Furthermore, we can filter out certain columns. SELECT first_name, last_name FROM customer WHERE first_name = 'ADAM' Enclose the texts around '. We can use other operators to filter the data, e.g. >,<, <=, >=, != or <>, ...

May 30, 2025 · map[name:Minjun Jeon]

Intro to SQL

1. SQL SQL stands for structured query language. It is a language to interact with databases. Database is an organized collection of structured information, or data, typically stored electronically in a computer system. Database consists of schemas, which are a collection of tables and help structuring the database. Database is managed by Database Management Systems(DBMS). One example of DMBS is PostgreSQL. a) Dialects of SQL All DMBS’s have slightly different dialects even though the differences are small. Among all DMBS’s, PostgreSQL is a good place to start because ...

May 29, 2025 · map[name:Minjun Jeon]

SQL 1. Basics

Here, we go through basic SQL commands: 1. SELECT SELECT is used to select and return data. For a single column, the syntax is as below: SELECT column_name FROM table_name1 For multiple columns, you just list the column names with ,. SELECT column_name1, column_name2 FROM table_name1 To select all columns, use *. SELECT * FROM table_name1 Note that the exact format doesn’t matter, e.g. the two examples are the same: ...

May 29, 2025 · map[name:Minjun Jeon]