Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import sqlite3
con = sqlite3.connect('database.db')
con.execute('CREATE TABLE users(username TEXT PRIMARY KEY, password TEXT)')
con.execute('CREATE TABLE books(name TEXT, author TEXT, date TEXT, isbn VARCHAR(17) PRIMARY KEY, description TEXT, image TEXT, tradePrice DOUBLE(100), retailPrice DOUBLE(100), quantity INTEGER(20))')
con.execute('CREATE TABLE cart(username TEXT, isbn VARCHAR(17), quantity INTEGER, FOREIGN KEY(username) REFERENCES users(username),FOREIGN KEY(isbn) REFERENCES books(isbn))')
con.close()
con = sqlite3.connect('database.db')
con.execute('INSERT INTO users( username, password) VALUES ("customer1","p455w0rd"),("customer2","p455w0rd"),("admin","p455w0rd");')
con.commit()
con.close()