how to make database connection in python | Lec-27

In this video, I have talked about the fundamentals of programming and Python. If you complete this, you will be well-versed in using tuples for different use cases.
Directly connect with me at:- topmate.io/manish_kumar25
CREATE TABLE labours_table (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
role VARCHAR(255) NOT NULL,
wages INT NOT NULL
);
-- Insert labours
INSERT INTO labours_table (name, role, wages) VALUES
('Mahesh', 'labour', 500),
('Ramesh', 'labour', 400),
('Mithilesh', 'labour', 400),
('Sumesh', 'labour', 300);
-- Insert mistris
INSERT INTO labours_table (name, role, wages) VALUES
('Jagmohan', 'mistri', 1000),
('Rampyare', 'mistri', 800);
CREATE TABLE attendance (
id INT AUTO_INCREMENT PRIMARY KEY,
labours_id INT,
start_time TIME,
end_time TIME,
date DATE,
FOREIGN KEY (labours_id) REFERENCES labours_table(id)
);
INSERT INTO attendance (labours_id, start_time, end_time, date) VALUES
(1, '08:00:00', '17:00:00', '2024-05-14'),
(2, '08:30:00', '17:30:00', '2024-05-14'),
(3, '09:00:00', '18:00:00', '2024-05-14'),
(4, '09:00:00', '18:00:00', '2024-05-14'),
(5, '07:00:00', '16:00:00', '2024-05-14'),
(6, '07:30:00', '16:30:00', '2024-05-14');
insert_query = "INSERT INTO labours_table (name, role, wages) VALUES (%s, %s, %s)"
cursor.execute(insert_query, ('New Labour', 'labour', 600))
Finally close all the connection
connection.commit()
cursor.close()
connection.close()
Discord channel:- / discord
For more queries reach out to me on my below social media handle.
Follow me on LinkedIn:- / manish-kumar-373b86176
Follow Me On Instagram:- / competitive_gyan1
Follow me on Facebook:- / manish12340
My Second Channel -- / @competitivegyan1
Interview series Playlist:- • Interview Questions an...
My Gear:-
Rode Mic:-- amzn.to/3RekC7a
Boya M1 Mic-- amzn.to/3uW0nnn
Wireless Mic:-- amzn.to/3TqLRhE
Tripod1 -- amzn.to/4avjyF4
Tripod2:-- amzn.to/46Y3QPu
camera1:-- amzn.to/3GIQlsE
camera2:-- amzn.to/46X190P
Pentab (Medium size):-- amzn.to/3RgMszQ (Recommended)
Pentab (Small size):-- amzn.to/3RpmIS0
Mobile:-- amzn.to/47Y8oa4 ( Aapko ye bilkul nahi lena hai)
Laptop -- amzn.to/3Ns5Okj
Mouse+keyboard combo -- amzn.to/3Ro6GYl
21-inch Monitor-- amzn.to/3TvCE7E
27-inch Monitor-- amzn.to/47QzXlA
iPad Pencil:-- amzn.to/4aiJxiG
iPad 9th Generation:-- amzn.to/470I11X
Boom Arm/Swing Arm:-- amzn.to/48eH2we
My PC Components:-
intel i7 Processor:-- amzn.to/47Svdfe
G.Skill RAM:-- amzn.to/47VFffI
Samsung SSD:-- amzn.to/3uVSE8W
WD Blue HDD:-- amzn.to/47Y91QY
RTX 3060Ti Graphic card:- amzn.to/3tdLDjn
Gigabyte Motherboard:-- amzn.to/3RFUTGl
O11 Dynamic Cabinet:-- amzn.to/4avkgSK
Liquid cooler:-- amzn.to/472S8mS
Antec Prizm FAN:-- amzn.to/48ey4Pj

Пікірлер: 3

  • @SharadSonwane-xk1ht
    @SharadSonwane-xk1htАй бұрын

    👍

  • @Aman-lv2ee
    @Aman-lv2ee28 күн бұрын

    great video, how many more left in Python series ?

  • @manish_kumar_1

    @manish_kumar_1

    27 күн бұрын

    Not sure yet