Курсовая работа: База даних клієнтів і замовлень
[card_number] VARCHAR (40),
[date_from] DATETIME,
[date_to] DATETIME,
[other_details] VARCHAR (40),
CONSTRAINT [PK_Customers_Payment_Methods] PRIMARY KEY ([customer_payment_method_id]))
Створення таблиці Suppliers
CREATE TABLE [Suppliers] (
[supplier_code] VARCHAR (15) NOT NULL,
[supplier_name] VARCHAR (80),
[other_supplier_details] VARCHAR (255),
CONSTRAINT [PK_Suppliers] PRIMARY KEY ([supplier_code]))
Створення таблиці Ref_Delivery_Status_Codes
CREATE TABLE [Ref_Delivery_Status_Codes] (
[delivery_status_code] VARCHAR (15) NOT NULL,
[delivery_status_description] VARCHAR (80),
CONSTRAINT [PK_Ref_Delivery_Status_Codes] PRIMARY KEY ([delivery_status_code]))
Створення таблиці Customer_Orders_Delivery
CREATE TABLE [Customer_Orders_Delivery] (
[order_id] INTEGER NOT NULL,
[date_reported] DATETIME NOT NULL,
[delivery_status_code] VARCHAR (15) NOT NULL,
CONSTRAINT [PK_Customer_Orders_Delivery] PRIMARY KEY ([order_id], [date_reported]))
Додат окГ
SELECT Customers. *, Addresses. *
FROM Customers INNER JOIN
Customer_Addresses ON Customers. customer_id = Customer_Addresses. customer_id INNER JOIN
Addresses ON Customer_Addresses. address_id = Addresses. address_id
Додат окД
SELECT Customers. first_name, Customers. middle_name, Customers. last_name, Customers. customer_phone, Addresses. city,
Addresses. state_province_county, Products. product_price, Suppliers. supplier_name, Suppliers. other_supplier_details
FROM Addresses CROSS JOIN