So in MySQL, if we wanna select or retrieve records of single or multiple tables, the 'from' clause is used.
Syntax
SELECT * FROM tablename
Note:
- If a FROM clause is used in MySQL, at least one table must be selected in the query.
- If two or more tables are used in MySQL using the 'FROM' clause, they are likely to be joined using the inner and outer join.
MySQL FROM Clause: Retrieving One Table
The below query specifies how single table data is retrieved.
SELECT * FROM employee;
MySQL FROM Clause: Retrieving Two Table Data
We have two tables, employee and salary, and want two data using an inner join.
SELECT employee.firstName, salary.may FROM salary INNER JOIN employee ON salary.salID = employee.empID;
This will get two-column data firstname and may columns from both tables based on the standard IDS.
Conclusion:
So this is one way of using FROM clause in MySQL effectively.