The following SQL statement selects all the orders from the customer with
SELECT o.OrderID, o.OrderDate, c.CustomerName
FROM Customers AS c, Orders AS o
WHERE c.CustomerName="Around the Horn"
SELECT statement you tell which columns of the table(s) you need. If there are more tables with the same column names you have to specificy also the table name (tableName.columnName).
FROM statement you tell the tables from which you want to select the datas. In this query there are two tables separated from a comma, this is not a good idea, because there is the
JOIN statement to merge two tables in the correct way.
Finally with the
WHERE statement you can tell conditions to filter the data. In this query you want only the customers with name = 'Around the Horn' and you also tell to select only the rows with the same customer id in the customer and order tables.
This last condition should be specified with a join condition in the
FROM Customer AS c JOIN Orders AS o ON c.CustomerID = o.CustomerID
Otherwise using the comma in the
FROM it does the cartesian product between the two tables and then it select only the correct rows with the second
I suggest you to read a sql guide for beginners