Python and MySQL – Creating our Database and Table, Insert values into Table



Python and MySQL – Creating our Database and Table, Insert values into Table

Python and MySQL - Creating our Database and Table, Insert values into Table

Python Database Connection | How to Connect Python with MySQL Database
#mysql #mysql_workbench #mysqlserver #parnikatutorials #windows11 #windows10 #sqlserver #python2023 #pythoncourse #pythontutorial #pythondatabaseconnectivity #pythonfullcourseintelugu

The CREATE DATABASE statement is used to create a new SQL database.

create database databasename;

example:
create database parnika;

The above statement is useful to create a database called parnika in mysql.

The CREATE TABLE statement is used to create a new table in a database.

CREATE TABLE table_name ( column1 datatype, column2 datatype,
column3 datatype, …. );

The column parameters specify the names of the columns of the table.

The datatype parameter specifies the type of data the column can hold (e.g. varchar, integer, date, etc.).

The following example creates a table called “students” that contains three columns: Rollno, Name, and Branch.

create table students(rollno int, name varchar(20), branch varchar(10));

Steps involved in database connectivity:
1. import mysql.connector
2. Use the connect() method of the MySQL Connector class with the required arguments to connect MySQL. It would return a MySQLConnection object if the connection established successfully.
3. Use the cursor() method of a MySQLConnection object to create a cursor object to perform various SQL operations.
4. Use the execute() methods to run the SQL query and return the result.

Social media Links:
Instagram: https://www.instagram.com/parnikatutorials/
Website: http://parnikatutorials.in/
Email id: [email protected]
To get the regular updates:
Telegram link: https://t.me/Parnikatutorials
Facebook: https://m.facebook.com/profile.php?id=109245950811428&ref=content_filter
Linkedin: https://www.linkedin.com/in/parnika-tutorials-a8a9831b2/
Pinterest: https://in.pinterest.com/parnikatutorials0892/
Playlists:
Virtual Coffee with Jagadeesh:
https://youtube.com/playlist?list=PL4x0v29DZ2pArePUk30o6Twn7sqnqbYCH
Digital Logic Design:
https://youtube.com/playlist?list=PL4x0v29DZ2pA2ZmL3dclnA-HfHkFAy0GI
Computer Organization and Architecture:
https://www.youtube.com/watch?v=iJN9q01OWtw&list=PL4x0v29DZ2pBRd8bChJJFtTn6ClJhKzfZ
C Programming:
https://www.youtube.com/watch?v=h9LtX_R-7uA&list=PL4x0v29DZ2pAIQdtRr-1zaYnqGiD_fU0M
Data Structures:
https://www.youtube.com/watch?v=m51BGPXdPAQ&list=PL4x0v29DZ2pCtKml6NNoBhYK4K_QnsCA_

Theory of Computation:
https://www.youtube.com/watch?v=iJN9q01OWtw&list=PL4x0v29DZ2pDq-5SI9KlYxPDKdYCcmgJm

Compiler Design:
https://www.youtube.com/watch?v=iJN9q01OWtw&list=PL4x0v29DZ2pBsF-lPUHQ_8uRy-LbDSHIH
Operating Systems: https://www.youtube.com/watch?v=vCCmq8hTC8Y&list=PL4x0v29DZ2pD6MzSQMIDSawLSKUZTFfxE

Databases: https://www.youtube.com/watch?v=iJN9q01OWtw&list=PL4x0v29DZ2pCYEa9s3r5zWrFYIxGivlEC

Computer Networks:
https://www.youtube.com/watch?v=iJN9q01OWtw&list=PL4x0v29DZ2pBBOq-QsHtCuA53IlRxIQNm
For GATE PYQs and much more explore:
https://www.youtube.com/c/ParnikaTutorials/playlists