DDL, DML, Basic, Filter

This commit is contained in:
Bonifatsiy
2026-05-11 06:50:16 +04:00
parent d280456d09
commit 0f63e21353
4 changed files with 306 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
CREATE TABLE dsolovianov.users (
id INT GENERATED ALWAYS AS IDENTITY NOT NULL,
name VARCHAR(100) NOT NULL,
age INT,
email VARCHAR(100),
country VARCHAR(100),
is_active BOOLEAN,
created_at TIMESTAMPTZ NOT NULL
);
CREATE TABLE dsolovianov.products (
id INT GENERATED ALWAYS AS IDENTITY NOT NULL,
name VARCHAR(100) NOT NULL,
category VARCHAR(50),
price DECIMAL(10,2) NOT NULL,
in_stock BOOLEAN
);
CREATE TABLE dsolovianov.orders (
id INT GENERATED ALWAYS AS IDENTITY NOT NULL,
user_id INT,
order_date TIMESTAMPTZ NOT NULL,
status VARCHAR(20)
);
CREATE TABLE dsolovianov.order_items (
order_id INT NOT NULL,
product_id INT NOT NULL,
quantity INT NOT NULL,
price_at_purchase DECIMAL(10,2) NOT NULL,
CONSTRAINT order_items_pk PRIMARY KEY (order_id, product_id)
);