-
Notifications
You must be signed in to change notification settings - Fork 0
/
mySQL Table.txt
84 lines (61 loc) · 2.99 KB
/
mySQL Table.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
create table gramPanchayat(
GPID int Primary Key auto_increment,
gName varchar(20) not null,
gAddress varchar(20) not null,
gphone varchar(20) not null unique,
gpassword varchar(20) not null
);
create table project(
pid int Primary Key auto_increment,
pgpid int,
pName varchar(20) not null,
pcost int,
pduration int not null,
foreign key (pgpid) references gramPanchayat(GPID)
);
create table employee(
eid int Primary Key auto_increment,
egpid int,
epid int,
ename varchar(20) not null,
eaddress varchar(20) not null,
edate_joined date not null,
ewage int not null,
foreign key (epid) references project(pid),
foreign key (egpid) references gramPanchayat(GPID)
);
> desc grampanchayat;
+-----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+----------------+
| GPID | int | NO | PRI | NULL | auto_increment |
| gName | varchar(20) | NO | | NULL | |
| gAddress | varchar(20) | NO | | NULL | |
| gphone | varchar(20) | NO | UNI | NULL | |
| gpassword | varchar(20) | NO | | NULL | |
+-----------+-------------+------+-----+---------+----------------+
> desc project;
+-----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+----------------+
| pid | int | NO | PRI | NULL | auto_increment |
| pgpid | int | YES | MUL | NULL | |
| pName | varchar(20) | NO | | NULL | |
| pcost | int | YES | | NULL | |
| pduration | int | NO | | NULL | |
+-----------+-------------+------+-----+---------+----------------+
> desc employee;
+--------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+----------------+
| eid | int | NO | PRI | NULL | auto_increment |
| egpid | int | YES | MUL | NULL | |
| epid | int | YES | MUL | NULL | |
| ename | varchar(20) | NO | | NULL | |
| eaddress | varchar(20) | NO | | NULL | |
| edate_joined | date | NO | | NULL | |
| ewage | int | NO | | NULL | |
+--------------+-------------+------+-----+---------+----------------+
insert into employee(egpid,epid,ename,eaddress,edate_joined,ewage) values(1,1,'Ritesh', 'Ranchi', curdate(),500);
insert into project (pgpid,pname,pcost,pduration) values(1,'Irrigation',100000, 90);
insert into grampanchayat (gname,gaddress,gphone,gpassword) values('Piyush', 'Godda', '9973061351', 'Piyush@123');