O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
groovy databases
groovy databases
Carregando em…3
×

Confira estes a seguir

1 de 4 Anúncio

Mais Conteúdo rRelacionado

Semelhante a jfj].pptx (20)

Mais recentes (20)

Anúncio

jfj].pptx

  1. 1. def update_year(song_number, new_year): modify_row(song_number, "year", new_year)
  2. 2. https://paste.ofcode.org/35rxA8GCVHdUitDLV4i8UN9
  3. 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. 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)

×