Skip to content

Commit 2e6b9ec

Browse files
db changed
1 parent 916b00f commit 2e6b9ec

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

DELETE THE DATA.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mysql.connector as sqltor
22
con=sqltor.connect(host="localhost",user="root",passwd="",charset="utf8",database="pydb")
33
cur=con.cursor()
4-
cur.execute("DELETE FROM STUDENT WHERE ADMN_NO=1245")
4+
cur.execute("DELETE FROM STUDENT1 WHERE SID=1245")
55
con.commit()

INSERT THE DATA.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mysql.connector as sqltor
22
con=sqltor.connect(host="localhost",user="root",passwd="",charset="utf8",database="pydb")
33
cur=con.cursor()
4-
cur.execute("INSERT INTO STUDENT VALUES(%s, %s, %s, %s, %s, %s)", (1245, 'Arush', 'M', '2003-10-04', 'science', 67.34))
4+
cur.execute("INSERT INTO STUDENT1 VALUES(%s, %s, %s, %s, %s, %s)", (1245, 'Arush', 'M', '2003-10-04', 'science', 67.34))
55
con.commit()

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Interface-Python-With-MySQL
22
## This repository contains some codes of MySQL Connectivity with python.
33

4-
*In this Repository there are several Python snippets that connect the MySQL database with the Python scripts. When we design real-life applications , we are bound to encounter situations wherein we need to manipulate data stored in a database through an application designed by us . In order to connect to a database from within Python ,we need a library that provides connectivity functionality. There are many different libraries available for Python to accomplish this but in this repository I've used mysql connector library for the same.By connecting our Python script with the MySQL database we can execute many MySQL queries through our Python environment without launching the MySQL application for the same. It just creates a remote connection with the database by creating a connection object so that we can create , alter , manipulate with the records stored in a table and also we can access the databases and the tables stored in them and we can also extract the data to the result-set through which we can fetch the MySQL data to the output screen of the Python environment also.*
4+
- *This repository contains various Python snippets that connect the MySQL database to the Python scripts. When designing real-world applications, we are certain to come across instances in which we need to manipulate data contained in a database using an application that we built. To connect to a database from within Python, we need a library that provides connectivity capabilities.*
5+
- *There are other Python libraries available to accomplish this task, but in this repository, I utilized the mysql connector package.By linking our Python script to the MySQL database, we can run several MySQL queries without having to launch the MySQL program. It simply establishes a remote connection with the database by creating a connection object, allowing us to create, alter, and manipulate the records stored in a table, as well as access the databases and tables stored in them.*
6+
- *We can also extract data to the result-set, which allows us to fetch MySQL data to the Python environment's output screen.*

UPDATE THE RECORD.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mysql.connector as sqltor
22
con=sqltor.connect(host="localhost",user="root",passwd="",charset="utf8",database="pydb")
33
cur=con.cursor()
4-
cur.execute("UPDATE STUDENT SET MARKS=55.68 WHERE ADMN_NO=1245")
4+
cur.execute("UPDATE STUDENT1 SET MARKS=55.68 WHERE SID=1245")
55
con.commit()

0 commit comments

Comments
 (0)