How to join a table many times in a single SQL query statement?

Having more than one join to the same table within a query can be confusing. More than one join can create a messy SQL statement. If you don’t use aliases they can be difficult to read. If your database tables need to have many columns with the same relationship to another table. You can join […]

When to use USING in a JOIN rather than JOINing ON?

What is the difference between ON and USING() when JOINing two or more tables together in a SQL query? For example you have the following two tables, Users and Products, when a Product is created, the Users id that created it is stored. Products table: id Primary Key created_by_user_id Foreign Key to Users table product_name […]

How to join the same table twice in a single SQL query statement?

Having more than one join to the same table can be confusing. You might not have even thought it was possible to have multiple joins to the same table. It is possible and easy to do with the help of aliases. Aliases for table names Aliases allow you to reference the table name with an […]

MySQL phpMyAdmin Tutorial, creating tables and joining tables together

Check out my first video tutorial on YouTube. I’m demonstrating MySQL phpMyAdmin, to get you started creating a database, creating and populating two MySQL tables and a simple SELECT statement showing how to join the two tables together. The text size does look a little small, so the next video will be zoomed in to […]

How to join three MySQL database tables together in a simple SELECT statement

Following on from my post of how to join two MySQL tables together, adding a third table is just as easy, but if you need an example this one extends the previous post by adding a third table. For example I have a table of products, table of product categories and table of product suppliers, […]