-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaulaJoin.py
More file actions
30 lines (20 loc) · 1.14 KB
/
aulaJoin.py
File metadata and controls
30 lines (20 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sqlite3
con = sqlite3.connect("banco_de_dados.db")
cursor = con.cursor()
#consulta = cursor.execute('CREATE TABLE IF NOT EXISTS tab_vendas(id real, valor real)')
#consulta = cursor.execute('CREATE TABLE IF NOT EXISTS tab_cad_vendas(id real, nome text)')
'''cursor.execute("INSERT INTO tab_vendas VALUES (1, 100)")
cursor.execute("INSERT INTO tab_vendas VALUES (1, 200)")
cursor.execute("INSERT INTO tab_vendas VALUES (1, 150)")
cursor.execute("INSERT INTO tab_vendas VALUES (2, 50)")
cursor.execute("INSERT INTO tab_vendas VALUES (2, 200)")
cursor.execute("INSERT INTO tab_vendas VALUES (2, 900)")'''
#cursor.execute("INSERT INTO tab_cad_vendas VALUES (1, 'Odemir Jr')")
#cursor.execute("INSERT INTO tab_cad_vendas VALUES (2, 'Lucas Alves')")
#consulta = cursor.execute('SELECT * FROM tab_vendas INNER JOIN tab_cad_vendas ON tab_vendas.id = tab_cad_vendas.id')
#consulta = cursor.execute('INSERT INTO tab_vendas VALUES (3, 9999)')
consulta = cursor.execute('SELECT * FROM tab_vendas RIGHT JOIN tab_cad_vendas ON tab_vendas.id = tab_cad_vendas.id')
#consulta = cursor.execute("SELECT * FROM tab_vendas")
for i in consulta:
print(i)
con.commit()