You are on page 1of 2

-- Crear tabla para departamentos

CREATE TABLE departments (


department_id INT PRIMARY KEY,
department_name VARCHAR(50)
);

-- Insertar registros de ejemplo para departamentos


INSERT INTO departments (department_id, department_name) VALUES
(1, 'Ventas'),
(2, 'Marketing'),
(3, 'Recursos Humanos');

-- Crear tabla para empleados


CREATE TABLE employees (
employee_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(100),
phone_number VARCHAR(20),
hire_date DATE,
job_id INT,
salary INT,
manager_id INT,
department_id INT,
CONSTRAINT fk_department
FOREIGN KEY (department_id)
REFERENCES departments (department_id)
);

-- Insertar registros de ejemplo para empleados


INSERT INTO employees (employee_id, first_name, last_name, email, phone_number,
hire_date, job_id, salary, manager_id, department_id) VALUES
(1, 'John', 'Doe', 'jdoe@example.com', '555-1234', '2020-01-01', 1, 50000, NULL,
1),
(2, 'Jane', 'Smith', 'jsmith@example.com', '555-5678', '2020-01-02', 2, 60000, 1,
1),
(3, 'Bob', 'Johnson', 'bjohnson@example.com', '555-2468', '2020-01-03', 2, 55000,
1, 1),
(4, 'Sara', 'Gonzalez', 'sgonzalez@example.com', '555-1357', '2020-01-04', 3,
70000, NULL, 2),
(5, 'Mike', 'Lee', 'mlee@example.com', '555-7890', '2020-01-05', 4, 80000, 4, 2);

-- Crear tabla para trabajos


CREATE TABLE jobs (
job_id INT PRIMARY KEY,
job_title VARCHAR(50),
min_salary INT,
max_salary INT
);

-- Insertar registros de ejemplo para trabajos


INSERT INTO jobs (job_id, job_title, min_salary, max_salary) VALUES
(1, 'Representante de ventas', 30000, 60000),
(2, 'Gerente de ventas', 50000, 90000),
(3, 'Gerente de marketing', 60000, 100000),
(4, 'Director de marketing', 80000, 120000);
-- Crear tabla para ubicaciones
CREATE TABLE locations (
location_id INT PRIMARY KEY,
street_address VARCHAR(50),
city VARCHAR(50),
state_province VARCHAR(50),
country VARCHAR(50)
);

-- Insertar registros de ejemplo para ubicaciones


INSERT INTO locations (location_id, street_address, city, state_province, country)
VALUES
(1, '123 Main St', 'New York', 'NY', 'USA'),
(2, '456 Elm St', 'Los Angeles', 'CA', 'USA');

You might also like