-
Notifications
You must be signed in to change notification settings - Fork 0
/
Database Tables.txt
119 lines (99 loc) · 6.28 KB
/
Database Tables.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
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
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database previous_chalk_3282;
Query OK, 1 row affected (0.02 sec)
mysql> use previous_chalk_3282;
Database changed
mysql> create table vendor(vendorId int primary key auto_increment,vendorPassword varchar(20),vendorName varchar(30) unique not null,
-> vendorMob varchar(12),vendorEmail varchar(40),vendorCompany varchar(15),vendorAddress varchar(100));
Query OK, 0 rows affected (0.04 sec)
mysql> desc vendor;
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
| vendorId | int | NO | PRI | NULL | auto_increment |
| vendorPassword | varchar(20) | YES | | NULL | |
| vendorName | varchar(30) | YES | | NULL | |
| vendorMob | varchar(12) | YES | | NULL | |
| vendorEmail | varchar(40) | YES | | NULL | |
| vendorCompany | varchar(15) | YES | | NULL | |
| vendorAddress | varchar(100) | YES | | NULL | |
+----------------+--------------+------+-----+---------+----------------+
7 rows in set (0.04 sec)
mysql> create table tender(tendorId int primary key auto_increment,tendorName varchar(40),tendorType varchar(20),
tendorPrice int, tendorDesc varchar(300),tendorDeadline varchar(10),tendorLocation varchar(70),status varchar(10) default 'Not_Assigned');
Query OK, 0 rows affected (0.02 sec)
mysql> desc tender;
+----------------+--------------+------+-----+--------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+--------------+----------------+
| tendorId | int | NO | PRI | NULL | auto_increment |
| tendorName | varchar(40) | YES | | NULL | |
| tendorType | varchar(20) | YES | | NULL | |
| tendorPrice | int | YES | | NULL | |
| tendorDesc | varchar(300) | YES | | NULL | |
| tendorDeadline | varchar(10) | YES | | NULL | |
| tendorLocation | varchar(70) | YES | | NULL | |
| status | varchar(30) | YES | | Not_Assigned | |
+----------------+--------------+------+-----+--------------+----------------+
8 rows in set (0.00 sec)
mysql> create table bidder (bidderId int primary key auto_increment,vendorId int references vendor(vendorId),
-> tendorId int references tendor(tendorId),bidamount int,Bidderdeadline date,status varchar(20) default 'Pending');
Query OK, 0 rows affected (0.03 sec)
mysql> desc bidder;
+----------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+----------------+
| bidderId | int | NO | PRI | NULL | auto_increment |
| vendorId | int | YES | | NULL | |
| tendorId | int | YES | | NULL | |
| bidamount | int | YES | | NULL | |
| status | varchar(10) | YES | | NULL | |
| Bidderdeadline | varchar(10) | YES | | NULL | |
+----------------+-------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
mysql> create table tenderstatus(status varchar(15) not null default 'Not_selected',
tsTendorId int references tender(tendorId),
tsBidderId int references bidder(bidderId),
tsVendorId int references vendor(vendorId)
);
Query OK, 0 rows affected (0.03 sec)
mysql> desc tenderstatus;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| status | varchar(15) | NO | | NULL | |
| tsTendorId | int | YES | | NULL | |
| tsBidderId | int | YES | | NULL | |
| tsVendorId | int | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
mysql> create table administrator(adminId int primary key auto_increment,adminUserName varchar(12) not null unique ,adminEmail varchar(15) not null,adminPassword varchar(8) not null);
Query OK, 0 rows affected (0.06 sec)
mysql> desc administrator;
+---------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+----------------+
| adminId | int | NO | PRI | NULL | auto_increment |
| adminUserName | varchar(12) | NO | UNI | NULL | |
| adminEmail | varchar(15) | NO | | NULL | |
| adminPassword | varchar(8) | NO | | NULL | |
+---------------+-------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
mysql> insert into administrator(adminUserName,adminEmail,adminPassword) values('Rakshika','rk@gmail.com','rakshu12');
Query OK, 1 row affected (0.01 sec)
mysql> insert into administrator(adminUserName,adminEmail,adminPassword) values('Abhishek','ab@gmail.com','abhi123');
Query OK, 1 row affected (0.01 sec)
mysql> insert into administrator(adminUserName,adminEmail,adminPassword) values('Padmanabh','pd@gmail.com','padma');
Query OK, 1 row affected (0.00 sec)
mysql> select * from administrator;
+---------+---------------+--------------+---------------+
| adminId | adminUserName | adminEmail | adminPassword |
+---------+---------------+--------------+---------------+
| 1 | Rakshika | rk@gmail.com | rakshu12 |
| 2 | Abhishek | ab@gmail.com | abhi123 |
| 3 | Padmanabh | pd@gmail.com | padma |
+---------+---------------+--------------+---------------+
3 rows in set (0.00 sec)