SQL QUERY
In this example we are going to learn the LEFT JOIN in MYSQL.
Create one table… And add some user name in it… First column is auto.
Also create second table and add the value but remember one this is 1st column is PK and auto increment, 2nd column is basically associated with the tbl_user(user_id )field and 3rd is food name.
Check out the image below… you can see that
Food_user_id “1” means “HARSHIDA” like 4 food items, and “2” means “JAYSHREE” like 2 food items.
RIGHT JOIN: - Add one extra record in our food table… But user id is something different then exists into our PK table.
EITHER IN RIGHT JOIN, IF RECORD NOT FOUND LEFT TABLE (EQUAL TO LEFT SIDE TABLE)OF RIGHT JOIN THEN IT WILL DISPLAY THE DATA. SAME THING HAPPENS IN LEFT JOIN AS WELL.
CHECK THE LAST ROW FIRST COLUMN…








No comments:
Post a Comment