Reputation: 6862
I need to be able to store some information about the user and I was wondering the best way to approach this.
Social Media
id - user_id - facebook - twitter_username - display_tweets
Some quick questions:
And then the main question is, should I just store these in the users table? So I would just add 3 fields, the facebook, twitter_username, and display_tweets. Also, some might not have either facebook or twitter. The users table already has 20 fields, so I don't want to make it TOO big.
Thanks!
Upvotes: 0
Views: 191
Reputation: 63538
Yes, put them in your users table. Columns are cheap (if they are often null or small), particularly as your users table is guaranteed to be very small (You cannot possibly have a large number of users).
Putting things in more tables just creates more effort. I've previously created tables with over 50 columns (properly normalised - all 50 columns store different items of data).
It is probably a good idea to allow NULLs if the columns are not necessarily relevant to every user. "Magic values" are not a good idea (I've seen "" or -1 used as a "magic value" often enough).
Upvotes: 2
Reputation: 95113
You want a bit
type for any boolean field. You can also use bool
or boolean
, but those are aliases for tinyint(1)
, as is bit
. Don't use enum
, as it inserts an empty string when an invalid entry is input, rather than throw an exception.
Upvotes: 1