Welcome Guest, Not a member yet? Register   Sign In
Request for advice how to structure a table with possible relationship
#1

[eluser]gbar[/eluser]
Hello, I am in a moment of my project, where I have to make choices regarding the division of a database table. I wanted to seek advice from those who are more experienced.

I have an application I'm working on, the products of this application, which are books, I would then be represented on the board, either with their natural data (title, author, price, synopsis, etc.), but I would also include for each produced its meta tag (keywords, description, title).

So far no problem, put in the same form all matters pertaining to the product and relative meta tags.

The thing that I have some doubts, is how to structure the database table books.

At present the situation of the table is this: - Solution 1

Code:
---------------------------------------------------------------------------------------
| id_book | author_id | category_id | publisher_id | book | price | synopsis | status |
---------------------------------------------------------------------------------------
|   int   |    int    |     int     |     int      |varcha| float |   text   |   int  |
---------------------------------------------------------------------------------------

Having to add fields for meta tags, I do not know whether to add to the existing table, then add three fields:

Code:
------------------------------------------------------------------------------------------------------------------------
| id_book | author_id | category_id | publisher_id | book | price | synopsis | status | Title | Description | keywords |
------------------------------------------------------------------------------------------------------------------------
|   int   |    int    |     int     |     int      |varcha| float |   text   |   int  |varchar|   varchar   | varchar  |
------------------------------------------------------------------------------------------------------------------------

Or create a separate table, called for example meta_books and report back to the table through the field to join book_id.

Code:
------------------------------------------------------
| id_meta | book_id | Title | Description | keywords |
------------------------------------------------------
|   int   |   int   |varchar|   varchar   | varchar  |
------------------------------------------------------

By choosing first solution, I do not think of violating the rules of integrity, as none of the new data will never be repeated, but perhaps the solution to detach the database tables might give me a little bit faster.

I'd like some opinions by yours

Thank you and good job


Messages In This Thread
Request for advice how to structure a table with possible relationship - by El Forum - 06-13-2011, 03:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB