Re: How to find values without a FK?
From: ^Bart <gabriele1NOSPAM_at_hotmail.com>
Date: Wed, 3 Apr 2019 21:15:27 +0200
Message-ID: <q830oe$9d0$1_at_gioia.aioe.org>
Date: Wed, 3 Apr 2019 21:15:27 +0200
Message-ID: <q830oe$9d0$1_at_gioia.aioe.org>
> The easiest way I can think of is a many-to-many table.
>
> CREATE TABLE user_subject (
> id_user .... ,
> id_subject .... ,
> status ENUM ('complete', 'future'),
> FOREIGN KEY id_user REFERENCES users(id_user),
> FOREIGN KEY id_subject REFERENCES subjects(id_subject),
> PRIMARY KEY (id_user, id_subject)
> )
It's a good idea to use ENUM field, I didn't thought it!
Thanks!
^Bart
Received on Wed Apr 03 2019 - 21:15:27 CEST