· 8 years ago · Mar 07, 2018, 01:18 PM
1CREATE DATABASE IF NOT EXISTS `test1` /*!40100 DEFAULT CHARACTER SET utf8 */;
2USE `test1`;
3-- MySQL dump 10.13 Distrib 5.7.12, for linux-glibc2.5 (x86_64)
4--
5-- Host: localhost Database: test1
6-- ------------------------------------------------------
7-- Server version 5.7.21-0ubuntu0.16.04.1
8
9/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
10/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
11/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
12/*!40101 SET NAMES utf8 */;
13/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
14/*!40103 SET TIME_ZONE='+00:00' */;
15/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
16/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
17/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
18/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19
20--
21-- Table structure for table `Firms`
22--
23
24DROP TABLE IF EXISTS `Firms`;
25/*!40101 SET @saved_cs_client = @@character_set_client */;
26/*!40101 SET character_set_client = utf8 */;
27CREATE TABLE `Firms` (
28 `ID` int(11) NOT NULL AUTO_INCREMENT,
29 `Name` varchar(45) DEFAULT NULL,
30 PRIMARY KEY (`ID`)
31) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
32/*!40101 SET character_set_client = @saved_cs_client */;
33
34--
35-- Dumping data for table `Firms`
36--
37
38LOCK TABLES `Firms` WRITE;
39/*!40000 ALTER TABLE `Firms` DISABLE KEYS */;
40INSERT INTO `Firms` VALUES (1,'Sony'),(2,'Panasonic'),(3,'Samsung');
41/*!40000 ALTER TABLE `Firms` ENABLE KEYS */;
42UNLOCK TABLES;
43
44--
45-- Table structure for table `Phones`
46--
47
48DROP TABLE IF EXISTS `Phones`;
49/*!40101 SET @saved_cs_client = @@character_set_client */;
50/*!40101 SET character_set_client = utf8 */;
51CREATE TABLE `Phones` (
52 `phone_id` int(11) NOT NULL AUTO_INCREMENT,
53 `FirmID` int(11) DEFAULT NULL,
54 `Phone` varchar(45) DEFAULT NULL,
55 PRIMARY KEY (`phone_id`),
56 KEY `fk_Firm_idx` (`FirmID`),
57 CONSTRAINT `fk_Firm` FOREIGN KEY (`FirmID`) REFERENCES `Firms` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
58) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
59/*!40101 SET character_set_client = @saved_cs_client */;
60
61--
62-- Dumping data for table `Phones`
63--
64
65LOCK TABLES `Phones` WRITE;
66/*!40000 ALTER TABLE `Phones` DISABLE KEYS */;
67INSERT INTO `Phones` VALUES (1,1,'332-55-56'),(2,1,'332-50-01'),(3,2,'256-39-12');
68/*!40000 ALTER TABLE `Phones` ENABLE KEYS */;
69UNLOCK TABLES;
70
71--
72-- Table structure for table `company`
73--
74
75DROP TABLE IF EXISTS `company`;
76/*!40101 SET @saved_cs_client = @@character_set_client */;
77/*!40101 SET character_set_client = utf8 */;
78CREATE TABLE `company` (
79 `compid` int(11) NOT NULL,
80 `name` varchar(100) NOT NULL,
81 PRIMARY KEY (`compid`)
82) ENGINE=InnoDB DEFAULT CHARSET=utf8;
83/*!40101 SET character_set_client = @saved_cs_client */;
84
85--
86-- Dumping data for table `company`
87--
88
89LOCK TABLES `company` WRITE;
90/*!40000 ALTER TABLE `company` DISABLE KEYS */;
91INSERT INTO `company` VALUES (1,'Intel'),(2,'IBM'),(3,'Compaq');
92/*!40000 ALTER TABLE `company` ENABLE KEYS */;
93UNLOCK TABLES;
94
95--
96-- Table structure for table `goods`
97--
98
99DROP TABLE IF EXISTS `goods`;
100/*!40101 SET @saved_cs_client = @@character_set_client */;
101/*!40101 SET character_set_client = utf8 */;
102CREATE TABLE `goods` (
103 `goodid` int(11) NOT NULL,
104 `name` varchar(100) NOT NULL,
105 PRIMARY KEY (`goodid`)
106) ENGINE=InnoDB DEFAULT CHARSET=utf8;
107/*!40101 SET character_set_client = @saved_cs_client */;
108
109--
110-- Dumping data for table `goods`
111--
112
113LOCK TABLES `goods` WRITE;
114/*!40000 ALTER TABLE `goods` DISABLE KEYS */;
115INSERT INTO `goods` VALUES (1,'Pentium IV'),(2,'Celeron'),(3,'AMD');
116/*!40000 ALTER TABLE `goods` ENABLE KEYS */;
117UNLOCK TABLES;
118
119--
120-- Table structure for table `shipment`
121--
122
123DROP TABLE IF EXISTS `shipment`;
124/*!40101 SET @saved_cs_client = @@character_set_client */;
125/*!40101 SET character_set_client = utf8 */;
126CREATE TABLE `shipment` (
127 `shipid` int(11) NOT NULL AUTO_INCREMENT,
128 `compid` int(11) NOT NULL,
129 `goodid` int(11) NOT NULL,
130 `quantity` float NOT NULL,
131 `shipdate` date NOT NULL,
132 PRIMARY KEY (`shipid`)
133) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
134/*!40101 SET character_set_client = @saved_cs_client */;
135
136--
137-- Dumping data for table `shipment`
138--
139
140LOCK TABLES `shipment` WRITE;
141/*!40000 ALTER TABLE `shipment` DISABLE KEYS */;
142INSERT INTO `shipment` VALUES (1,1,1,100,'2010-11-04'),(2,1,1,200,'2010-11-12'),(3,1,2,300,'2010-12-02'),(4,1,2,400,'2010-12-09'),(5,2,1,100,'2010-10-29'),(6,2,1,200,'2010-11-06'),(7,2,2,300,'2010-11-29'),(8,2,2,700,'2010-12-03');
143/*!40000 ALTER TABLE `shipment` ENABLE KEYS */;
144UNLOCK TABLES;
145/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
146
147/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
148/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
149/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
150/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
151/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
152/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
153/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
154
155-- Dump completed on 2018-02-25 0:07:32