-- MariaDB dump 10.19  Distrib 10.5.23-MariaDB, for Linux (x86_64)
--
-- Host: localhost    Database: user110
-- ------------------------------------------------------
-- Server version	10.5.23-MariaDB

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `city`
--

DROP TABLE IF EXISTS `city`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `city` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `city`
--

LOCK TABLES `city` WRITE;
/*!40000 ALTER TABLE `city` DISABLE KEYS */;
INSERT INTO `city` VALUES (1,'Moscow'),(2,'Saint Petersburg'),(3,'Novosibirsk'),(4,'Kazan'),(5,'Yekaterinburg'),(6,'Nizhny Novgorod'),(7,'Samara'),(8,'Omsk'),(9,'Rostov-on-Don'),(10,'Chelyabinsk');
/*!40000 ALTER TABLE `city` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `customer`
--

DROP TABLE IF EXISTS `customer`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `customer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `customer`
--

LOCK TABLES `customer` WRITE;
/*!40000 ALTER TABLE `customer` DISABLE KEYS */;
INSERT INTO `customer` VALUES (1,'Ivan Petrov'),(2,'Elena Smirnova'),(3,'Mikhail Kuznetsov'),(4,'Olga Popova'),(5,'Andrey Volkov'),(6,'Tatiana Morozova'),(7,'Dmitry Novikov'),(8,'Natalia Fedorova'),(9,'Sergey Mikhailov'),(10,'Anna Alekseeva');
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `inventory`
--

DROP TABLE IF EXISTS `inventory`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `inventory` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `item_id` int(11) NOT NULL,
  `type` enum('IN','OUT') NOT NULL,
  `quantity` int(11) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `date` date DEFAULT curdate(),
  `customer_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `item_id` (`item_id`),
  KEY `customer_id` (`customer_id`),
  CONSTRAINT `inventory_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `item` (`id`),
  CONSTRAINT `inventory_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `inventory`
--

LOCK TABLES `inventory` WRITE;
/*!40000 ALTER TABLE `inventory` DISABLE KEYS */;
INSERT INTO `inventory` VALUES (1,1,'IN',30,450.00,'2024-01-10',NULL),(2,2,'IN',20,890.00,'2024-01-12',NULL),(3,3,'IN',25,520.00,'2024-01-15',NULL),(4,4,'IN',15,680.00,'2024-01-18',NULL),(5,5,'IN',40,390.00,'2024-01-20',NULL),(6,6,'IN',35,410.00,'2024-01-22',NULL),(7,7,'IN',22,550.00,'2024-01-25',NULL),(8,8,'IN',18,720.00,'2024-01-27',NULL),(9,9,'IN',50,350.00,'2024-01-30',NULL),(10,10,'IN',28,480.00,'2024-02-01',NULL),(11,1,'OUT',5,500.00,'2024-02-05',1),(12,1,'OUT',3,500.00,'2024-02-10',2),(13,2,'OUT',4,950.00,'2024-02-07',3),(14,2,'OUT',2,950.00,'2024-02-12',4),(15,3,'OUT',6,580.00,'2024-02-08',5),(16,3,'OUT',4,580.00,'2024-02-14',6),(17,4,'OUT',2,750.00,'2024-02-09',7),(18,5,'OUT',10,420.00,'2024-02-11',8),(19,5,'OUT',8,420.00,'2024-02-15',9),(20,6,'OUT',7,450.00,'2024-02-13',10),(21,6,'OUT',5,450.00,'2024-02-16',1),(22,7,'OUT',3,600.00,'2024-02-15',2),(23,8,'OUT',4,780.00,'2024-02-17',3),(24,9,'OUT',15,380.00,'2024-02-18',4),(25,9,'OUT',12,380.00,'2024-02-20',5),(26,10,'OUT',5,520.00,'2024-02-19',6);
/*!40000 ALTER TABLE `inventory` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `item`
--

DROP TABLE IF EXISTS `item`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `author` varchar(100) DEFAULT NULL,
  `year` int(11) DEFAULT NULL,
  `price` decimal(10,2) DEFAULT NULL,
  `supplier_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `supplier_id` (`supplier_id`),
  CONSTRAINT `item_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `supplier` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `item`
--

LOCK TABLES `item` WRITE;
/*!40000 ALTER TABLE `item` DISABLE KEYS */;
INSERT INTO `item` VALUES (1,'The Master and Margarita','Mikhail Bulgakov',1967,450.00,1),(2,'War and Peace','Leo Tolstoy',1869,890.00,2),(3,'Crime and Punishment','Fyodor Dostoevsky',1866,520.00,3),(4,'Anna Karenina','Leo Tolstoy',1877,680.00,4),(5,'Dead Souls','Nikolai Gogol',1842,390.00,5),(6,'Fathers and Sons','Ivan Turgenev',1862,410.00,6),(7,'The Idiot','Fyodor Dostoevsky',1869,550.00,7),(8,'Doctor Zhivago','Boris Pasternak',1957,720.00,8),(9,'The Twelve Chairs','Ilya Ilf',1928,350.00,9),(10,'We','Yevgeny Zamyatin',1924,480.00,10);
/*!40000 ALTER TABLE `item` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `supplier`
--

DROP TABLE IF EXISTS `supplier`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `supplier` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `city_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `city_id` (`city_id`),
  CONSTRAINT `supplier_ibfk_1` FOREIGN KEY (`city_id`) REFERENCES `city` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `supplier`
--

LOCK TABLES `supplier` WRITE;
/*!40000 ALTER TABLE `supplier` DISABLE KEYS */;
INSERT INTO `supplier` VALUES (1,'Bookseller LLC',1),(2,'Piter Publishing House',2),(3,'Siberian Book Center',3),(4,'Tatarstan Press',4),(5,'Ural Books',5),(6,'Volga Book Trading',6),(7,'Samara Book World',7),(8,'Omsk Printing House',8),(9,'South Book Company',9),(10,'Chelyabinsk Book Depot',10);
/*!40000 ALTER TABLE `supplier` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2026-03-19 15:27:48
