Selecting all columns
Below two queries will display all the columns from departments table.
SELECT * FROM departments;
SELECT department_id,department_name,manager_id,location_id FROM departments;
So we can replace the column names with an asterisk ( * ) when we want to display all the columns of a table. Or specify only the column names which you want to display like in second example.
Using Arithmetic Operators
Create expressions with number and date data by using below Arithmetic operators:
+ addition
- subtraction
* multiplication
/ division
Example: The below query will display all employees first name along with their salary + 500.
Note- salary + 500 is not a new column in employees table its only for display purpose.
SELECT first_name,salary+500 FROM employees;
Using Column Alias
Used to rename a column heading mainly useful with columns with calculation.
Suppose in the above query i don't like to see SALARY +500 as heading instead i want to see something more meaning full like RESTRUCTURED_SALARY then we simply put RESTRUCTURED_SALARY after SALARY +500 in our query.
Note- It is always good to put your alias in double quotes " " to make it case sensitive or if it has special characters or spaces.
SELECT first_name,salary+500 "RESTRUCTURED_SALARY" FROM employees;


