在Android上使用SQLite创建表时看不到语法错误

时间:2019-03-01 20:11:07

标签: android sqlite

不确定我的语法错误在哪里...

fruit

这就是我创建android.database.sqlite.SQLiteException: near "trackuser": syntax error (code 1 SQLITE_ERROR): , while compiling: CREATE TABLE players(firstname TEXT, lastname TEXT, category INTEGER, wins INTEGER, losses INTEGER, trackuser INTEGER, FOREIGH KEY(trackuser) REFERENCES users(ID)) 表的方式

users

例如引用here

1 个答案:

答案 0 :(得分:1)

您有一个拼写错误。您在main查询中使用public static void main(String[] args) { ArrayList<URI> pageALinks = new ArrayList<>(); pageALinks.add(createURI("www.b.com")); pageALinks.add(createURI("www.d.com")); URI pageAURI = createURI("www.a.com"); WebPage pageA = new WebPage(pageAURI, new ArrayList<>(), pageALinks); ArrayList<URI> pageBLinks = new ArrayList<>(); pageBLinks.add(createURI("www.c.com")); pageBLinks.add(createURI("www.d.com")); URI pageBURI = createURI("www.b.com"); WebPage pageB = new WebPage(pageBURI, new ArrayList<>(), pageBLinks); ArrayList<URI> pageCLinks = new ArrayList<>(); URI pageCURI = createURI("www.c.com"); WebPage pageC = new WebPage(pageCURI, new ArrayList<>(), pageCLinks); ArrayList<URI> pageDLinks = new ArrayList<>(); pageDLinks.add(createURI("www.a.com")); URI pageDURI = createURI("www.d.com"); WebPage pageD = new WebPage(pageDURI, new ArrayList<>(), pageDLinks); ArrayList<URI> pageELinks = new ArrayList<>(); pageELinks.add(createURI("www.d.com")); URI pageEURI = createURI("www.e.com"); WebPage pageE = new WebPage(pageEURI, new ArrayList<>(), pageELinks); HashSet<WebPage> pages = new HashSet<>(); pages.add(pageA); pages.add(pageB); pages.add(pageC); pages.add(pageD); pages.add(pageE); HashMap<URI, HashSet<URI>> graph = makeGraph(pages); HashMap<URI, Double> map = makePageRanks(graph, 0.85, 100, 0.00001); } 而不是FOREIGH key