Website Development Prices

Website Development Prices

Wednesday, May 13, 2015

Ucitavanje podataka iz vise tabela istovremeno (Loading data from multiple tables at the same time)


Ako zelite da saznate koji su kupci kupili motore ovog meseca, podatke treba da potrazite u tabelama kupci i porudzbine. Ako hocete da znate sta su ti kupci kupili, podatke treba da potrazite u tabeli stvari_porudzbina.

Za ovo se koristi spajanje (en. join) operacija. 

Primer:

Da biste videli koje sve porudzbine pripadaju Nikoli Nikolicu, prvo treba da u tabeli kupci, u koloni sifrakupca pronadjete njegov identifikator, a zatim sa tim podatkom treba da pretrazite tabelu porudzbine da biste pronasli sve porudzbine s tim identifikatorom.

 Tabele se u MySQL-u mogu spojiti na dva nacina (od kojih svaki ima razlicitu svrhu):



If you want to find out which customers bought motobikes this month, you should search in the tables customers and orders. If you want to know what those customers bought, you should search for data in the table items_orders.

For this we use joining operation.

Example:

To see what are all orders belonging to Nikola Nikolic, you must first in the table customers, in the column customerid find its identifier, and then with that information you need to search the table orders to find all orders with this identifier.

The tables in MySQL can be joined in two ways (each of which has a different purpose):

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.