0% found this document useful (0 votes)
19 views

Create Table Tblnotes (

Uploaded by

Rajni Shelke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Create Table Tblnotes (

Uploaded by

Rajni Shelke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

CREATE TABLE tblnotes (

ID serial PRIMARY KEY,


UserID integer,
Subject varchar(250),
NotesTitle varchar(250),
NotesDescription text,
File1 varchar(250),
File2 varchar(250),
File3 varchar(255),
File4 varchar(250),
CreationDate timestamp DEFAULT current_timestamp,
UpdationDate timestamp DEFAULT NULL
);

CREATE TABLE tbluser (


ID serial PRIMARY KEY,
FullName varchar(250),
MobileNumber bigint,
Email varchar(250),
Password varchar(250),
RegDate timestamp DEFAULT current_timestamp
);

INSERT INTO tbluser (FullName, MobileNumber, Email, Password, RegDate)


VALUES
('Abir Singh', 9798789789, '[email protected]', '202cb962ac59075b964b07152d234b70',
'2022-06-06 13:36:36'),
('Anuj Kumar', 1425362514, '[email protected]', 'f925916e2754e5e03f75dd58a5733251',
'2022-06-11 11:48:57'),
('Raghav', 7897979878, '[email protected]', '202cb962ac59075b964b07152d234b70',
'2023-12-14 05:26:12'),
('John Doe', 1122112211, '[email protected]', 'f925916e2754e5e03f75dd58a5733251',
'2023-12-15 17:46:20');

tblnotes

CREATE TABLE tblnotes (


ID serial PRIMARY KEY,
UserID integer,
Subject varchar(250),
NotesTitle varchar(250),
NotesDecription text,
File1 varchar(250),
File2 varchar(250),
File3 varchar(255),
File4 varchar(250),
CreationDate timestamp DEFAULT current_timestamp,
UpdationDate timestamp DEFAULT current_timestamp
);
CREATE OR REPLACE FUNCTION update_updationdate_column()
RETURNS TRIGGER AS $$
BEGIN
NEW."UpdationDate" = current_timestamp;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER update_updationdate_trigger


BEFORE UPDATE ON tblnotes
FOR EACH ROW
EXECUTE FUNCTION update_updationdate_column();

INSERT INTO tblnotes (ID, UserID, Subject, NotesTitle, NotesDecription, File1,


File2, File3, File4, CreationDate, UpdationDate) VALUES
(1, 3, 'Math', 'Maths Shortcuts', 'It contain math shortcuts.',
'd41d8cd98f00b204e9800998ecf8427e1702536045.pdf',
'd41d8cd98f00b204e9800998ecf8427e1702536260',
'd41d8cd98f00b204e9800998ecf8427e1702536700',
'd41d8cd98f00b204e9800998ecf8427e1702534796.pdf', '2023-12-14 06:19:56', '2023-12-
14 06:51:40'),
(2, 3, 'English', 'English Vocabulary', 'shgfgrhfgrw\r\nfdfhreiufyhw\r\
nfewyhiufywe', 'd41d8cd98f00b204e9800998ecf8427e1702539232.pdf',
'd41d8cd98f00b204e9800998ecf8427e1702539232.pdf',
'd41d8cd98f00b204e9800998ecf8427e1702539232.pdf', NULL, '2023-12-14 07:33:52',
NULL),
(3, 3, 'English', 'English Literature', 'shgfgrhfgrw\r\nfdfhreiufyhw\r\
nfewyhiufywe', 'd41d8cd98f00b204e9800998ecf8427e1702539232.pdf',
'd41d8cd98f00b204e9800998ecf8427e1702539232.pdf',
'd41d8cd98f00b204e9800998ecf8427e1702539232.pdf', NULL, '2023-12-14 07:33:52',
'2023-12-14 13:30:34'),
(4, 2, 'Math', 'Maths Shortcuts', 'It contain math shortcuts.',
'd41d8cd98f00b204e9800998ecf8427e1702536045.pdf',
'd41d8cd98f00b204e9800998ecf8427e1702536260',
'd41d8cd98f00b204e9800998ecf8427e1702536700',
'd41d8cd98f00b204e9800998ecf8427e1702534796.pdf', '2023-12-14 06:19:56', '2023-12-
14 13:18:41'),
(5, 1, 'Math', 'Maths Shortcuts', 'It contain math shortcuts.',
'd41d8cd98f00b204e9800998ecf8427e1702536045.pdf',
'd41d8cd98f00b204e9800998ecf8427e1702536260',
'd41d8cd98f00b204e9800998ecf8427e1702536700',
'd41d8cd98f00b204e9800998ecf8427e1702534796.pdf', '2023-12-14 06:19:56', '2023-12-
14 13:18:46');

CREATE TABLE tbluser (


ID serial PRIMARY KEY,
FullName varchar(250),
MobileNumber bigint,
Email varchar(250),
Password varchar(250),
RegDate timestamp DEFAULT current_timestamp
);

INSERT INTO tbluser (ID, FullName, MobileNumber, Email, Password, RegDate) VALUES
(1, 'Abir Singh', 9798789789, '[email protected]', '202cb962ac59075b964b07152d234b70',
'2022-06-06 13:36:36'),
(2, 'Anuj Kumar', 1425362514, '[email protected]', 'f925916e2754e5e03f75dd58a5733251',
'2022-06-11 11:48:57'),
(3, 'Raghav', 7897979878, '[email protected]', '202cb962ac59075b964b07152d234b70',
'2023-12-14 05:26:12'),
(4, 'John Doe', 1122112211, '[email protected]', 'f925916e2754e5e03f75dd58a5733251',
'2023-12-15 17:46:20');

You might also like