· 8 years ago · Mar 23, 2018, 04:48 PM
1-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
2--
3-- Host: 127.0.0.1 Database: video_klub
4-- ------------------------------------------------------
5-- Server version 5.7.19
6
7/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10/*!40101 SET NAMES utf8 */;
11/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12/*!40103 SET TIME_ZONE='+00:00' */;
13/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CH]ECKS=0 */;
15/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
18--
19-- Table structure for table `clients`
20--
21
22DROP TABLE IF EXISTS `clients`;
23/*!40101 SET @saved_cs_client = @@character_set_client */;
24/*!40101 SET character_set_client = utf8 */;
25CREATE TABLE `clients` (
26 `id` int(11) NOT NULL AUTO_INCREMENT,
27 `first_name` varchar(45) NOT NULL,
28 `last_name` varchar(45) DEFAULT NULL,
29 `email` varchar(45) NOT NULL,
30 `address` varchar(45) NOT NULL,
31 `stock` int(11) NOT NULL DEFAULT '0',
32 PRIMARY KEY (`id`)
33) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
34/*!40101 SET character_set_client = @saved_cs_client */;
35
36--
37-- Dumping data for table `clients`
38--
39
40LOCK TABLES `clients` WRITE;
41/*!40000 ALTER TABLE `clients` DISABLE KEYS */;
42INSERT INTO `clients` VALUES (1,'Igor','Janosevic','igorjanosevic@gmail.com','Gandijeva 666',0),(3,'Joker','Batman','hbk','kubouib',0);
43/*!40000 ALTER TABLE `clients` ENABLE KEYS */;
44UNLOCK TABLES;
45
46CREATE TABLE `films` (
47 `id` int(11) NOT NULL AUTO_INCREMENT,
48 `title` varchar(45) NOT NULL,
49 `price` int(11) NOT NULL,
50 `stock` int(11) NOT NULL DEFAULT '0',
51 `current_stock` int(11) NOT NULL,
52 PRIMARY KEY (`id`)
53) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
54
55CREATE TABLE `rentals` (
56 `id` int(11) NOT NULL AUTO_INCREMENT,
57 `id_client` int(11) NOT NULL,
58 `totals` decimal(6,2) NOT NULL,
59 PRIMARY KEY (`id`)
60) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
61/*!40101 SET character_set_client = @saved_cs_client */;
62
63--
64-- Dumping data for table `rentals`
65--
66
67LOCK TABLES `rentals` WRITE;
68/*!40000 ALTER TABLE `rentals` DISABLE KEYS */;
69INSERT INTO `rentals` VALUES (1,1,666.00);
70UNLOCK TABLES;
71
72DROP TABLE IF EXISTS `rentals_films`;
73/*!40101 SET @saved_cs_client = @@character_set_client */;
74/*!40101 SET character_set_client = utf8 */;
75CREATE TABLE `rentals_films` (
76 `id` int(11) NOT NULL AUTO_INCREMENT,
77 `id_rental` int(11) NOT NULL,
78 `id_film` int(11) NOT NULL,
79 PRIMARY KEY (`id`),
80 KEY `fk_film_idx` (`id_film`),
81 KEY `fk_rentals_idx` (`id_rental`),
82 CONSTRAINT `fk_film` FOREIGN KEY (`id_film`) REFERENCES `films` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
83 CONSTRAINT `fk_rentals` FOREIGN KEY (`id_rental`) REFERENCES `rentals` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
84) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
85/*!40101 SET character_set_client = @saved_cs_client */;
86
87--
88-- Dumping data for table `rentals_films`
89--
90
91LOCK TABLES `rentals_films` WRITE;
92/*!40000 ALTER TABLE `rentals_films` DISABLE KEYS */;
93INSERT INTO `rentals_films` VALUES (2,1,1);
94UNLOCK TABLES;