-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLFILE_
163 lines (145 loc) · 6.72 KB
/
SQLFILE_
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
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| db |
| information_schema |
| mnrega |
| mysql |
| performance_schema |
| que1db |
| que3 |
| sb101_c4 |
| sumedhdb |
| sys |
+--------------------+
10 rows in set (0.01 sec)
mysql> use mnrega;
Database changed
mysql> create table BackendDev (
-> username varchar(20),
-> password varchar(20)
-> );
Query OK, 0 rows affected (0.06 sec)
mysql> create table Projects (
-> ProjectNo int primary key auto_increment ,
-> PName varchar(20) ,
-> Location varchar(20)
-> );
Query OK, 0 rows affected (0.02 sec)
mysql> create table GramPanchayatMember (
-> ID int primary key auto_increment ,
-> GName varchar(20) not null ,
-> Location varchar(20) not null ,
-> username varchar(20) not null unique ,
-> password varchar(20) not null
-> );
Query OK, 0 rows affected (0.03 sec)
mysql> create table p_g (
-> pid int not null ,
-> gid int not null,
-> foreign key (pid) references Projects(ProjectNO) ,
-> foreign key (gid) references GramPanchayatMember(ID)
-> );
Query OK, 0 rows affected (0.04 sec)
mysql> create table employee (
-> EmpId int primary key auto_increment ,
-> EmpName varchar(20) not null,
-> EmpGender varchar(1) not null,
-> EmpWage int not null,
-> EmpDutyDay int not null,
-> ProjAssigned int references Projects(ProjectNo),
-> GPOAssigned int references GramPanchayatMember(ID)
-> );
Query OK, 0 rows affected (0.02 sec)
mysql> insert into BackendDev values('sumedh' , 'sumedh');
Query OK, 1 row affected (0.01 sec)
mysql> select * from employee;
+-------+---------+-----------+---------+------------+--------------+-------------+
| EmpId | EmpName | EmpGender | EmpWage | EmpDutyDay | ProjAssigned | GPOAssigned |
+-------+---------+-----------+---------+------------+--------------+-------------+
| 1 | yogesh | M | 350 | 9 | 0 | 0 |
+-------+---------+-----------+---------+------------+--------------+-------------+
1 row in set (0.01 sec)
mysql> select * from projects;
+-----------+----------+----------+
| ProjectNo | PName | Location |
+-----------+----------+----------+
| 1 | cleaning | Sasti |
| 2 | TREE | Akola |
| 3 | Plant | Wardha |
| 4 | river | amravti |
+-----------+----------+----------+
4 rows in set (0.00 sec)
mysql> select * from employee;
+-------+---------+-----------+---------+------------+--------------+-------------+
| EmpId | EmpName | EmpGender | EmpWage | EmpDutyDay | ProjAssigned | GPOAssigned |
+-------+---------+-----------+---------+------------+--------------+-------------+
| 1 | yogesh | M | 350 | 9 | 2 | 1 |
+-------+---------+-----------+---------+------------+--------------+-------------+
1 row in set (0.00 sec)
mysql> select * from grampanchayatmember;
+----+--------+----------+----------+----------+
| ID | GName | Location | username | password |
+----+--------+----------+----------+----------+
| 1 | sagar | Sasti | sagar | sagar |
| 2 | pawan | satara | pawan | pawan |
| 3 | Nagesh | pune | nagesh | nagesh |
+----+--------+----------+----------+----------+
3 rows in set (0.00 sec)
mysql> select * from employee;
+-------+---------+-----------+---------+------------+--------------+-------------+
| EmpId | EmpName | EmpGender | EmpWage | EmpDutyDay | ProjAssigned | GPOAssigned |
+-------+---------+-----------+---------+------------+--------------+-------------+
| 1 | yogesh | M | 350 | 9 | 2 | 1 |
| 2 | karan | M | 380 | 7 | 0 | 0 |
+-------+---------+-----------+---------+------------+--------------+-------------+
2 rows in set (0.00 sec)
mysql> select * from employee;
+-------+---------+-----------+---------+------------+--------------+-------------+
| EmpId | EmpName | EmpGender | EmpWage | EmpDutyDay | ProjAssigned | GPOAssigned |
+-------+---------+-----------+---------+------------+--------------+-------------+
| 1 | yogesh | M | 350 | 9 | 2 | 1 |
| 2 | karan | M | 380 | 7 | 4 | 1 |
+-------+---------+-----------+---------+------------+--------------+-------------+
2 rows in set (0.00 sec)
mysql> select * from projects;
+-----------+----------+----------+
| ProjectNo | PName | Location |
+-----------+----------+----------+
| 1 | cleaning | Sasti |
| 2 | TREE | Akola |
| 3 | Plant | Wardha |
| 4 | river | amravti |
| 5 | power | khamgoan |
| 6 | godavari | patna |
| 7 | Farming | Wadegoan |
+-----------+----------+----------+
7 rows in set (0.01 sec)
mysql> select * from employee;
+-------+---------+-----------+---------+------------+--------------+-------------+
| EmpId | EmpName | EmpGender | EmpWage | EmpDutyDay | ProjAssigned | GPOAssigned |
+-------+---------+-----------+---------+------------+--------------+-------------+
| 1 | yogesh | M | 350 | 9 | 2 | 1 |
| 2 | karan | M | 380 | 7 | 4 | 1 |
+-------+---------+-----------+---------+------------+--------------+-------------+
2 rows in set (0.00 sec)
mysql> select * from employee;
+-------+---------+-----------+---------+------------+--------------+-------------+
| EmpId | EmpName | EmpGender | EmpWage | EmpDutyDay | ProjAssigned | GPOAssigned |
+-------+---------+-----------+---------+------------+--------------+-------------+
| 1 | yogesh | M | 350 | 9 | 2 | 1 |
| 2 | karan | M | 380 | 7 | 4 | 1 |
| 3 | Banti | m | 450 | 12 | 0 | 0 |
+-------+---------+-----------+---------+------------+--------------+-------------+
3 rows in set (0.00 sec)
mysql> select * from employee;
+-------+---------+-----------+---------+------------+--------------+-------------+
| EmpId | EmpName | EmpGender | EmpWage | EmpDutyDay | ProjAssigned | GPOAssigned |
+-------+---------+-----------+---------+------------+--------------+-------------+
| 1 | yogesh | M | 350 | 9 | 2 | 1 |
| 2 | karan | M | 380 | 7 | 4 | 1 |
| 3 | Banti | m | 450 | 12 | 7 | 1 |
+-------+---------+-----------+---------+------------+--------------+-------------+
3 rows in set (0.00 sec)
mysql>