-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
40 lines (27 loc) · 1.09 KB
/
database.py
File metadata and controls
40 lines (27 loc) · 1.09 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
31
32
33
34
35
36
37
38
39
40
import sqlite3
import random
conn = sqlite3.connect("C:\sqlite\Players.db")
c = conn.cursor()
def createTable(teamname):
c.execute("create table " +teamname +" ('Team','Player','Value')")
def insertTable(teamname):
c.execute("insert into " +name+ "('Team','Player','Value') values ( 'Team1', 'kholli',120)")
def selectBTM(tablename):
c.execute("select Team from team12 WHERE Value = 120")
for i in c.fetchall():
print(i)
def selectWK(tablename):
c.execute("select player from " +tablename+ "Where Category = 'WK'")
def selectBWL(tablename):
c.execute("select player from " +tablename+ "Where Category = 'BWL'")
def selectAR(tablename):
c.execute("select player from " +tablename+ "Where Category = 'AR'")
name = input("Enter name:")
createTable(name)
insertTable(name)
selectBTM(name)
'''c.execute("create table " +name +" ('Team','Player','Value')")
c.execute("insert into " +name+ "('Team','Player','Value') values ( 'Team1', 'kholli',120)")
c.execute("select * from "+name)
data = c.fetchall()
print(*data)'''