Professional Documents
Culture Documents
Programming and
Technologies 1
MIDTERM –Python &MySQL
Web Development
WHAT IS SQL?
• SQL stands for Structured Query Language
• SQL lets you access and manipulate
databases
WHAT CAN SQL DO?
• SQL can execute queries against a database
• SQL can retrieve data from a database
• SQL can insert records in a database
• SQL can update records in a database
• SQL can delete records from a database
• SQL can create new databases
• SQL can create new tables in a database
• SQL can create stored procedures in a database
• SQL can create views in a database
• SQL can set permissions on tables, procedures, and views
Local Server Setup
Setup your Local Server
REQUIREMENTS IN CONNECTING FLASK TO MYSQL
1. Download XAMPP and install it
Link: https://www.apachefriends.org/index.html
Web Development
2. Click MySQL Admin Button
3. Go to User Accounts and click add user account
3. Setup you credentials and make sure to check all is ok
and click Go to save changes
4. Click Log out
5. Go to C Drive, xampp folder, phpMyadmin and Edit the config.inc.php
5. Make sure that auth_type is in cookie mode and AllowNo password is
set to False, then save after changes.
Create Database
and Table
6. Log-in Again to your phpMyAdmin and create database
Click New and Input desire database name and press create button
7. Click the Database and Create the desire table name and numbers of column and press Go to save
changes
8.Input the column name data type ,length values and Check A_I or Auto increment and click Save
9.Open CMD and prompt(need an Internet Connection)
pip install Flask-MySQL
Note: I already Installed it if not successfully will be display
10. On your flask folder which f3 in me create new text document save as main. py and new folder
named templates and an html file inside that folder
Flask Code for
Connecting
phpMyAdmin
11. Open the following file name: main.py and html using your text editor and code the following
SQL Command
OUTPUT:
13. main.py code for inserting data
Function name send()
14.Code the following which I named it as insert .html
OUTPUT:
15. Inside main.py
Code for Update
16. Create new file named it as update.html
Code for Update
OUTPUT
15. Inside main.py
Code for Delete
16.Create html file for
delete
OUTPUT
17. Inside main.py include this code to view the data
inserted, deleted and updated and include
18. Create html file for view I named it as select. html
OUTPUT
END THANK YOU !!!