-- Create the "users" table
CREATE TABLE users (
id INT PRIMARY KEY,
fullname VARCHAR(100),
email VARCHAR(100),
created_at DATETIME,
Country CHAR(2)
);
-- Insert sample data into the "users" table
INSERT INTO users (id, fullname, email, created_at, Country)
VALUES
(1, 'John Doe', 'john.doe@example.com', '2023-08-01', 'US'),
(2, 'Jane Smith', 'jane.smith@example.com', '2023-08-02', 'US'),
(3, 'Timothée Lecomte', 'timothee.lecomte@example.com', '2023-08-03', 'FR'),
(4, 'Luca Rossi', 'luca.rossi@example.com', '2023-08-04', 'IT'),
(5, 'María García', 'maria.garcia@example.com', '2023-08-05', 'ES');
-- Create the "products" table
CREATE TABLE products (
id INT PRIMARY KEY,
product_type INT,
name VARCHAR(100),
price DECIMAL(6, 2)
);
-- Insert sample data into the "products" table
INSERT INTO products (id, product_type, name, price)
VALUES
(1, 1, 'Product A', 100.00),
(2, 1, 'Product B', 75.50),
(3, 2, 'Product C', 50.25);
-- Create the "orders" table
CREATE TABLE orders (
id INT PRIMARY KEY,
user_id INT,
created_at DATETIME
);
-- Insert sample data into the "orders" table
INSERT INTO orders (id, user_id, created_at)
VALUES
(1001, 1, '2023-08-01 10:00:00'),
(1002, 1, '2023-08-02 11:00:00'),
(1003, 2, '2023-08-03 12:00:00'),
(1004, 3, '2023-08-04 13:00:00'),
(1005, 4, '2023-08-05 14:00:00'),
(1006, 5, '2023-08-06 15:00:00');
-- Create the "order_items" table
CREATE TABLE order_items (
order_id INT,
product_id INT,
quantity INT
);
-- Insert sample data into the "order_items" table
INSERT INTO order_items (order_id, product_id, quantity)
VALUES
(1001, 1, 2),
(1002, 2, 1),
(1003, 3, 3),
(1004, 1, 1),
(1004, 3, 2),
(1005, 2, 4),
(1006, 1, 3),
(1006, 3, 1);