Design for sales database

We have an operational data store (ODS) that gets loaded nightly from the OLTP system. One of the tables we load is Deal table with the primary key deal_id generated by the OLTP. Now we have a new requirement to allow Deals to be linked into Sales Deals (2..N source deals into 1 Sales Deals). We also have to allow users to group Sales Deals and or source Deals into Liability Deals (2..N Sales or source Deals into 1 Liability Deal). The requirements stated as following:

SWDL3.1 A deal can be linked according to the following rules:

  • SWDL3.1.1 A Source Deal can be part of only one Sales Deal link.
  • SWDL3.1.2 A Source Deal, that is not linked to a Sales Deal, can be part of only one Liability Deal link.
  • SWDL3.1.3 A Sales Deal can be part of only one Liability Deal link. And business users should be able to build ad-hoc queries in a query tool like MSQuery.
I'd really appreciate if you could please help me with the database design.

Requirement SWDL3.1.1 can be dealt with using a unique constraint.

Requirement SWDL3.1.3 can also be dealt with using a unique constraint.

Requirement SWDL3.1.2 is a bit more of a challenge. Because it requires knowledge of another table's relationships (whether there is a Sales Deal for a given Source Deal), it would need to be implemented as a trigger instead of a constraint.

I don't see any relationship between the requirements and the ability to use any particular query tool. Regardless of how these requirements are implemented, the user should be able to use any query tool that suits them (and is permitted/supported by corporate policy).

For More Information

Dig Deeper on Oracle and SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.