- If it has the same name in both tables, we can use
syntax. If the name differs, say we had CustomerId and CId, we would use the
ON Customers.CustomerId = Reservations.CIdsyntax
- The inner join selects only those records from database tables that have matching values;
The INNER keyword can be omitted.
LEFT OUTER JOINreturns all values from the left table, even if there is no match with the right table. In such rows, there will be NULL values. In other words, left outer join returns all the values from the left table, plus matched values from the right table. Note, that the OUTER keyword can be omitted.
- for the names in select, usually using table.column, but if there is only one table has such name, you can omit the table, just use select column, rather than specifying table.column.
Limit – MySQL CommandDefinition: Limit is used to limit your MySQL query results to those that fall within a specified range. You can use it to show the first X number of results, or to show a range from X – Y results. It is phrased as Limit X, Y and included at the end of your query. X is the starting point (remember the first record is 0) and Y is the duration (how many records to display).Examples:
SELECT * FROM `your_table` LIMIT 0, 10 This will display the first 10 results from the database.
SELECT * FROM `your_table` LIMIT 5, 5
This will show records 6, 7, 8, 9, and 10