Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Should you create a table for each user to contain information on specific content for an account, say favorite articles, interests, ect. User defined lists that would be used to generate useful content using a tag system to define groups of content. Would i be approaching this close to right, or is there a better way. i know u should not define more than one thing in a column, but i also would want the fewest number tables too?

share|improve this question
    
can you draft create table statements –  neo Jan 16 '13 at 5:08
    
i can write a MySQL query to create a table as well as write a function in php to accomplish tell the db the same, what i am trying to understand in how to structure the tables to store user preferances, or what to research.. u shouldnt store more than one thing in a single column, what if u have a list of things to store. and array that varies in number of items to store, how do u store a piece of that is as such, should i just put it in a column with spaces between the words? what should i study to better understand what i am talking about in database design –  John Jan 16 '13 at 5:52
add comment

2 Answers 2

Do not create a table for each user! Create a table for each category of information you want to store.

In a relational database, a table typically represents a list of a particular type of thing which is of interest to your system. This can be a tangible thing, like users, or an intangible thing, like interests. The point is that each table is about a kind of thing. The things themselves are rows in a table. Every row in a table needs to have the same structure. If you have no consistent structure for your data then you have to consider a No-SQL database instead.

For relational databases, study the rules of database normalization. This will help you to understand how to structure your database tables.

share|improve this answer
add comment

There is no should for storing only one thing in a single column and define more than one thing in a column in real world implementation. Some project stores serialised object (a group of value) into a single BLOB column. Some people separated values with comma in a single TEXT column to take advantage of full-text search after denormalisation.

You may have some insight from here. As other experts say you might have performance issue if the value could not be search as full-text, so it would better to normalise a single table into many. However, tags list could be search as full text so it is up to you.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.