-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecommerce.sql
90 lines (71 loc) · 1.9 KB
/
ecommerce.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
--
-- Database: `ecommerce`
--
-- --------------------------------------------------------
--
-- Table structure for table `adminlogin`
--
CREATE TABLE `adminlogin` (
`id` int(11) NOT NULL,
`username` char(50) DEFAULT NULL,
`password` char(50) DEFAULT NULL
) ;
--
-- Dumping data for table `adminlogin`
--
INSERT INTO `adminlogin` (`id`, `username`, `password`) VALUES
(1, 'deepa', 'Deepa@123');
-- --------------------------------------------------------
--
-- Table structure for table `login`
--
CREATE TABLE `login` (
`id` int(11) NOT NULL,
`userid` char(50) NOT NULL,
`password` char(50) NOT NULL
) ;
--
-- Dumping data for table `login`
--
INSERT INTO `login` (`id`, `userid`, `password`) VALUES
(6, 'Archies_01', 'Qwerty@123');
-- --------------------------------------------------------
--
-- Table structure for table `signup`
--
CREATE TABLE `signup` (
`fullnmae` varchar(50) NOT NULL,
`userid` varchar(50) NOT NULL,
`age` int(11) NOT NULL,
`gender` varchar(20) NOT NULL,
`location` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(50) NOT NULL,
`id` int(11) NOT NULL
) ;
--
-- Dumping data for table `signup`
--
INSERT INTO `signup` (`fullnmae`, `userid`, `age`, `gender`, `location`, `email`, `password`, `id`) VALUES
('Archie Andrews', 'Archies_01', 22, 'Male', 'Riverdale', '[email protected]', 'Qwerty@123', 6);
--
-- Triggers `signup`
--
DELIMITER $$
CREATE TRIGGER `after_signin_insert` AFTER INSERT ON `signup` FOR EACH ROW BEGIN
INSERT INTO login(id,userid,password) values(NEW.id,NEW.userid,New.password);
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `after_signup_del` AFTER DELETE ON `signup` FOR EACH ROW BEGIN
DELETE FROM login WHERE id=OLD.id;
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `after_signup_update` AFTER UPDATE ON `signup` FOR EACH ROW BEGIN
UPDATE login SET userid=NEW.userid, password=NEW.password WHERE id=OLD.id;
END
$$
DELIMITER ;