diff --git a/Practical/Practical Exam/Connectivity/C2 - MySQL Connectivity.md b/Practical/Practical Exam/Connectivity/C2 - MySQL Connectivity.md index 53869be..89475c9 100644 --- a/Practical/Practical Exam/Connectivity/C2 - MySQL Connectivity.md +++ b/Practical/Practical Exam/Connectivity/C2 - MySQL Connectivity.md @@ -7,7 +7,7 @@ ## Pre-requisites (with installation command for Ubuntu): 1. Python3 - `sudo apt install python3` -2. pip - `sudo apt install pip` +2. pip - `sudo apt install python3-pip` 3. mysql-connector - `pip3 install mysql-connector` OR `pip3 install mysql-connector --break-system-packages` (installs it system-wide) ## Instructions @@ -67,11 +67,11 @@ Cursor.execute(sqlInsert) sqlInsert = "INSERT INTO students (roll, name) VALUES (22, 'Foxy')" # insert operation print(Cursor.rowcount, "record added to database.") -sqlUpdate = "UPDATE students SET roll = 21 WHERE roll = 20" +sqlUpdate = "UPDATE students SET roll = 21 WHERE roll = 20" # update operation Cursor.execute(sqlUpdate) print(Cursor.rowcount, "record updated.") -sqlDelete = "DELETE FROM students WHERE roll = 20" +sqlDelete = "DELETE FROM students WHERE roll = 20" # delete operation Cursor.execute(sqlDelete) print(Cursor.rowcount, "record deleted.") @@ -84,6 +84,7 @@ db.close() 6. Open Terminal and run the above program: ```shell python3 connectSQL.py + ``` > [!NOTE]