Blog 2019-01-02

SQL

SQL

1) SELECT column_name(s) - select columns column_name(s)
   FROM table_name       - from table_name
   WHERE column_name     -where columns column_name

2) SELECT * FROM table_name; - select table_name from the table

3) SELECT o.OrderID, o.OrderDate, c.CustomerName - select columns from tables
   FROM Customers AS c, Orders AS o - use aliases
   WHERE c.CustomerName="Around the Horn" AND c.CustomerID=o.CustomerID; - where the columns 

4) SELECT column_name(s) select columns column_name(s)
   FROM table1 - from table1
   LEFT JOIN table2 ON table1.column_name = table2.column_name; - 
and attach to the left to the table1 columns column1.column_name = table2.column_name