mysql - understanding join -


im looking @ code:

select customers.name customers, orders, order_items, books customers.customerid = orders.customerid , orders.orderid = order_items.orderid , order_items.isbn = books.isbn , books.title '%java%'; 

and find difficult understand it.

first have 4 tables, , code making dynamic table,
should @ different order understand better?

first, im selecting customer.name, after last code run , have dynamic table, right?

should try , line each 2 tables line line using dynamic table made line earlier?

and while table being made, data table written or ask in where?

ill appreciate help.

as far theory goes, when query multiple tables in attempt join table, temporary cross-product of tables involved calculated. imply total number of rows multiplication of number of rows of each table.

in practice however, implementation of sql (mysql in case) take care efficiently compute query. query execution path computed, based on various parameters, , used obtain desired output.

a better way of writing above statement follow new syntax:

select customers.name customers inner join orders on customers.customerid = orders.customerid inner join order_items on orders.orderid = order_items.orderid inner join books on order_items.isbn = books.isbn books.title '%java%' 

read more here reasons why.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -