create table groups("group" TEXT UNIQUE); create table users("name" TEXT UNIQUE,"passwd","group" INTEGER FOREIGN KEY); insert into groups values("root"); insert into groups values("users"); insert into users values("root","?",(select ROWID from groups where "group"="root")); insert into users values("test","foobar",(select ROWID from groups where "group"="users")); select name, passwd,groups."group" from users,groups where users."group"=groups.ROWID;

SQL shell