/*создание таблиц*/
CREATE TABLE customers (
customer_id INTEGER PRIMARY KEY AUTOINCREMENT,
customer_name TEXT,
age INTEGER
);
CREATE TABLE orders (
order_id INTEGER PRIMARY KEY AUTOINCREMENT,
product_id INTEGER,
customer_id INTEGER,
order_date TEXT,
quantity INTEGER
);
CREATE TABLE sales (
sale_id INTEGER PRIMARY KEY AUTOINCREMENT,
product_id INTEGER,
store_id INTEGER,
sale_date TEXT,
quantity INTEGER
);
CREATE TABLE products (
product_id INTEGER PRIMARY KEY AUTOINCREMENT,
product_name TEXT,
category TEXT,
price INTEGER
);
CREATE TABLE stores (
store_id INTEGER PRIMARY KEY AUTOINCREMENT,
store_name TEXT,
city TEXT,
region TEXT
);
/*добавление данных в таблицы*/
INSERT INTO customers (customer_name, age) VALUES ('Джон', 30), ('Джейн', 32), ('Майк', 40), ('Сара', 20), ('Дэвид', 25);
INSERT INTO orders (product_id, customer_id, order_date, quantity) VALUES (1, 1, '2023-07-20', 10), (2, 2, '2023-07-21', 5), (3, 3, '2023-07-22', 8), (4, 4, '2023-07-23', 12), (5, 5, '2023-07-24', 15);
INSERT INTO products (product_name, category, price) VALUES ('Продукт А', 'Электроника', 10000), ('Продукт Б', 'Электроника', 15000), ('Продукт В', 'Одежда', 500), ('Продукт Г', 'Одежда', 750), ('Продукт Д', 'Дом', 250);
INSERT INTO sales (product_id, store_id, sale_date, quantity) VALUES (1, 1, '2023-01-01', 10), (2, 1, '2023-01-01', 5), (3, 2, '2023-01-01', 20), (4, 3, '2023-01-02', 15), (5, 4, '2023-01-02', 30), (1, 5, '2023-01-03', 8), (2, 5, '2023-01-03', 12), (3, 4, '2023-01-04', 10), (4, 3, '2023-01-04', 10), (5, 2, '2023-01-05', 25);
INSERT INTO stores (store_name, city, region) VALUES ('Магазин 1', 'Нью-Йорк', 'Северная Америка'), ('Магазин 2', 'Лос-Анджелес', 'Северная Америка'), ('Магазин 3', 'Лондон', 'Великобритания'), ('Магазин 4', 'Париж', 'Европа'), ('Магазин 5', 'Москва', 'Европа');
Last active
September 19, 2023 19:46
-
-
Save kianurivzzz/5c5d83fa8365f652fcd074512121515b to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment