3. criteria.")
else:
for result in results:
print(result)
def search_song_artist(artist):
sql = "SELECT * FROM musicshop"
sql += " WHERE artist_name =
'{}'".format(artist)
# Execute the SQL statement
try:
mycursor.execute(sql)
except:
print("song not found")
# print(sql)
# Fetch all the results
results = mycursor.fetchall()
if not results:
print("No song was found with matching
criteria.")
else:
for result in results:
print(result)
4. conn = mysql.connector.connect(
host="host_name",
user="username",
password="password",
database="database_name"
)
cursor = conn.cursor()
update_query = f"UPDATE MusicShop SET {column} =
'{new_value}' WHERE songnumber = '{song_number}'"
cursor.execute(update_query)
conn.commit()
print(f"Successfully updated {column} of song number
{song_number} to {new_value}")
cursor.close()
conn.close()
def update_song_name(song_number, new_name):
modify_row(song_number, "songname", new_name)
def update_price(song_number, new_price):
modify_row(song_number, "price", new_price)