Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3270590
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:39:14+00:00 2026-05-17T18:39:14+00:00

I’m building a web application and I just received some basic foundation data from

  • 0

I’m building a web application and I just received some basic foundation data from the client in a spreadsheet. I need to get the data into a MySQL database in a meaningful way so I can effectively query it later. What makes the most sense? Here’s the particulars:

There are Departments, Classes *edit (classes are types of products like mens t-shirts, womens jeans etc…) and Vendors (and Products eventually…). 25 Departments, 300 Classes and 3300 Vendors. Departments share Classes as well as Vendors in some cases.

My web application will have Department pages that will display a list of vendors who have products that appear in the chosen department with a link to a vendor specific page. The vendor page will list their products sorted by class.

I could set up 3 or 4 tables I suppose but will that result in a well formed, efficient query when I build my application? Also, will that make for a normalized database that avoids update, delete anomalies?

This could really be more a question of how to select my data rather than how to structure my DB, but I figured I would start with structure and move to the query optimization.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:39:14+00:00Added an answer on May 17, 2026 at 6:39 pm

    If I assume correctly that Classes are categories of products, and a product can belong to a single class:

    +================================+    +================================+
    | departments                    |    | vendors                        |
    +----+------+--------------------+    +----+------+--------------------+
    | id | name | others             |    | id | name | others             |
    +====+======+====================+    +====+======+====================+
    
    +================================+    +================================+
    | classes                        |    | products                       |
    +----+------+--------------------+    +----+----------+----------------+
    | id | name | others             |    | id | class_id | name | others  |
    +====+======+====================+    +====+==========+================+
    
    +================================+    +================================+
    | departments_vendors            |    | classes_departments            |
    +----+----------+----------------+    +----+---------------+-----------+
    | id | department_id | vendor_id |    | id | department_id | class_id  |
    +====+==========+================+    +====+===============+===========+
    
    +================================+
    | products_vendors               |
    +----+------------+--------------+
    | id | product_id | vendor_id    |
    +====+============+==============+
    

    If products can belong to multiple classes, drop the class_id column and make a new table called classes_products.

    Assuming the above structure, here is a sample query.

    Get one department, that department’s classes, and products for those classes:

    SELECT    departments.id   AS DepartmentId,
              departments.name AS DepartmentName,
              classes.id       AS ClassId,
              classes.name     AS ClassName,
              products.id      AS ProductId,
              products.name    AS ProductName
    FROM      departments
    LEFT JOIN classes_departments
           ON classes_departments.department_id = departments.id
    LEFT JOIN classes
           ON classes.id = classes_departments.class_id
    LEFT JOIN products
           ON products.class_id = classes.id
    WHERE     departments.id = ##
    

    The best way to get a list of vendors who sell products from a class for a department would be to make another table called classes_vendors

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.