-- phpMyAdmin SQL Dump
-- version 5.2.0
--
-- База данных: `employees_computers`
--

CREATE TABLE `employees` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `last_name` varchar(40) NOT NULL,
  `room_number` varchar(10) NOT NULL,
  `department` varchar(40) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `employees` (`id`, `last_name`, `room_number`, `department`) VALUES
(1, 'Иванов', '201', 'ИТ'),
(2, 'Петров', '305', 'Бухгалтерия');

CREATE TABLE `computers` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `employee_id` int unsigned NOT NULL,
  `model` varchar(60) NOT NULL,
  `cpu` varchar(30) DEFAULT NULL,
  `ram` varchar(20) DEFAULT NULL,
  `hdd` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `employee_id` (`employee_id`),
  CONSTRAINT `computers_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `computers` (`id`, `employee_id`, `model`, `cpu`, `ram`, `hdd`) VALUES
(1, 1, 'HP ProDesk', 'i5-10400', '16GB', '512GB SSD'),
(2, 2, 'Lenovo ThinkCentre', 'i3-9100', '8GB', '256GB SSD');
