Tag Info

New answers tagged

0

What is it we are trying to get to here? Do you want to list out all the outfits (combinations of shirts, belts, and pants) a user can wear? Or just what they have worn for a particular day? Sorry, I'm not following the needs for the three relational tables (user_shirts, user_shirts_pants, user_shirts_pants_belts). I would just have one table for each item ...


0

Here is an example how to bring an unnormalized table into first normal form http://www.1keydata.com/database-normalization/first-normal-form-1nf.php


3

The optimizer makes choices based on costing estimates. The cost model is generic, and may not always choose optimal plans for your particular hardware, and its assumptions may not always be valid for your circumstances. In this case, the optimizer assesses a hash join as the cheaper option over nested loops when the estimated number of rows to be joined is ...


5

I think this can be done with an additional column (say Day) that will be allowed to hold only 2 possible values (1 and 2). Assuming a team cannot be in 2 or more stores in the same date, then you could have a UNIQUE constraint on (Team, Date) and another on (Cycle, Team, Store, Day). The constraints would be: UNIQUE CONSTRAINT uq_1 (Team, Date), ...


1

My team once had to build a database for reporting financials with alternative time windows, including fiscal years, fiscal quarters, and fiscal months. The relationship between dates and these units was documented, but really messy. So here is what we did. We created a table, call it Almanac, with one row per date. (In reality, we had one row per work ...


1

As far as I understand the theory, if you can join your decompositions and arrive back at your relation with no loss, that's it. It looks to me like AB, A, B, F, D are the keys to do so.


0

The following two FD's violate 2NF: A->C B->D We can create new relationships based upon those FD's: (AC;A->C), (BD;B->D), (ABE;AB->E). This set of relationships now satisfies 2NF (and also 3NF and BCNF).


1

The accepted answer is incorrect; the answers given by @sqlvogel and @gbn are correct. Surrogate keys are non-domain-driven keys that stand-in for natural keys (those with functional dependencies that derive from the domain). For instance, we might have a table with independent, non-overlapping keys (a table named People with id, ssn, and email as keys). ...



Top 50 recent answers are included