在下面给定的代码行中执行代码时,我遇到了操作错误。
c.execute("CREATE TABLE IF NOT EXISTS customerReg(cname TEXT,cgender TEXT,cphone INT UNIQUE,cusername TEXT UNIQUE,cpassword TEXT UNIQUE)")
c.execute("CREATE TABLE IF NOT EXISTS adminReg(Oname TEXT,Hname TEXT UNIQUE,totalrooms INT,tariff INT,location TEXT,aphone INT,ausername TEXT UNIQUE,apassword TEXT UNIQUE)")
c.execute("CREATE TABLE IF NOT EXISTS customerStay(cname TEXT,hostel TEXT,location TEXT,tariff INT)")
c.execute("CREATE TABLE IF NOT EXISTS Hostel(FOREIGN KEY(Hostelname) REFERENCE adminReg(Hname),FOREIGN KEY(rent) REFERENCE adminReg(tariff),FOREIGN KEY(roomsavailable) REFERENCE adminReg(totalrooms))")
正在显示的错误是
c.execute("CREATE TABLE IF NOT EXISTS Hostel(FOREIGN KEY(Hostelname)
REFERENCE adminReg(Hname),FOREIGN KEY(rent) REFERENCE
adminReg(tariff),FOREIGN KEY(roomsavailable) REFERENCE
adminReg(totalrooms))") sqlite3.OperationalError: near "FOREIGN":
syntax error
我看不到错误。