SQL

Syntax

SELECT column_names FROM table_name [WHERE condition] [ORDER BY {columns/expr}] [ASC/DESC].

Fetch data

Filter data

Sort data

Types of Functions

Single row functions: works with 1 row at a time; returns 1 result per row

Number functions: ROUND(92.423, 2)

Case function

SELECT name,job,salary,
CASE job WHEN 'Manager' THEN 1.20*salary
	WHEN 'Analyst' THEN 1.15*salary
		WHEN 'Clerk' THEN 1.10*salary
		ELSE salary
		END 'Revised Salary'
FROM emp_tab;

Character functions

Multiple rows function: works with a group of rows at a time; returns 1 result for every group of rows **CANNOT be used in WHERE

GROUP BY clause

Multiple tables