Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I set up a mySQL table structure for a business directory with many to many relationship?
    primarykey
    data
    text
    <p>I am trying to plan my table structure for a business directory where I will have multiple parent categories for multiple sub-categories and multiple business listings, all of which will require a many to many relationship.</p> <p>eg.</p> <p><b>A Night Out</b></p> <p>Clubs and Societies<br /> Public Houses<br /> <b>Restaurants</b><br /> Taxis and Private Hire Vehicles<br /> Theatres and Concert Halls<br /> Wine Bars</p> <p><b>Restaurants</b></p> <p>Chinese / Oriental<br /> Bistros<br /> Fish and Chips<br /> Indian<br /> Italian<br /> Public Houses<br /> Seafood<br /> Spanish<br /></p> <p><b>Transport and Carriers</b></p> <p>Air Charter and Rental<br /> Airlines<br /> Car / Van Hire Self Drive<br /> Courier and Distribution Services<br /> Estate / Property Re-location Services<br /> Freight Services and Agents<br /> Haulage Contractors<br /> Post Offices and Services<br /> Re-location Services<br /> Taxis and Private Hire Vehicles<br /> Van Hire</p> <p>As you can see, <b>Restaurants</b> is both a main category and a subcategory. Taxis and Private Hire Vehicles belongs to both <b>Transport and Carriers</b> and <b>A Night Out</b> and under all of these categories, on the lowest level, I will have the business listings. I will not be allowing businesses to submit their own listings but rather adding them myself upon request. A business listing can belong to a maximum of 6 categories.</p> <p>I am struggling to find the best structure of tables for my database and would be very grateful for any suggestions. I am relatively new to php/mySQL.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload