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

Pubblicato il: 05 febbraio 2023
sul canale di: Parnika Tutorials
1,282
11

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:   / parnikatutorials  
Website:
Email id: parnikatutorials@gmail.com
To get the regular updates:
Telegram link: https://t.me/Parnikatutorials
Facebook: https://m.facebook.com/profile.php?id...
Linkedin:   / parnika-tutorials-a8a9831b2  
Pinterest:   / parnikatutorials0892  
Playlists:
Virtual Coffee with Jagadeesh:
   • VIRTUAL COFFEE WITH JAGADEESH  
Digital Logic Design:
   • Digital Logic Design  
Computer Organization and Architecture:
   • ABOUT PARNIKA TUTORIALS  
C Programming:
   • L 1: WHAT IS AN ALGORITHM AND CHARACTERIST...  
Data Structures:
   • L 1: Uncover the Benefits of Linked List: ...  

Theory of Computation:
   • ABOUT PARNIKA TUTORIALS  

Compiler Design:
   • ABOUT PARNIKA TUTORIALS  
Operating Systems:    • PROCESS STATE DIAGRAM | LONG TERM, SHORT T...  

Databases:    • ABOUT PARNIKA TUTORIALS  

Computer Networks:
   • ABOUT PARNIKA TUTORIALS  
For GATE PYQs and much more explore:
   / parnikatutorials  


In questa pagina del sito puoi guardare il video online Python and MySQL - Creating our Database and Table, Insert values into Table della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Parnika Tutorials 05 febbraio 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,282 volte e gli è piaciuto 11 spettatori. Buona visione!