C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
MySQL FROM ClauseThe MySQL FROM Clause is used to select some records from a table. It can also be used to retrieve records from multiple tables using JOIN condition. Syntax: FROM table1 [ { INNER JOIN | LEFT [OUTER] JOIN| RIGHT [OUTER] JOIN } table2 ON table1.column1 = table2.column1 ] Parameterstable1 and table2: specify tables used in the MySQL statement. The two tables are joined based on table1.column1 = table2.column1. Note:
MySQL FROM Clause: Retrieve data from one tableThe following query specifies how to retrieve data from a single table. Use the following Query: SELECT * FROM officers WHERE officer_id <= 3; MySQL FROM Clause: Retrieve data from two tables with inner joinLet's take an example to retrieve data from two tables using INNER JOIN. Here, we have two tables "officers" and "students". Execute the following query: SELECT officers.officer_id, students.student_name FROM students INNER JOIN officers ON students.student_id = officers.officer_id; MySQL FROM Clause: Retrieve data from two tables using outer joinExecute the following query: SELECT officers.officer_id, students.student_name FROM officers LEFT OUTER JOIN students ON officers.officer_id = students.student_id;
Next TopicMySQL ORDER BY Clause
|