diff --git a/aula206/main.py b/aula206/main.py index 77de15c..0e43159 100644 --- a/aula206/main.py +++ b/aula206/main.py @@ -97,6 +97,7 @@ with connection: data4 = ( ("Siri", 22, ), ("Helena", 15, ), + ("Luiz", 18, ), ) result = cursor.executemany(sql, data4) # type: ignore # print(sql) @@ -106,10 +107,16 @@ with connection: # Lendo os valores com SELECT with connection.cursor() as cursor: + menor_id = int(input('Digite o menor id: ')) + maior_id = int(input('Digite o maior id: ')) + sql = ( f'SELECT * FROM {TABLE_NAME} ' + 'WHERE id BETWEEN %s AND %s ' ) - cursor.execute(sql) # type: ignore + + cursor.execute(sql, (menor_id, maior_id)) # type: ignore + print(cursor.mogrify(sql, (menor_id, maior_id))) # type: ignore data5 = cursor.fetchall() # type: ignore for row in data5: