Subtype Base Tables

I heard a lot about subtyping tables when designing a database, and I am fully aware of the theory behind them. However, I have never seen tabular subtyping in action. How can you create subtypes of tables? I am using MS Access and I am looking for a way to do this in SQL as well as through the graphical interface (Access 2003).

Hurrah!

+3
source share
5 answers

A simple example would be a Person table with a primary key and some columns in that table. Now you can create another table called "Student", which has a foreign key for the face table (its supertype). Now in the student table there are several columns for which the supertype does not have a GPA, Major, etc. But first name, last name, etc. Will be in the parent table. You can always access the student name in the Person table through the foreign key in the Student table.

In any case, just remember the following:

  • The hierarchy displays the relationship between supertypes and subtypes
  • Supertypes have common attributes
  • Subtypes have unique attributes.
+10
source

EER. RDBMS ( - ), .

  • ,
+1

ORM , .

, .

+1

, , Access, .

, , ( ), Nz(), UNION ALL SELECT ( ). .

SQL , /, , , SQL , . , , , - , -, , . , .

, , .

+1

, .

, , , (TABLE_NAME, PK_ID).

:

: CUSTOMER

: PERSON, BUSINESS, GOVT_ENTITY

NULL PRERSON_ID, BUSINESS_ID GOVT_ENTITY_ID CUSTOMER, , null. , .

+1

Source: https://habr.com/ru/post/1706430/


All Articles