+ 1
I don't understand about joining table. Can anyone help me Please?
SELECT customers.ID, customers.Name, orders.Name, orders.Amount FROM customers, orders WHERE customers.ID=orders.Customer_ID ORDER BY customers.ID;
1 Antwort
+ 1
You combine the tables customers and orders to get data from both tables. In your example, you select id and name from the customers table and name and amount from the orders table.
The orders table has a value Customer_ID which is a foreign key to the customers table. If it matches the value ID from the customers table, you know that the customer with that ID is the one who bought the item from the orders table. That's what you check with the WHERE statement.