I am going to create a person to person store with Laravel, a website where its users can share and sell their product or their mobile, TV, Computer, Shoes, Shirts, Books, Cars, Bags, Animal, etc.

I am going to create a table named products and other tables about products are, for example, bugs, Animals, Cars, Shirts, Shoes, Computers.

products table:

product_id   |   cat_id     |   title    |   cost    |    timestamp

cars table:

      id     |  product_fk  |     brand   |   model   |    type    |  Fuel  | ...

computers table:

     id     |  product_fk  |     brand   |   type     |    CPU     |  GPU    |  hard_disk  |  ...

I will create other tables with this way.

I want to search database by titles and their type , I mean I just search the products table

I want to know

  1. Is there any other way (better and easier) to do this?
  2. What do you think about this structure?
  • 2
    Hmm, there are many options to handle this. While it would not be uncommon to do it like you propose the obvious disadvantage here is the amount of tables you would need to create. Also only products with existing tables could be added. One alternative would be using a NoSQL database with a document model where you could add various types of additional information independent from product type. You would only have to define possible tags in your code. But you don't provide enough information to make a good decision, for example it would be important to know how you search this data. Commented Jan 21, 2015 at 9:17
  • I agree with thornsten muller. While it's possible to handle this with a normal relational database it's better and more "future-proof" to use a NoSQL database if you really want to do it properly.
    – Alternatex
    Commented Jan 21, 2015 at 9:21
  • @Alternatex can you please answer? Commented Jan 21, 2015 at 10:26
  • @Kermani Maybe someone with more experience in NoSQL can help you. Though I think your relational structure is fine if that's what you're asking.
    – Alternatex
    Commented Jan 21, 2015 at 10:28

1 Answer 1


You can use this structure too...

ProductID | CategoryID | Title | Cost | TimeStamp
1         | 1          | Audi  | $0   | ----- 

SpecificationID | Specification
1               | Model
2               | Fuel
3               | HardDisk

ProductSpecificationID | ProductID | SpecificationID | Value
1                      | 1         | 1               | xyz
1                      | 1         | 2               | abc
  • Thanks its a good design, But I think not working for example for fuel I have hybrid, Gas, Gasoline and other. But It gives me an Idea Commented Jan 21, 2015 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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