Skip to content

Instantly share code, notes, and snippets.

-- Create the employees table
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
department_id INT
);
-- Insert sample data into the employees table
INSERT INTO employees (employee_id, first_name, last_name, department_id)
CREATE TABLE employee_skills (
employee_id INT,
skill_name VARCHAR(50),
skill_level INT
);
INSERT INTO employee_skills (employee_id, skill_name, skill_level)
VALUES
(1, 'Java', 4),
(1, 'SQL', 3),
-- Create the Sales table
CREATE TABLE Sales (
Date DATE,
Amount DECIMAL(10, 2)
);
-- Insert sample data into the Sales table
INSERT INTO Sales (Date, Amount) VALUES
('2023-09-01', 100.00),
('2023-09-02', 75.50),
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
employee_name VARCHAR(50),
department_id INT
);
CREATE TABLE departments (
department_id INT PRIMARY KEY,
department_name VARCHAR(50)
);
CREATE TABLE products (
product_id INT PRIMARY KEY,
product_name VARCHAR(255),
category_id INT,
price DECIMAL(10, 2)
);
INSERT INTO products (product_id, product_name, category_id, price)
VALUES
(1, 'Product A', 1, 10.99),
CREATE TABLE employee_comments (
employee_id INT,
comment_text VARCHAR(255)
);
INSERT INTO employee_comments (employee_id, comment_text)
VALUES
(1, 'John is a hard worker.'),
(1, 'John is very reliable.'),
(2, 'Alice is a great team player.'),
CREATE TABLE orders (
order_id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT,
order_date DATE,
total_amount DECIMAL(10, 2)
);
-- Insert sample data into the 'orders' table
INSERT INTO orders (customer_id, order_date, total_amount)
VALUES
CREATE TABLE orders (
order_id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT,
order_date DATE,
product_name VARCHAR(255),
quantity INT
);
-- Inserting data into the table
INSERT INTO orders (customer_id, order_date, product_name, quantity)
CREATE TABLE Products (
ProductID INT PRIMARY KEY,
Attribute1 VARCHAR(50),
Attribute2 VARCHAR(50),
Attribute3 VARCHAR(50)
);
INSERT INTO Products (ProductID, Attribute1, Attribute2, Attribute3)
VALUES
(1, 'Red', 'Large', 'Cotton'),
CREATE TABLE Items (
id INT AUTO_INCREMENT PRIMARY KEY,
Category VARCHAR(255),
Price DECIMAL(5,2)
);
INSERT INTO Items (Category, Price) VALUES
('Fruit', 2.5),
('Fruit', 3.0),
('Veg', 1.0),