Python Tutorials · Python MySQL
MySQL Where
Learn all about MySQL Where in this comprehensive tutorial.
5 min read advanced
- •When selecting records from a table, you can filter the selection by using the "WHERE" statement:
- •You can also select the records that starts, includes, or ends with a given letter or phrase.
- •When query values are provided by the user, you should escape the values.
Select With a Filter
When selecting records from a table, you can filter the selection by using the "WHERE" statement:
python
Wildcard Characters
You can also select the records that starts, includes, or ends with a given letter or phrase.
Use the % to represent wildcard characters:
python
Prevent SQL Injection
When query values are provided by the user, you should escape the values.
This is to prevent SQL injections, which is a common web hacking technique to destroy or misuse your database.
The mysql.connector module has methods to escape query values:
python
Module quiz
2 questions1
Which of the following is true about MySQL Where?
2
What is the most common pitfall when working with MySQL Where?
Answer all questions to submit.