Files
sql_advanced/lab2-8-test/task4.sql
T
Vitalii Litvinchuk 6deed0469a first commit
2026-05-04 23:15:09 +03:00

23 lines
1.2 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#################################################
################ Завдання 4 ###################
--------------------------------------------------
1. Створіть нову таблицю "DeliveryAddress" з такими полями та обмеженнями:
ID: первинний ключ, цілочисельний тип даних
Address: змінний символьний тип даних довжиною 255 символів, не порожнє
Type: змінний символьний тип даних довжиною 100 символів, не порожнє, значення за замовчуванням "Private"
CustomerID: зовнішній ключ (звязок із первинним ключем таблиц "Customers"), цілочисельний тип даних, не порожнє.
2. Відобразійть структуру таблиці з допомогою команди SHOW CREATE TABLE
create table DeliveryAddress (
ID int PRIMARY KEY,
Address varchar(255) NOT NULL,
Type varchar(100) NOT NULL DEFAULT 'Private',
CustomerID int NOT NULL,
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID)
);
-- DeliveryAddress_ibfk_1
show create table DeliveryAddress;