-
Notifications
You must be signed in to change notification settings - Fork 3
/
MySQL_table_creation_query.txt
60 lines (39 loc) · 1.44 KB
/
MySQL_table_creation_query.txt
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
create table admin(
username varchar(30) primary key,
password int
);
insert into admin VALUES('admin',1234);
create table employee(
username varchar(30) primary key,
name varchar(30) ,
password varchar(10),
DOB date ,
deptId int,
accountActive boolean,
foreign key (deptId) references department(deptId)
);
insert into employee value('deba@gmail.com','deba','1112','2000-05-16',NULL);
select * from employee;
INSERT INTO employee (username,name,password,DOB) VALUES('ram@gmail.com','deba','1234','2000-07-26');
create table department(
deptId int primary key auto_increment,
deptName varchar(30) unique not null,
assignProject varchar(35) ,
deptManager varchar(30) unique
);
ALTER TABLE department ADD FOREIGN KEY (deptManager) REFERENCES employee(username);
create table applyLeave(
id int primary key AUTO_INCREMENT,
username varchar(30) not null,
leaveFrom date not null,
leaveTo date not null,
approved boolean,
reason varchar(100) not null,
foreign key(username) references employee(username) );
create table updateStatus(
id int primary key auto_increment,
username varchar(30),
status varchar(150) ,
workingdDept int,
foreign key(workingdDept) references employee(deptId)
);