diff --git a/authors.sql b/authors.sql new file mode 100644 index 0000000..5cc6c67 --- /dev/null +++ b/authors.sql @@ -0,0 +1,6 @@ +INSERT INTO authors (author_id, author_name, origin) VALUES +(1, 'Alexander Pushkin', 'Russia'), +(2, 'Mark Twain', 'USA'), +(3, 'Jules Verne', 'France'), +(4, 'Л.Н. Толстой', 'Russia'), +(5, 'А.П. Чехов', 'Russia'); diff --git a/books.sql b/books.sql new file mode 100644 index 0000000..c7bce82 --- /dev/null +++ b/books.sql @@ -0,0 +1,9 @@ +INSERT INTO books (book_id, author_id, title, language, genre, age_rating, users_score) VALUES +(1, 1, 'Евгений Онегин', 'Russian', 'Роман', '16+', 4.5), +(2, 1, 'Eugene Onegin', 'English', 'Роман', '16+', 4.6), +(3, 2, 'Приключения Тома Соера', 'Russian', 'Повесть', '0+', 4.0), +(4, 2, 'The Adventures of Tom Sawyer', 'English', 'Повесть', '0+', 4.2), +(5, 3, 'Вокруг света за восемьдесят дней', 'Russian', 'Роман', '12+', 4.5), +(6, 3, 'Le tour du monde en quatre-vingts jours', 'French', 'Роман', '12+', 5.0), +(7, 4, 'Анна Каренина', 'Роман', 'Russian', '18+', 4.7), +(8, 5, 'Война и мир', 'Russian', 'Исторический роман', '12+', 4.3); diff --git a/departments.sql b/departments.sql new file mode 100644 index 0000000..be333d0 --- /dev/null +++ b/departments.sql @@ -0,0 +1,6 @@ +INSERT INTO departments (department_id, name) VALUES +(1, 'Development Department'), +(2, 'Marketing Department'), +(3, 'Finance Department'), +(4, 'HR Department'), +(5, 'Sales Department'); diff --git a/drivers_passengers_rides.sql b/drivers_passengers_rides.sql new file mode 100644 index 0000000..e0f4005 --- /dev/null +++ b/drivers_passengers_rides.sql @@ -0,0 +1,14 @@ +INSERT INTO drivers (driver_id, driver_name, phone) VALUES +(1, 'Иванов А.Б.', '+71112223344'), +(2, 'Петрова В.Г.', '+71113334455'); + +INSERT INTO passengers (passenger_id, passenger_name, phone) VALUES +(101, 'Орлов Д.Е.', '+72229998877'), +(102, 'Соколова Ж.З.', '+72228889900'), +(103, 'Ястребов И.К.', '+73339995566'); + +INSERT INTO rides (rideid, driver_id, passenger_id, price) VALUES +(1001, 1, 101, 567), +(1002, 1, 102, 234), +(1003, 2, 103, 1234), +(1004, 2, 103, 765); diff --git a/employees.sql b/employees.sql new file mode 100644 index 0000000..c1283aa --- /dev/null +++ b/employees.sql @@ -0,0 +1,7 @@ +INSERT INTO employees (employee_id, department_id, name, salary, position, manager_id) VALUES +(1, 1, 'John Smith', 50000, 'Programmer', 2), +(2, 1, 'Peter Johnson',60000, 'Head of development department', 4), +(3, 2, 'Mary Brown', 55000, 'Programmer', 2), +(4, 2, 'Alex Miller', 70000, 'Technical Director', NULL), +(5, 3, 'Helen White', 48000, 'Head of testing department', 4), +(6, NULL, 'Adam Smith', 10000, 'Tester', 5); diff --git a/materials_and_colors.sql b/materials_and_colors.sql new file mode 100644 index 0000000..6eba272 --- /dev/null +++ b/materials_and_colors.sql @@ -0,0 +1,8 @@ +INSERT INTO materials (material_id, material_name) VALUES +(100, 'хлопок'), +(101, 'лен'), +(102, 'шерсть'); + +INSERT INTO colors (color_id, color_name) VALUES +(0, 'красный'), +(1, 'синий'); diff --git a/orders_and_customers.sql b/orders_and_customers.sql new file mode 100644 index 0000000..ec77b32 --- /dev/null +++ b/orders_and_customers.sql @@ -0,0 +1,9 @@ +INSERT INTO customers (customer_id, customer_name, email) VALUES +(1, 'Иванов А.Б.', 'ivanov@email.com'), +(2, 'Петрова В.Г.', 'petrova@email.com'), +(3, 'Сидоров Ж.З.', 's_idorov@email.com'); + +INSERT INTO orders (order_id, customer_id, total_price) VALUES +(1000, 1, 100), +(1001, 1, 500), +(1002, 3, 300); diff --git a/schema.sql b/schema.sql index f7cdce7..91c5636 100644 --- a/schema.sql +++ b/schema.sql @@ -45,3 +45,80 @@ CREATE TABLE course_reviews ( body text, created_at timestamp ); + +CREATE TABLE colors ( + color_id INT PRIMARY KEY, + color_name VARCHAR(50) +); + +CREATE TABLE materials ( + material_id INT PRIMARY KEY, + material_name VARCHAR(50) +); + +CREATE TABLE authors ( + author_id INT PRIMARY KEY, + author_name VARCHAR(50), + origin VARCHAR(50) +); + +CREATE TABLE books ( + book_id INT PRIMARY KEY, + author_id INT, + title VARCHAR(100), + language VARCHAR(50), + genre VARCHAR(50), + age_rating VARCHAR(5), + users_score DECIMAL(3, 1) +); + +CREATE TABLE departments ( + department_id INT PRIMARY KEY, + name VARCHAR(50) +); + + +CREATE TABLE employees ( + employee_id INT PRIMARY KEY, + department_id INT, + name VARCHAR(50), + salary DECIMAL(10, 2) +); + +CREATE TABLE drivers ( + driver_id INT PRIMARY KEY, + driver_name VARCHAR(50), + phone VARCHAR(15) +); + +CREATE TABLE passengers ( + passenger_id INT PRIMARY KEY, + passenger_name VARCHAR(50), + phone VARCHAR(15) +); + +CREATE TABLE rides ( + rideid INT PRIMARY KEY, + driver_id INT, + passenger_id INT, + price DECIMAL(10, 2), + FOREIGN KEY (driver_id) REFERENCES drivers(driver_id), + FOREIGN KEY (passenger_id) REFERENCES passengers(passenger_id) +); + +CREATE TABLE customers ( + customer_id INT PRIMARY KEY, + customer_name VARCHAR(50), + email VARCHAR(50) +); + +CREATE TABLE orders ( + order_id INT PRIMARY KEY, + customer_id INT, + total_price DECIMAL(10, 2) +); + +CREATE TABLE employees_with_managers ( + employee_id INT PRIMARY KEY, + employee_name VARCHAR, +);