This question already has an answer here:

Creating a database that will be searchable using a company's name and then list all the public owners of the company with their phone numbers. And I was wondering how to structure it. I was thinking of making the company name and ID and then make a new table for every company which would then store the information of every stock owner there. But then I thought about what if the owner owned multiple stocks then they would have duplicates in other tables with other companies so that would take a long time to query.

Can anybody help me structure this database? It's my first time doing this.

marked as duplicate by MDCCL, Erik Darling, ypercubeᵀᴹ, RDFozz, Michael Green Oct 21 '17 at 12:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I recommend you take a class, or read some books, on relational database design; anything by Codd is a good (theoretical) start, though most designs eventually need to look at some level of denormalization from an implementation/performance perspective, ymmv; or are you taking a class and this is your homework/lab assignment? – markp Sep 26 '17 at 16:19
  • No this is my own little project. I have already finished the algorithm for getting the data and I've made a CVS file to hold it all now I just need to know how to structure it. Honestly, i have used databases before in CS50 but I don't remember as much. I just need a quick tip on how to structure it all before I create something slow and inneffiecnt – Jane Doe Sep 26 '17 at 16:53
  • Take a look here and here. Take a look around that site - things you already know and how they're modelled! – Vérace Sep 26 '17 at 18:14

Do not have "a new table for every company"!

Think about the "Entities" - Company, Owner, etc. One table for all the Companies, etc.

Think about "relationships"

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