-
Notifications
You must be signed in to change notification settings - Fork 0
/
office_db.sql
208 lines (168 loc) · 5.37 KB
/
office_db.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 29, 2022 at 09:06 AM
-- Server version: 10.4.21-MariaDB
-- PHP Version: 8.0.10
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: `office_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `contract_table`
--
CREATE TABLE `contract_table` (
`cont_id` int(11) NOT NULL,
`cont_name` varchar(100) NOT NULL,
`cont_date_handeover` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `contract_table`
--
INSERT INTO `contract_table` (`cont_id`, `cont_name`, `cont_date_handeover`) VALUES
(2, 'test contract2', 2343242),
(3, 'test contract2', 2343242),
(4, 'test contract2', 2343242),
(5, 'test contract2', 2343242),
(6, 'test contract2', 2343242),
(7, 'test contract2', 2343242),
(8, 'test contract2', 2343242),
(9, 'test contract2', 2343242),
(10, 'test contract2', 2343242);
-- --------------------------------------------------------
--
-- Table structure for table `department_table`
--
CREATE TABLE `department_table` (
`dept_id` int(11) NOT NULL,
`dept_name` varchar(45) NOT NULL,
`dept_address` varchar(45) DEFAULT NULL,
`dept_sector_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `employee_table`
--
CREATE TABLE `employee_table` (
`emp_id` int(11) NOT NULL,
`emp_first_name` varchar(45) NOT NULL,
`emp_last_name` varchar(45) NOT NULL,
`emp_email` varchar(100) NOT NULL,
`emp_password` varchar(45) NOT NULL,
`emp_address` varchar(100) DEFAULT NULL,
`emp_birthday` int(11) DEFAULT NULL,
`emp_designation` varchar(45) NOT NULL,
`emp_dep_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `file_table`
--
CREATE TABLE `file_table` (
`file_id` int(11) NOT NULL,
`file_name` varchar(100) NOT NULL,
`file_title` varchar(100) DEFAULT NULL,
`file_sender` varchar(100) DEFAULT NULL,
`file_created_date` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `project_table`
--
CREATE TABLE `project_table` (
`pro_id` int(11) NOT NULL,
`pro_name` varchar(100) NOT NULL,
`pro_supervisor_name` varchar(45) DEFAULT NULL,
`pro_date_added` int(11) DEFAULT NULL,
`pro_emp_id` int(11) DEFAULT NULL,
`pro_cont_id` int(11) NOT NULL,
`pro_suggestor_name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `project_table`
--
INSERT INTO `project_table` (`pro_id`, `pro_name`, `pro_supervisor_name`, `pro_date_added`, `pro_emp_id`, `pro_cont_id`, `pro_suggestor_name`) VALUES
(2, 'Test Project', 'Test Supervisor', 6454132, 1, 2, 'Suggestor NAme'),
(3, 'Test Project Updated', 'Test Supervisor', 6454132, 1, 2, 'Suggestor NAme'),
(4, 'Test Project Updated', 'Test Supervisor', 6454132, 1, 2, 'Suggestor NAme');
-- --------------------------------------------------------
--
-- Table structure for table `sector_table`
--
CREATE TABLE `sector_table` (
`sector_id` int(11) NOT NULL,
`sector_name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `sector_table`
--
INSERT INTO `sector_table` (`sector_id`, `sector_name`) VALUES
(2, 'sector two updated'),
(3, 'sector three');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `contract_table`
--
ALTER TABLE `contract_table`
ADD PRIMARY KEY (`cont_id`);
--
-- Indexes for table `department_table`
--
ALTER TABLE `department_table`
ADD PRIMARY KEY (`dept_id`),
ADD KEY `dept_sector_fk` (`dept_sector_id`);
--
-- Indexes for table `employee_table`
--
ALTER TABLE `employee_table`
ADD PRIMARY KEY (`emp_id`),
ADD KEY `emp_dept_fk` (`emp_dep_id`);
--
-- Indexes for table `file_table`
--
ALTER TABLE `file_table`
ADD PRIMARY KEY (`file_id`);
--
-- Indexes for table `project_table`
--
ALTER TABLE `project_table`
ADD PRIMARY KEY (`pro_id`),
ADD KEY `pro_cont_fk` (`pro_cont_id`);
--
-- Indexes for table `sector_table`
--
ALTER TABLE `sector_table`
ADD PRIMARY KEY (`sector_id`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `department_table`
--
ALTER TABLE `department_table`
ADD CONSTRAINT `dept_sector_fk` FOREIGN KEY (`dept_sector_id`) REFERENCES `sector_table` (`sector_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `employee_table`
--
ALTER TABLE `employee_table`
ADD CONSTRAINT `emp_dept_fk` FOREIGN KEY (`emp_dep_id`) REFERENCES `department_table` (`dept_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `project_table`
--
ALTER TABLE `project_table`
ADD CONSTRAINT `pro_cont_fk` FOREIGN KEY (`pro_cont_id`) REFERENCES `contract_table` (`cont_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;