MySQL INNER JOIN

MySQL SELECT

Using MySQL INNER JOIN you can match rows in one table with another table and get result set that contain columns from both tables.

Suppose we have two tables user and order. So Using this join we will get the result row where userid from user table and userid from order table matches.

Read Also: Understanding MySQL LEFT JOIN

EXAMPLE:

SELECT username,
address,
email
FROM user U1
INNER JOIN order O2 ON U1.userid = O2.userid;

So here some user may be present in user table who did not order anything. In that case those users will not be visible.

This selects all rows from both tables as long as there is any match between the columns. If there are rows in the “U1” table that do not have matches in “O2”, these users will NOT be listed.

For any types of queries, you can contact us on info@namasteui.com.

You may like:  IF statement in MySQL stored procedures

Leave a Reply

Your email address will not be published. Required fields are marked *