کاراکترهای Wildcard(Wildcard Characters)
همچنین میتوانید رکوردهایی را انتخاب کنید که با یک حرف مشخص شروع، شامل یا پایان میشوند
یا عبارت.
از %
برای نشان دادن حروف عام استفاده کنید
کاراکترها:
مثال
Select records where the address contains the word "way":
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="youruse
ame",
passwd="yourpassword",
database="mydatabase"
)
mycursor = mydb.cursor()
sql = "SELECT * FROM customers WHERE address
LIKE '%way%'"
mycursor.execute(sql)
myresult = mycursor.fetchall()
for x in myresult:
print(x)