-
Notifications
You must be signed in to change notification settings - Fork 2
/
invoice.sql
129 lines (102 loc) · 2.89 KB
/
invoice.sql
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
--
-- Database: `invoice`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin_login`
--
CREATE TABLE `admin_login` (
`adminid` int(11) NOT NULL,
`adminusername` varchar(20) NOT NULL,
`adminpassword` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin_login`
--
INSERT INTO `admin_login` (`adminid`, `adminusername`, `adminpassword`) VALUES
(1, 'danny', 'administra');
-- --------------------------------------------------------
--
-- Table structure for table `bill`
--
CREATE TABLE `bill` (
`invoiceid` int(11) NOT NULL,
`userid` int(11) NOT NULL,
`productid` int(11) NOT NULL,
`quantity` int(11) NOT NULL,
`price` int(11) NOT NULL,
`date` date NOT NULL,
`time` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `bill`
--
INSERT INTO `bill` (`invoiceid`, `userid`, `productid`, `quantity`, `price`, `date`, `time`) VALUES
(1001, 101, 1, 0, 600, '2019-10-20', '20:27:00'),
(1001, 101, 1, 0, 600, '2019-10-20', '20:27:00');
-- --------------------------------------------------------
--
-- Table structure for table `product`
--
CREATE TABLE `product` (
`productid` int(11) NOT NULL,
`productname` varchar(40) NOT NULL,
`productprice` int(11) NOT NULL,
`productquantity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `product`
--
INSERT INTO `product` (`productid`, `productname`, `productprice`, `productquantity`) VALUES
(1, 'mars', 5, 1000),
(2, 'snickers', 30, 2000),
(3, 'skittles', 50, 5000),
(4, 'cake', 150, 1000),
(5, 'chettos', 20, 10000);
-- --------------------------------------------------------
--
-- Table structure for table `user_detail`
--
CREATE TABLE `user_detail` (
`userid` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`phone` varchar(10) NOT NULL,
`address` varchar(50) NOT NULL,
`mailid` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_detail`
--
INSERT INTO `user_detail` (`userid`, `firstname`, `lastname`, `phone`, `address`, `mailid`, `password`) VALUES
(101, 'daniel', 'webber', '1234567890', 'Texas', '[email protected]', 'shopping');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `bill`
--
ALTER TABLE `bill`
ADD KEY `userid` (`userid`),
ADD KEY `productid` (`productid`);
--
-- Indexes for table `product`
--
ALTER TABLE `product`
ADD PRIMARY KEY (`productid`);
--
-- Indexes for table `user_detail`
--
ALTER TABLE `user_detail`
ADD PRIMARY KEY (`userid`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `bill`
--
ALTER TABLE `bill`
ADD CONSTRAINT `bill_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `user_detail` (`userid`),
ADD CONSTRAINT `bill_ibfk_2` FOREIGN KEY (`productid`) REFERENCES `product` (`productid`);
COMMIT;