SQL HTI 3
SQL HTI 3
New
DEPARTMENTS row
• Example:
TRUNCATE TABLE copy_emp;
SELECT *
FRO departments;
M
Operator Description
+ Add
- Subtract
* Multiply
/ Divide
…
SELECT last_name, salary, 12*(salary+100)
FROM employees;
2
A column alias:
• Renames a column heading
• Is useful with calculations
• Immediately follows the column name (There can also be
the optional AS keyword between the column name and
alias.)
• Requires double quotation marks if it contains spaces or
special characters, or if it is case-sensitive
…
SELECT last_name "Name" , salary*12 "Annual Salary"
FROM employees;
A concatenation operator:
• Links columns or character strings to other columns
• Is represented by two vertical bars (||)
• Creates a resultant column that is a character expression
SELECT last_name||job_id "Employees"
FROM employees;