Given the table in the root schema:
CREATE TABLE user ( username VARCHAR(50), password VARCHAR(50));
and the table in the Quiz diagram:
CREATE TABLE Quiz.Results ( username VARCHAR(50), points INT, FOREIGN KEY (username) REFERENCES user(username));
I cannot create a foreign key because the database claims that the user table does not actually exist. I also can not add the foreign key:
ALTER TABLE QUIZ.RESULTS ADD FOREIGN KEY (username) REFERENCES user (username)
Both tables, of course, are stored in one database.
Since this is just part of the homework, I'm more than happy to just skip adding the foreign key. But I'm curious if this is really a limitation in H2, a mistake, or if it works as intended.
Is there any way to refer to the user table outside of the Quiz schema?
source share