0

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.

3
  • 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-fuso
    Commented Sep 26, 2017 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
    Commented Sep 26, 2017 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
    Commented Sep 26, 2017 at 18:14

1 Answer 1

1

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.