0

ERD diagram

I am a beginner to MS SQL.

I have the entities Product, Accessory and FoodItem. FoodItem and Accessory are subtypes of Product.

Product attributes : name, stockLevel, price, type.

Product primary key : code.

Accessory attributes : classification.

Accessory foreign/primary key: code.

FoodItem attributes : expiryDate.

FoodItem foreign/primary key: code.

Now I have some knowledge of Java. If FoodItem for example, inherits name, stockLevel,price, type, how do I type it in sql code? In java I would type EXTENDS but how do you do it in MS SQL for inheritance?

  • 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) – Jeroen Mostert Feb 06 '20 at 11:11
  • It might help if you provided an example of the raw data for each table and how you then what your desired output is. – BarneyL Feb 06 '20 at 11:18

0 Answers0