We have an operational data store (ODS) that gets loaded nightly from the OLTP system. One of the tables we load...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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.
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
- Dozens more answers to tough database design questions from Pat Phelan
- The Best Database Design Web Links: tips, tutorials, scripts, and more
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your database design questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Related Q&A from Pat Phelan
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.