-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject_Database
More file actions
85 lines (65 loc) · 2.06 KB
/
Project_Database
File metadata and controls
85 lines (65 loc) · 2.06 KB
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
CREATE TABLE `cart` (
`custid` int(11) DEFAULT NULL,
`productcode` int(11) DEFAULT NULL,
`qty` int(11) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`amt` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `customers` (
`custid` int(11) NOT NULL,
`name` varchar(30) DEFAULT NULL,
`area` varchar(30) DEFAULT NULL,
`city` varchar(30) DEFAULT NULL,
`pincode` varchar(20) DEFAULT NULL,
`emailid` varchar(50) DEFAULT NULL,
`password` varchar(10) DEFAULT NULL,
`mobile` varchar(12) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `orderdetails` (
`orderno` int(11) DEFAULT NULL,
`productcode` int(11) DEFAULT NULL,
`qty` int(11) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`amount` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `orders` (
`orderno` int(11) NOT NULL,
`orderdate` date DEFAULT NULL,
`custid` int(11) DEFAULT NULL,
`totalamount` int(11) DEFAULT NULL,
`tax` float DEFAULT NULL,
`netamount` float DEFAULT NULL,
`status` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `products` (
`productcode` int(11) NOT NULL,
`productname` varchar(20) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`stock` int(11) DEFAULT NULL,
`img` varchar(50) DEFAULT NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `users` (
`loginid` varchar(10) NOT NULL,
`password` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `users` (`loginid`, `password`) VALUES
('abc', 'aaa');
ALTER TABLE `customers`
ADD PRIMARY KEY (`custid`),
ADD UNIQUE KEY `emailid` (`emailid`);
ALTER TABLE `orders`
ADD PRIMARY KEY (`orderno`);
ALTER TABLE `products`
ADD PRIMARY KEY (`productcode`);
ALTER TABLE `users`
ADD PRIMARY KEY (`loginid`);
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
MODIFY `custid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `orderno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
COMMIT;