-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaulaUnion.py
More file actions
32 lines (23 loc) · 809 Bytes
/
aulaUnion.py
File metadata and controls
32 lines (23 loc) · 809 Bytes
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
31
32
import sqlite3
con = sqlite3.connect("banco_de_dados.db")
cursor = con.cursor()
#cursor.execute('CREATE TABLE IF NOT EXISTS tabX (id real, nome text)')
#cursor.execute('CREATE TABLE IF NOT EXISTS tabY (id real, nome text)')
'''cursor.execute('INSERT INTO tabX VALUES (1, "Maria")')
cursor.execute('INSERT INTO tabX VALUES (2, "Jose")')
cursor.execute('INSERT INTO tabX VALUES (3, "Antonio")')
cursor.execute('INSERT INTO tabY VALUES (1, "Ana")')
cursor.execute('INSERT INTO tabY VALUES (2, "Elsa")')
cursor.execute('INSERT INTO tabY VALUES (3, "Cristoph")')'''
#consulta = cursor.execute('SELECT * FROM tabY').fetchall()
#print(consulta)
consulta = cursor.execute(
'''
SELECT * FROM tabX
UNION ALL
SELECT * FROM tabY
'''
)
for i in consulta:
print(i)
con.commit()