0

I'm learning SQL and I found a nice exercise (without an answer) so I don't have any hints on whether I am right or not and that's why I'm here.

Design a Computer store database using an ER diagram:

  • The store sells printers & computers

  • Some of the computers are laptops

  • Each printer model has one manufacturer

  • Each computer model may have more than one manufacturer

  • Some manufacturers make both printers & computers

  • Some of the printers print color, some black and white

  • Each computer must have information on: Processor speed, RAM, HDD space.

  • The computers that have CD drivers must have information on the CD driver's speed

  • All the laptops should have information on their screen size

  • Computers of the same model may differ in hardware (and price accordingly)

First, I tried to make an ER diagram but in the middle of the process I got confused.

For example, Some of the computers are laptops:

Should I add a field (attribute) to the Computer object which is kind of a boolean field which determines whether the computer is a laptop or not? I don't get it.

Because later on, there is a need to All the laptops should have information on their screen size but in this case, which means I need to add a Laptop object as well, how can I connect between both the objects and claim that one might be the other object.. I don't get it.

Some of the printers print color, some black and white:

how can I do it in the diagram and later on in the database?

Another "kind of boolean" field is the Some manufacturers make both printers & computers. Again, as in my first question, a manufacturer can be for both printers and computers and maybe not. Should I make an entire different object like I did in the diagram below, for each manufacturer? How can I know later on in the database, if a manufacturer is for both printers and computers?

When i'm done, the next step is to write a SQL script to build this whole computer store database.

This is what I accomplished so far:

enter image description here

NoobCoder
  • 513
  • 3
  • 18
  • Wikipedia has a good article about [database normalization](https://en.wikipedia.org/wiki/Database_normalization). Read the article and then read one of the books listed in the further reading. – Gilbert Le Blanc Nov 03 '21 at 16:49
  • 1
    Does this answer your question? [How can you represent inheritance in a database?](https://stackoverflow.com/questions/3579079/how-can-you-represent-inheritance-in-a-database) – philipxy Nov 03 '21 at 19:20
  • Follow a published academic textbook on information modelling, the relational model & DB design & querying. (Manuals for languages & tools to record & use designs are not such textbooks.) (Nor are wiki articles or web posts.) Dozens are online free in pdf & html. Ask 1 clear specific researched non-duplicate question about where you are 1st stuck. – philipxy Nov 03 '21 at 19:23

0 Answers0