+ 1
SQL Create table from other tables
My Create Tables skills are a little rusty. Can someone assist in helping me create the appropriate answer/solution to this question? Thank you. https://www.testdome.com/questions/sql/users-and-roles/24623?visibility=1&skillId=17
4 Réponses
+ 1
// Please, use a search bar before publishing your question :
https://www.sololearn.com/learn/SQL/1870/?ref=app
0
Thank you, Zohir. I did search and didn't find an answer. Additionally, the link you provided goes to a page which is not found.
0
Thank you for showing me the way to testdome. Always looking for test sites.
0
I ended up working with a buddy of mine and got the correct answer. It's a many to many relationship.
CREATE TABLE users_roles (
UserId INTEGER NOT NULL,
RoleId INTEGER NOT NULL,
FOREIGN KEY (UserId) REFERENCES users(id),
FOREIGN KEY (RoleId) REFERENCES roles(id),
UNIQUE (UserId, roleId)
)