1SELECT TableA.*, TableB.*, TableC.*, TableD.*
2FROM TableA
3 JOIN TableB
4 ON TableB.aID = TableA.aID
5 JOIN TableC
6 ON TableC.cID = TableB.cID
7 JOIN TableD
8 ON TableD.dID = TableA.dID
9WHERE DATE(TableC.date)=date(now())
10
1-- UNION: distinct values (slower)
2SELECT emp_name AS name from employees
3UNION
4SELECT cust_name AS name from customers;
5
6-- UNION ALL: keeps duplicates (faster)
7SELECT emp_name AS name from employees
8UNION ALL
9SELECT cust_name AS name from customers;
1SELECT Books_Namn, Author_Namn, Author_Age, Store_Namn FROM books
2
3JOIN Author ON Author_Id = Author_Author_Id
4
5JOIN Books_has_Store ON Books_Books_Id = Books_Id
6
7JOIN Store ON Store_Id = Store_Store_Id;