first commit
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect("Goonerdle.db")
|
||||
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute("""
|
||||
CREATE TABLE Score (
|
||||
Score_ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
Result_ID INTEGER,
|
||||
Position INTEGER,
|
||||
isCorrect INTEGER NOT NULL CHECK (isCorrect IN (0,1)),
|
||||
FOREIGN KEY (Result_ID) REFERENCES Result(Result_ID)
|
||||
);
|
||||
""")
|
||||
|
||||
cursor.execute("""
|
||||
CREATE TABLE Result (
|
||||
Result_ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
User_ID INTEGER NOT NULL,
|
||||
DateScore DATE NOT NULL,
|
||||
Result INTEGER NOT NULL,
|
||||
UNIQUE (User_ID, DateScore)
|
||||
);
|
||||
""")
|
||||
|
||||
conn.commit()
|
||||
|
||||
conn.close()
|
||||
|
||||
print("Database and tables created successfully!")
|
||||
Reference in New Issue
Block a user