简体   繁体   中英

How to create subclasses using SQL (Oracle SQL Developer)?

I have a main table with 2 subclass tables attached in my ER Diagram. How exactly do I go about attaching the subclasses to the main table using SQL? I'm very new to SQL. I'm currently using SQL on the Oracle SQL Developer platform.

Thanks for your help, it's greatly appreciated.

The concept of Superclass and Subclasses in terms of an ER diagram is correct, but be careful while you refer that ER diagram in terms of a Database. In the database world, and entity is always a DB Object, and there are various types of DB objects, Tables, views, Stored procs etc. The only object that probably best fits your ER diagram in terms of an entity is a Table or a view. Tables in Oracle can be very tightly coupled/related to each other via constraints and checks.

So considering that almost all the entities in your ER diagram are Table DB objects the correct term would be "Parent table" and "child table". A child table references a Parent table's unique key as a foreign key, the column(s) in the child table that references should also have a unique key on it. There are more details to it than that, but it would be clear if you go through this link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM