Reputation: 2220
I am new to sqlite3, need your help to join these two table, I need to joint the team id between a coach and the teams table, but when compiling it tells me that there is a problem with teamID in the coach table. Any idea where is my mistake?
def creationTeamDB():
with sqlite3.connect("teams.db") as db1:
cursor = db1.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS team (
teamID INTEGER PRIMARY KEY,
teamName VARCHAR(20) NOT NULL
)
''')
def creationCoachDB():
with sqlite3.connect("coachs.db") as db2:
cursor = db2.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS coach (
coachID INTEGER PRIMARY KEY,
coachName VARCHAR(20) NOT NULL
teamID INTEGER
)
''')
Thanks in advance, :) G.B
Upvotes: 0
Views: 64
Reputation: 64
You missed the comma in the second query
CREATE TABLE IF NOT EXISTS coach (
coachID INTEGER PRIMARY KEY,
coachName VARCHAR(20) NOT NULL,
teamID INTEGER
)
Upvotes: 2