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

preview_player
Показать описание
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:
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:
To get the regular updates:
Playlists:
Virtual Coffee with Jagadeesh:
Digital Logic Design:
Computer Organization and Architecture:
C Programming:
Data Structures:

Theory of Computation:

Compiler Design:

Computer Networks:
For GATE PYQs and much more explore:
Рекомендации по теме
welcome to shbcf.ru