0

Is it possible to have inheritage in SQL? I'm trying to make an app in c# that manages the student's grades. For exemple: the database 'university' contains all faculties, the database faculties contains departments, departments courses, courses the students and so on. Thanks

csi
  • 37
  • 6
  • 7
    I don't think OP is actually asking about inheritance here, but just a simple foreign-key-based multi-table database. – AKX Aug 01 '18 at 08:03
  • 2
    That sounds more like a simple relational model than inheritance. What common properties / structures between objects do you have that would suggest inheritance? – Diado Aug 01 '18 at 08:03
  • Inheritance enables new objects to take on the properties of existing objects. So, what are the common attributes that you keep in different tables ? You can use simple relational model which use primary key and foreign key concept. – Safwan Shaikh Aug 01 '18 at 08:13
  • Possible duplicate of [Basics of Foreign Keys in MySQL?](https://stackoverflow.com/questions/757181/basics-of-foreign-keys-in-mysql) – IteratioN7T Aug 01 '18 at 08:17
  • 2
    @CSI, i think you might need to do some research on simple databases and how to design them. Id suggest looking around for simple tutorials and ones related to C#. I don't think we can help you at this level – TheGeneral Aug 01 '18 at 08:19
  • It depends on the type of database. Whether it is a **relational** db or a NoSQL database makes a big difference. If it is a rdbms you can probably use foreign keys for example. – Peter Bons Aug 01 '18 at 08:22

1 Answers1

3

No inheritance BUT, Just implement primary key and foreign key concept in your relational modal in a correct manner so you will be able to get the desired result as you want from inheritance.

IShubh
  • 354
  • 1
  • 3
  • 12