-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-database.sql
172 lines (147 loc) · 3.32 KB
/
example-database.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: db
-- Generation Time: Jun 30, 2020 at 03:04 PM
-- Server version: 5.7.29
-- PHP Version: 7.4.4
SET
SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET
time_zone = "+00:00";
/*!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 */
;
--
-- Database: `exampledatabase`
--
CREATE DATABASE IF NOT EXISTS `exampledatabase` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `exampledatabase`;
-- --------------------------------------------------------
--
-- Table structure for table `DEPT`
--
CREATE TABLE `DEPT` (
`DEPTNO` int(11) NOT NULL,
`DNAME` varchar(30) DEFAULT NULL,
`LOC` varchar(30) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
--
-- Dumping data for table `DEPT`
--
INSERT INTO
`DEPT` (`DEPTNO`, `DNAME`, `LOC`)
VALUES
(10, 'APPSERVER', 'NEW YORK');
-- --------------------------------------------------------
--
-- Table structure for table `DEPT2`
--
CREATE TABLE `DEPT2` (
`DEPTNO` int(11) DEFAULT NULL,
`DNAME` varchar(30) DEFAULT NULL,
`LOC` varchar(30) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
--
-- Dumping data for table `DEPT2`
--
INSERT INTO
`DEPT2` (`DEPTNO`, `DNAME`, `LOC`)
VALUES
(10, 'APPSERVER', 'NEW YORK'),
(20, 'RESEARCH', 'BOSTON');
-- --------------------------------------------------------
--
-- Table structure for table `EMP`
--
CREATE TABLE `EMP` (
`EMPNO` int(11) NOT NULL,
`ENAME` varchar(100) DEFAULT NULL,
`JOB` varchar(20) DEFAULT NULL,
`DEPTNO` int(11) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
--
-- Dumping data for table `EMP`
--
INSERT INTO
`EMP` (`EMPNO`, `ENAME`, `JOB`, `DEPTNO`)
VALUES
(7369, 'SMITH', 'CLERK', 10);
-- --------------------------------------------------------
--
-- Table structure for table `EMP2`
--
CREATE TABLE `EMP2` (
`EMPNO` int(11) DEFAULT NULL,
`ENAME` varchar(100) DEFAULT NULL,
`JOB` varchar(20) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
--
-- Dumping data for table `EMP2`
--
INSERT INTO
`EMP2` (`EMPNO`, `ENAME`, `JOB`)
VALUES
(7369, 'SMITH', 'CLERK'),
(7369, 'SMITH', 'NIGHTGUARD'),
(7400, 'JONES', 'ENGINEER');
-- --------------------------------------------------------
--
-- Table structure for table `EMP2DEPT`
--
CREATE TABLE `EMP2DEPT` (
`EMPNO` int(11) DEFAULT NULL,
`DEPTNO` int(11) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
--
-- Dumping data for table `EMP2DEPT`
--
INSERT INTO
`EMP2DEPT` (`EMPNO`, `DEPTNO`)
VALUES
(7369, 10),
(7369, 20),
(7400, 10);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `DEPT`
--
ALTER TABLE
`DEPT`
ADD
PRIMARY KEY (`DEPTNO`);
--
-- Indexes for table `EMP`
--
ALTER TABLE
`EMP`
ADD
PRIMARY KEY (`EMPNO`),
ADD
KEY `DEPTNO` (`DEPTNO`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `EMP`
--
ALTER TABLE
`EMP`
ADD
CONSTRAINT `emp_ibfk_1` FOREIGN KEY (`DEPTNO`) REFERENCES `DEPT` (`DEPTNO`);
COMMIT;
/*!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 */
;