TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   MySQL & Databases (http://www.talkphp.com/mysql-databases/)
-   -   Review my database design (http://www.talkphp.com/mysql-databases/1734-review-my-database-design.html)

Haris 12-14-2007 10:07 AM

Review my database design
 
http://www.imgsync.com/data/img/1951...ase-design.PNG

Finally, completed. ;-)

bmicallef 12-14-2007 11:53 AM

Haris,

Would you provide a short narrative of what you are trying to achieve and how you expect the database to be accessed by users?

For example ... if you are planning to search on specific fields, you may want to add indexes to aide faster searching.

If you are looking to expand the database later to support additional content, then you may also want to re-evaluate how your data is normalized, etc ...

bdm 12-14-2007 01:29 PM

Good thinking bmicallef.

Quick things off the top of my head:
- There is no status table.
- Since you're using tinyint as your datatype for user_rank in your users table, you should do the same the the ID in your users_rank table. Tinyint should be more than enough, especdially if you make it unsigned since it'll go up to 255.
- In your comments table, isn't the comments_comments column a little redundant?

Haris 12-14-2007 02:37 PM

Quote:

Originally Posted by bdm (Post 6583)
Good thinking bmicallef.

Quick things off the top of my head:
- There is no status table.
- Since you're using tinyint as your datatype for user_rank in your users table, you should do the same the the ID in your users_rank table. Tinyint should be more than enough, especdially if you make it unsigned since it'll go up to 255.
- In your comments table, isn't the comments_comments column a little redundant?

  • I don't need a status table. Not necessary. I will have only two status, hide or show i.e 0 or 1.
  • I'll change them. Between, can you explain difference between signed and unsigned? :)
  • It should be comment_comment. I know it sounds confusing. I have two choices, either stay with it due to the table prefix standard in other tables or just change it to comment. The first option sounds better to me but I'll consider a second opinion. ^^

Village Idiot 12-14-2007 03:15 PM

A signed int's range is -2147483648 to 2147483647, a unsigned int's range is 0 to 4294967295

bdm 12-14-2007 03:28 PM

In your case:
Code:

signed tinyint => -128 to 127
unsigned tinyint => 0 to 255

Check out MySQL AB :: MySQL 5.0 Reference Manual :: 9 Data Types for a more in depth explanation of all data types.

Haris 12-14-2007 08:17 PM

I am sure I'll have more than 255 users, 255 content, 255 ingredients, 255 comments and 255 ratings so i'll stay with unsigned int.

Thanks. :-)

bdm 12-14-2007 08:35 PM

I'm not sure if I'm the only one, but I'm having a hard time distinguishing the relationships. Seems like all the lines cross eachother.

Any way we could get a clearer model please?

Haris 12-14-2007 10:01 PM

First, let me make sure that my data types are correct. I have to make the relationship again if I change data types. :(

http://www.imgsync.com/data/img/7579...se-design1.PNG

A more readable version of relationships.
http://www.imgsync.com/data/img/1621...se-design2.PNG

bdm 12-23-2007 12:47 AM

Your users table needs some lovin'.

users
user_rank => tinyint(1)
username seems to be way too long, same with password and name
and i think the hashes password will always be the same length. so it's safe to use char(n)

Sorry, only had a quick second to spare.

macov 12-29-2007 10:40 PM

Quote:

Originally Posted by Haris (Post 6566)

Still there are missing the descriptions of relationships. Looking at your model, I don't know what kind of a reletionship is between USER and CONTENT.

Is a user creating a content, reading, rating, requesting a piece of content, etc? It is good idea to have the names of relationships. Like USER has ACCOUNT, USER belongs to GROUP, GROUP is managed by ADMIN, EMPLOYEE works in DEPT.

Tanax 12-30-2007 12:34 AM

Quick question completly off the topic, what program did you use to create that db design???

macov 12-30-2007 04:22 AM

Quote:

Originally Posted by Tanax (Post 7311)
Quick question completly off the topic, what program did you use to create that db design???

Whatever it is, don't use it...

I suggest DBDesigner 4

fabFORCE.net


All times are GMT. The time now is 08:52 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0