ALIAS , JOINS
Aliases are used to give a temporary name to particular column and table
SYNTAX
SELECT column1 as alias_name, column2 as alias_name, ...
FROM table_name as alias_name
EXAMPLE
SELECT id as user_id, name as user_name
FROM users as mobile_users
SELECT column1 as alias_name, column2 as alias_name, ...
FROM table_name as alias_name
EXAMPLE
SELECT id as user_id, name as user_name
FROM users as mobile_users
JOINS : used to select columns from multiple table based on the related columns between them.
There are different types joins available as mentioned below.
INNER JOIN : It gives matching records in both the joined tables.
FULL OUTER JOIN: It gives all records from left and right table if there is at least one matching record in both of the tables.
LEFT JOIN:It gives all the records from the left table and only matching records from the right table.
RIGHT JOIN: It gives all the records from the right table and only matching records from the left table.
SELF JOIN: It is used to make relationship between column of the same table and then retrieving data based on condition on same column in same table.