How to Avoid All in Joins in MySQL
Avoiding "all-in" joins while selecting data from a MySQL database allows your server to manipulate a smaller number of records and therefore faster process data. MySQL is a computer language that lets web developers create and integrate databases into their websites. A MySQL join is an operation that combines columns of data coming from two different tables inside the same database. While a default "all-in" join automatically selects each column inside both tables, you can, by using the correct syntax, ask your server to select only the columns you need.
Instructions
-
-
1
Open the script that contains your MySQL query in a text editor. You can, for example, use Notepad, the Windows text editor.
-
2
Insert the name of the first column you want to choose by typing it after the "SELECT" command. Because you are manipulating two tables at once, you need to identify to which table the column belongs. To do this, type the name of the table, followed by a period and the name of the column. For example, to select the "model" column inside the "cars" table, you should reference it as "cars.model."
-
-
3
Add additional columns by delimiting them with a comma. For example, the following query will perform a join only on two columns, the "model" column from the "cars" table and the "price" column from the "catalog" table:
SELECT cars.model, catalog.price FROM cars, catalog.
-
1