简体   繁体   中英

database normalization users and messages database

I'm a newbie with databases and I want to create a database which will have

  1. Username VARCHAR(16)
  2. Membership status ( paid or free )
  3. Message TEXT (most likely or should I use something else?)
  4. Messages counter for a user 'to count the total number of messages for a user (probably UNSIGNED INT).
  5. Catagory of the message VARCHAR(60)
  6. Date posted DATE

Now I have this as a layout for the database I am not sure how to get it to the first and second and third normal forms. Your help is greatly appreciated.

Thanks

Seems like you want a user table:

UserID, UserName, member_status

And a message table:

UserID, category, date, message

A category table:

category, description

You can get the total number of messages for a user with a query like:

select count(*) from message where userid = 'someuser'

so don't store that.

Hope this gets you started. Have fun...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM