diff --git a/IBM DB2/Chapter 01/Listing 1.001.sql b/IBM DB2/Chapter 01/Listing 1.001.sql index 1318791..d5aea89 100644 --- a/IBM DB2/Chapter 01/Listing 1.001.sql +++ b/IBM DB2/Chapter 01/Listing 1.001.sql @@ -3,9 +3,12 @@ SET SCHEMA Item02Example; -SELECT ST.SalesID, C.CustFirstName, C.CustLastName, C.Address, C.City, C.Phone, - ST.PurchaseDate, M.ModelYear, M.Model, E.SalesPerson - FROM SalesTransactions ST, Employees E, Customers C, AutomobileModels M - WHERE C.CustomerID = ST.CustomerID - AND M.ModelID = ST.ModelID - AND E.EmployeeID = ST.SalesPersonID; +SELECT st.SalesID, c.CustFirstName, c.CustLastName, c.Address, c.City, c.Phone, + st.PurchaseDate, m.ModelYear, m.Model, e.SalesPerson +FROM SalesTransactions AS st + INNER JOIN Customers AS c + ON c.CustomerID = st.CustomerID + INNER JOIN Employees AS e + ON e.EmployeeID = st.SalesPersonID + INNER JOIN AutomobileModels AS m + ON m.ModelID = st.ModelID; \ No newline at end of file diff --git a/Microsoft SQL Server/Chapter 01/Listing 1.001.sql b/Microsoft SQL Server/Chapter 01/Listing 1.001.sql index 847f8b9..49ef3e8 100644 --- a/Microsoft SQL Server/Chapter 01/Listing 1.001.sql +++ b/Microsoft SQL Server/Chapter 01/Listing 1.001.sql @@ -4,9 +4,12 @@ USE Item02Example; GO -SELECT ST.SalesID, C.CustFirstName, C.CustLastName, C.Address, C.City, C.Phone, - ST.PurchaseDate, M.ModelYear, M.Model, E.SalesPerson - FROM SalesTransactions ST, Employees E, Customers C, AutomobileModels M - WHERE C.CustomerID = ST.CustomerID - AND M.ModelID = ST.ModelID - AND E.EmployeeID = ST.SalesPersonID; +SELECT st.SalesID, c.CustFirstName, c.CustLastName, c.Address, c.City, c.Phone, + st.PurchaseDate, m.ModelYear, m.Model, e.SalesPerson +FROM SalesTransactions st + INNER JOIN Customers c + ON c.CustomerID = st.CustomerID + INNER JOIN Employees e + ON e.EmployeeID = st.SalesPersonID + INNER JOIN AutomobileModels m + ON m.ModelID = st.ModelID; diff --git a/Oracle/Chapter 01/Listing 1.001.sql b/Oracle/Chapter 01/Listing 1.001.sql index df56ee2..d0513d9 100644 --- a/Oracle/Chapter 01/Listing 1.001.sql +++ b/Oracle/Chapter 01/Listing 1.001.sql @@ -3,9 +3,13 @@ ALTER SESSION SET CURRENT_SCHEMA = Item02Example; -SELECT ST.SalesID, C.CustFirstName, C.CustLastName, C.Address, C.City, C.Phone, - ST.PurchaseDate, M.ModelYear, M.Model, E.SalesPerson - FROM SalesTransactions ST, Employees E, Customers C, AutomobileModels M - WHERE C.CustomerID = ST.CustomerID - AND M.ModelID = ST.ModelID - AND E.EmployeeID = ST.SalesPersonID; +SELECT st.SalesID, c.CustFirstName, c.CustLastName, c.Address, c.City, c.Phone, + st.PurchaseDate, m.ModelYear, m.Model, e.SalesPerson +FROM SalesTransactions st + INNER JOIN Customers c + ON c.CustomerID = st.CustomerID + INNER JOIN Employees e + ON e.EmployeeID = st.SalesPersonID + INNER JOIN AutomobileModels m + ON m.ModelID = st.ModelID; + diff --git a/PostgreSQL/Chapter 01/Listing 1.001.sql b/PostgreSQL/Chapter 01/Listing 1.001.sql index 059878e..5b0c82b 100644 --- a/PostgreSQL/Chapter 01/Listing 1.001.sql +++ b/PostgreSQL/Chapter 01/Listing 1.001.sql @@ -3,9 +3,13 @@ SET search_path = Item02Example; -SELECT ST.SalesID, C.CustFirstName, C.CustLastName, C.Address, C.City, C.Phone, - ST.PurchaseDate, M.ModelYear, M.Model, E.SalesPerson - FROM SalesTransactions AS ST, Employees AS E, Customers AS C, AutomobileModels AS M - WHERE C.CustomerID = ST.CustomerID - AND M.ModelID = ST.ModelID - AND E.EmployeeID = ST.SalesPersonID; \ No newline at end of file +SELECT st.SalesID, c.CustFirstName, c.CustLastName, c.Address, + c.City, c.Phone, st.PurchaseDate, m.ModelYear, m.Model, + e.SalesPerson +FROM SalesTransactions AS st + INNER JOIN Customers AS c + ON c.CustomerID = st.CustomerID + INNER JOIN Employees AS e + ON e.EmployeeID = st.SalesPersonID + INNER JOIN AutomobileModels AS m + ON m.ModelID = st.ModelID; \ No newline at end of file