-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase_2.py
More file actions
19 lines (19 loc) · 799 Bytes
/
database_2.py
File metadata and controls
19 lines (19 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sqlite3
conn=sqlite3.connect("my_database.db")
curr=conn.cursor()
# curr.execute("create table table2(name text,marks integer,fees real)")
# curr.execute("insert into table2 values('A',78,340000)")
# curr.execute("insert into table2 values('B',67,45999)")
# curr.execute("insert into table2 values('C',78,45000)")
# curr.execute("create table table3(id integer,name text,age integer)")
# curr.execute("insert into table3 values(1,'B',23)")
# curr.execute("insert into table3 values(2,'C',22)")
data=curr.execute("select * from table3")
# curr.execute("(select * from table2) left join (select * from table3) on table2.name=table3.name ")
# print(data.fetchone())
# print(curr.fetchone())
# data1=curr.fetchmany(2)
# print("fetch many :",data1)
print(curr.rowcount)
conn.commit()
conn.close()