Good Morning,

I am a beginner in database and I'm developing a Database (with Tcl/Tk) to control the loans of books in a reading room.

Some users will have administrator privileges (to make loans, register other users etc).

I am creating a table to store login and password to be used in the authentication of the admin users (admin_user).

Id_user is the primary key of the user table (all users).

I want to avoid two administrators (admin_user) with the same login but for this I am in doubt if I put the two fields as primary key or as unique:


CREATE TABLE admin_user (
id_user integer,
login text NOT NULL,
password text NOT NULL,
admin_registration_date INTEGER NOT NULL,
id_super_admin INTEGER NOT NULL,
*PRIMARY KEY (id_user, login),*
*FOREIGN KEY(id_**user**) REFERENCES us**er**(id_us**er**)*);


or


CREATE TABLE admin_user (
id_user integer,
login text NOT NULL,
password text NOT NULL,
admin_registration_date INTEGER NOT NULL,
id_super_admin INTEGER NOT NULL,
*UNIQUE (id_user, login),*
*FOREIGN KEY(id_**user**) REFERENCES us**er**(id_us**er**)*);

What are the possible consequences of the two strategies and which would be the most appropriate?

Thank you,

Markos

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to