Technology independent Write the project some database ideas

Source: Internet
Author: User
Tags mul

I don't know how to design a database for a forum.

Let's just do this.

User table

+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| user_id | Int (10) | NO | PRI | NULL | auto_increment |
| Username | varchar (255) |     YES | |                NULL | |
| password | varchar (255) |     YES | |                NULL | |
| Mobile | varchar (11) |     YES | |                NULL | |
| Address | varchar (50) |     YES | |                NULL | |
| sex | varchar (10) |     YES | |                NULL | |
+----------+--------------+------+-----+---------+----------------+

The table

+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| room_id | Int (10) | NO | PRI | NULL | auto_increment |
| user_id | Int (10) | NO | MUL |                0 | |
| Room_words | varchar (255) |     YES | |                NULL | |
| Room_title | varchar (100) |     YES | |                NULL | |
+------------+--------------+------+-----+---------+----------------+

Words table

+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| word_id | Int (10) | NO | PRI | NULL | auto_increment |
| user_id | Int (10) | NO | MUL |                0 | |
| room_id | Int (10) | NO | MUL |                0 | |
| Words | varchar (255) |     YES | |                NULL | |
+---------+--------------+------+-----+---------+----------------+

User table doesn't mean anything.

The table

ROOM_ID is the unique identity of a post that a person publishes

USER_ID is the only sign of that man.

Room_words is the supplementary content of the first floor of the post
Room_title is the name of the post.

And then

Words table

WORD_ID's unique identification of the words of reply
USER_ID the unique identity of the person who replied
ROOM_ID the unique identification of which Post replies
Words specifically replied to what the words

Honestly, all the responses were put on a sticker that made me panic.

Feel the database should not be designed like this

So write and ask for advice

Technology independent Write the project some database ideas

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.