ER diagram Relationship among tables

Viewed 21

My question is related to the ER-diagram I designed using Oracle SQL developer. I designed this ER-diagram but I don't know how to read the relationships between these tables.

I have created this ER diagram:

ER Diagram

As it can be seen that these relations don't look like those normal one to many or many to one relations. Can anyone please help me how to read the relation between SYS.GENERAL_LEDGER_ACCOUNTS and SYS.INVOICE_LINE_ITEMS? Thanks in advance

1 Answers

The relationship is described by the foreign key:

ALTER TABLE invoice_line_items
  ADD CONSTRAINT line_item_fk_accounts
  FOREIGN KEY (account_number)
  REFERENCES general_ledger_accounts(account_number);

Defines a foreign key with the name line_item_fk_accounts on the column account_number which references the account_number of the general_ledger_accounts.

Assuming that it is notNULL then this is a many-to-one relationship such that each row of invoice_line_items has a relationship to exactly one row in the general_ledger_accounts and there can be many invoice_line_items for each general_ledger_accounts.


Similarly, line_items_fk_invoices is a many-to-one constraint with many invoice_line_items each referencing one row of the invoices table.


Aside: NEVER modify the system schemas. If you do you risk making the database unusable and invalidating any support contract that you have with Oracle. Instead, you should create a user and then work in that schema.

Related