Exercises_SQL
Exercises_SQL
filename=trysql_select_all
8 tables with 932 records in total
OrderDetails
OrderDetailID
Categories Products
OrderID
CategoryID ProductID Orders ProductID
CategoryID OrderID
SupplierID CustomerID
Employees
EmployeeID
EmployeeID
ShipperID
Suppliers
SupplierID
Customers Shippers
CustomerID ShipperID
1. Customers table
No. Field name Field type NOT NULL Unique
1. CustomerID Integer x x
2. CustomerName String x
3. ContactName String x
4. Address String
5. City String
6. PostalCode String x
7. Country String
1
2. Categories table
No. Field name Field type NOT NULL Unique
1. CategoryID Integer x x
2. CategoryName String x
3. Description String
3. Employees table
No. Field name Field type NOT NULL Unique
1. EmployeeID Integer x x
2. LastName String x
3. FirstName String x
4. Birthdate Date x
5. Photo String
6. Note String
2
4. Products table
No. Field name Field type NOT NULL Unique
1. ProductID Integer x x
2. ProductName String x
3. SupplierID Integer x
4. CategoryID Integer x
5. Unit String
6. Price Double x
5. Suppliers table
No. Field name Field type NOT NULL Unique
1. SupplierID Integer x x
2. SupplierName String x
3. ContactName String x
4. Address String x
5. City String
6. PostalCode String x
7. Country String
8. Phone String
3
6. Shippers table
No. Field name Field type NOT NULL Unique
1. ShipperID Integer x x
2. ShipperName String x
3. Phone String x
7. Orders table
No. Field name Field type NOT NULL Unique
1. OrderID Integer x x
2. CustomerID Integer x
3. EmployeeID Integer x
4. OrderDate DateTime x
5. ShipperID Integer x
4
8. OrderDetails table
No. Field name Field type NOT NULL Unique
1. OrderDetailID Integer x x
2. OrderID Integer x
3. ProductID Integer x
4. Quantity Integer x
10
5
SELECT * FROM Customers;
WHERE City = 'London’;
SELECT Product.*
FROM Product, Categories
WHERE Product.categoryid = Categories.categoryid and
CategoryName = ‘seafood’;
11
12