Table design help

I have simple table design issue which I would appreciate some feedback on. Lets say I have two tables to start: users and addresses. Both tables have their primary keys of userid and addressid. Assume no two users can share an addresss.
Is it better to have the userid in the address table, so as to associate the addresses to users OR is it better to have a third table only for associating userid's and addressid's? The latter requires an extra table but appeals to me more because the address table remains purely addresses... seems more appropriate for some reason, but I could be wrong.
Thanks

Frank Kulash wrote:
Hi,
When deciding which is the best option, weigh the costs and benefits of each option. What are the advantages and disadvantages of each?
The two-table model is certainly simpler. Joins will be more efficient, and slighltly less storage will be required.
What is the advantage of the three-table model? Why does it appeal to you? In the imaginary world where no two users can share an address, it makes sense to think of resident as an attribute of address. Each address can be related to (at most) one user, just like each address can be related to (at most) one postal code.
But, as others have said, that is an imaginary world. Even if you're designing an application where you know there is some kind of business rule that prevents two users from being at the same address, can you be sure that business rule won't change next month?
So I see the relevant costs ot the two-table design as: (the probablility of proving inadequate in the future) * (cost of re-writing all the queires based on the two-table design)
I see the costs of the three-table design as: extra time needed to write and execute joins + marginal costs of an additional table.
In practice, few applications really treat address as an entity. It's more common for address to be considered an attribute of the person, or, if a person can have multiple addresses, to have a separate table that links each address to a single person, with no attempt to minimize duplicates.You make two key points here that I'd like to highlight, just for re-emphasis to the OP.
The first is that business rules can change. When analyzing data relationships, one should always ask if the relationship definition is immutable or simply a reflection of the current business rule. For instance, gender is considered to be immutable. If gender is a property of the entity being tracked, you can pretty much figure that there will never be but two possible values, and only one value current at any given time. But if the business rule says an entity can only have one address ... that rule is definitely subject to change. So the design should be such as to already allow for a different rule. I spent 21 years at an auto manufacturing plant. When the plant was first built, the business rule was there would only be one line of vehicles, and only one shift a day. The IT people tried to build systems to allow more flexibility, but the business side said NO. They paid for that for the next 20 years. In the case of the OP's example, it is most definetly possible for a person (or business) to have more than one address, and it is just as possible for more than one person (or business) to share a single address. The system should be designed for that regardless of the business rule.
The other big point is that data designers need to pay close attention to what constitutes an "entity" vs. an "attribute". Making that distinction is key to getting a good 3NF design.

Similar Messages

  • TABLE DESIGN

    Hi I have this business rule which makes my table design very complex(at least for me)
    My application keeps track of all the patients who are admitted to the hospital with some diagnosis(disease) like TB,asthma,Heart attack etc.Also my application is suppose to keep track of any procedure (operations) like Heart transplant,heart surgery etc performed on the patients.Later,depending upon the diagnosis and procedure ,the patients are clubbed under one group (help is needed to create the table for this group).
    To satisfy my requirements I create a the following tables
    DIAGNOSIS
    Diagnosis_code pk
    Diagnosis_Desc
    PROCEDURE
    Procedure_Code pk
    Procedure_Desc
    Now I am confused on how to create the table for patient group.I mean if any patient is suffering from a diagnosis like heart attack and has undergone a procedure like Heart transplant then this kind of patient should be clubbed under the group say XYZ.Similarly if any patient is suffering from TB and has undergone a procedure like Kidney transplant then he should be clubbed under the group say ABC.In short for every patient in the hospital this table is read to club the patient under certain group.Example
    PatientGroup1 SomeDiagnosisCode1 SomeDiagnosisCode2 SomeProcedureCode1
    PatientGroup2 SomeDiagnosisCode1 SomeProcedureCode6
    PatientGroup3 SomeDiagnosisCode8 SomeProcedureCode9 Some DiagnosisCode6
    etc etc
    Please help with the design of the Patient group table.
    thanks
    MS

    Depends on a few factors ...
    The most flexible (that I can think of right now) design would be as follows:
    DIAGNOSIS
    diag_id
    diag_desc
    PROSEDURE
    proc_id
    proc_desc
    PATIENT
    patient_id
    patient_name
    PATIENT_DIAG -- associates zero, one, or more diagnosis with a patient
    patient_diag_id
    patient_id
    diag_id
    PATIENT_PROC -- associates zero, one, or more procedures with a patient
    patient_proc_id
    patient_id
    proc_id
    DIAG_PROC_CAT -- identifies a Group
    diag_proc_cat_id
    diag_proc_cat_desc
    DIAG_PROC_CAT_DIAG -- associates zero, one, or more diagnosis with a Group
    diag_proc_cat_diag_id
    diag_proc_cat_id
    diag_id
    DIAG_PROC_CAT_PROC -- associates zero, one, or more procedures with a Group
    diag_proc_cat_proc_id
    diag_proc_cat_id
    proc_id
    PATIENT_DIAG_PROC_CAT -- associates zero, one, or more Groups with a patient
    patient_diag_proc_cat_id
    patient_id
    pdpc_precedence_nmbr -- (1=highest ... don't need it if you're only gonna allow one association)
    diag_proc_cat_id
    Put the business rule code in TRIGGERs for PATIENT_DIAG and PATIENT_PROC to INSERT appropriate values into PATIENT_DIAG_PROC_CAT ... INSERT proper rows into DIAG_PROC_CAT, DIAG_PROC_CAT_DIAG, and DIAG_PROC_CAT_PROC tables to support business rule (if patient has same diagnosis and procedures as a Group/Category, then assign that Group/Category to the patient ... if more than one applies, you may or may not allow it ... if you do, indicate which is primary if doubling on reports/ui is a bad thing) ... Users may modify DIAG_PROC_CAT, DIAG_PROC_CAT_DIAG, and DIAG_PROC_CAT_PROC tables as needed to manage their own Groups/Categories.
    Good luck.

  • Advise on Table design

    Dear all,
    I have a pool of data which are based organized has CATEGORY and SUB-CATEGORY. When I am configuring the database I should be able to define all categories at once, then being able to define which one is the Parent category of the others.
    For exemple if I have a set of Dishes for a restaurant, then I can classify those dishes in different menu category which are then the Parents category for dishes.
    Please note that a SUB-CATEGORY can have other sub categories attached.
    To have a better idea of what I am trying to do is similar things when you create folders and sub folders on a file system. From the configuration side of the database I should be able to define my category and subcategories and then organize them by a link
    ID or other stuff, in the same way I will organize folder.
    What will be the best Database table design for that scenario ?
    I am not a DBA, but have some basis so try to speak the same language as me :-)
    Thanks for help
    regards

    I think you have it with your design. There are a few ways to represent a hierarchy in SQL, and having two tables like this:
    CategoryID    CategoryName   
    ParentCategoryID
    1001         
    Dishes          NULL
    1002          Desserts       
    1001
    1003          Icecream          
    1002
    SubCategoryID    SubCategoryName   
    CategoryID
    10001                  
    Vanilla                     
    1003
    10002                  
    Strawberry              
    1003
    10003                   Butterscotch             1003
    Make sense ONLY if you can guarantee a two level hierarchy (or a fixed number of levels, where you might have yet another table SubSubCategory). Having a fixed number of levels can make processing a ton easier because your queries can be written in
    a straightforward manner because the levels of nodes in the tree  remain the same.
    Your requirements here:
    "CATEGORY can have other sub categories attached."
    Leads to the more flexible solution like you have set up:
    CategoryID    CategoryName   
    ParentCategoryID
    1001         
    Dishes          NULL
    1002         
    Starters       
    1001
    1003         
    Item1          
    1002
    1004         
    SubCat1        
    1003
    1005         
    SubCat2        
    1003
    1006         
    SubCat3        
    1003
    Because adding a subcategory on SubCat3 is as simple as:
    1007          SubSubCat1        
    1006
    Processing the hierarchy becomes an iterative process (using a recursive CTE) if you have needs to do a lot of aggregation on groups. There are techniques available to make things go faster than using this pattern in the implementation, but unless
    you are going to need 1000s of nodes, then this pattern works great (known as the adjacency list, where you are basically storing the adjacent node in your tree).
    Louis
    Without good requirements, my advice is only guesses. Please don't hold it against me if my answer answers my interpretation of your questions.

  • Cannot open table designer

    Hi!
    I am creating an ASP.NET Web Form hosted on Azure with Visual Studio 2013 Community. When I want to add a table to the database, SQL
    Server Object Explorer->SQL server->Database->Table folder->Add, is trying, but won't open the table designer. It says: "Failed to obtain schema information from database DatabaseName. Please close any open editor for this database, check
    your connection to this database, and refresh the database in Server Explorer". Well I didn't find any other open editor...What should I do?
    Thanks!

    Hi GSeriousB,
    As per your description, you fail to add a table using visual studio 2013.  Please help to post the full error messages.
    As my analysis, besides the reason that the login account has no permission to the specific database according to Uri’s post, the issue could be also caused by the SQL Server Data Tools (SSDT) query timeout.
    To work around your issue,  please make sure to provide your login account the permission to the database, such as ‘db_owner’ database role and increase SSDT query timeout value following the steps below:
    1.In SSDT, from the Tools menu, select Options.
    2.In the Options pane, expand Business Intelligence Designers.
    3.Click the Query Timeout text box, and type the value for the number of seconds, such as 600 seconds.
    For more information about the process, please refer to the article:
    http://msdn.microsoft.com/en-us/library/bb895188(v=sql.120).aspx
    Regards,
    Michelle Li

  • Table rulings - help!

    I'm working in Framemaker 7.0, running on XP, and have a problem with a particular table. It runs across multiple pages and I need an outside border at the end of each page. I've already goofed around with settings in Table Designer (where it says: Draw Bottom Ruling on Last Sheet Only)and in Custom Rulings and Shading, but can't seem to figure out why it won't put a border at the end of each page.
    PS. This is a document created by someone else awhile ago.
    Any help is greatly appreciated!

    Anita,
    I make tables all the time and they all display a border at the bottom of the page. Try this to get back to square one:
    In the Table Designer CLEAR the Draw Bottom Ruling on Last Sheet Only box, that is UNchecked.
    Select the entire table, and select the menu Table > Custom Ruling & Shading.
    In the dialog box, CHECK all boxes and select From Table in all lists and dropdowns.
    Click Apply.
    This makes all the rules and shadings match what the table style dictates. If some cells requires special rules and shadings, then you have to select those cells and use the custom rules and shadings box to set them the way you want.
    I am guess that maybe the previous writer gave some rows no rules and that is where the page is breaking, but just a guess.
    There should always be a rule at the bottom of the page unless you check Draw Bottom Ruling on Last Sheet Only in the table designer OR add custom borders of none at the row where the page breaks.
    Good luck,
    Van

  • Design Help! Add new lines

    Hi All,
    I need a design help for adding extra lines on an existing order.
    I have a page with 2 subtabs, first one is for order header info inputs and second one is for line info inputs. The line subtab base on user selection may generate mutile lines in lineVO (multiple rows). After user clicked an apply button on line subtab, a header row will be committed into header table and line row(s) will be in line table.
    I was trying to have another button to allow user enter extra lines after committed existing header and line VO. After user click the "add extra line" button, I retain AM to keep header VO but flush out line VO, with this way, framework will try to delete lines in line table.
    Since there are lots logic requirements, I can't keep adding lines after line VO.last() without committing first round line entering.
    How can I keep Header VO, clean line VO, then enter new line(s) info as ADD but not DELETE/UPDATE? any suggestion??
    Thanks & Regards,
    KJ

    Hi Shreya,
    I am not sure about giving new line in each and every page, but there is an alternate. You can show all data in one single page. That is how much ever records you have, they will be shown on one single page, instead of spanning across multiple pages. You can achieve this by changing the property "Number of Data rows displayed at once" from default 100 to 0.
    Hope it helps.
    Regards,
    Arunan.C

  • "Simple" table design?

    I have a very simple table design I need to set up, yet every setting I've tried is vexing me.
    Table requirements:
    1. Header with bold white text and black fill
    2. Alternating rows, every 2, after header of a different fill color
    3. All table text, excluding header, of a specific style
    4. Row strokes to be after every 2nd row, to separate the different fill colors
    I set up the following:
    A table style with the alternating 2 row fill colors, and row strokes as: Every other row, first 1 row weight 2 pt white, next 1 row weight 0 pt, white, SKIP FIRST 1 ROWS
    A paragraph style for the table text to set the font attributes
    This setup gives me exactly what I need, except it puts a black row stroke after my first row after the header.  I just want the first row stroke to be after the 2nd row (or 3rd row, if you count the header).  But it's like it keeps including the header.
    ALSO:
    I would like to be able to set the header, row heights, left indent, etc., for my tables, but there is nowhere to do that in the table style.  Very frustrating, because you can do it manually in the toolbar or menu bars (table options that are not available in the style), and then it overrides your styles.
    I have a feeling this may be based on not understanding how table style, paragraph style, cell style and character styles, along with their "based on" settings coincide, but there are far too many combinations of those for me to grasp at this time.
    Thanks for any help.
    Mike

    Figured it out, but I'd still like to know how to adjust ROW HEIGHT and COLUMN WIDTH in my table styles.  It appears that if you highlight a row or table, and then change those settings in the upper toolbar, that it does not affect the style.  But that's an arduous manual way to have to do it.  I would think these settings could be automated somehow. Thanks.

  • Table Designer third rule thick is not working for me.  Any suggestions?

    I am trying to turn the third rule in a four row table thick. I go into Table Designer and select Every 3rd Thick.  The others are all none.  The table is not responding to the command to make the third rule thick as I need it to be.  Does anyone have any suggestions?  Thank you.

    To remove table format overrides, you need to go to Table > Format > Custom Ruling and Shading, and set as follows:
    For more info, see page 171 of my book.
    -Matt
    Matt R. Sullivan
    co-author Publishing Fundamentals: Unstructured FrameMaker 11

  • FND tables design

    Hi,
    I was going through FND Design Data section on eTRM website .
    I need to understand a few things about table design here.
    I was surprised to see one composite primary key and one composite unique key instead of primary keys in single columns(concurrent_queue_id,concurrent_program_id and concurrent_processor_id) in the following tables
    FND_CONCURRENT_QUEUES -- Primary Key: FND_CONCURRENT_PROCESSORS_PK(columns:application_id,concurrent_queue_id)
                   Primary Key: FND_CONCURRENT_PROCESSORS_UK1(columns:application_id,concurrent_queue_name)
    FND_CONCURRENT_PROGRAMS -- Primary Key: FND_CONCURRENT_PROGRAMS_PK(columns:application_id,concurrent_program_id)
                   Primary Key: FND_CONCURRENT_PROGRAMS_UK1(columns:application_id,concurrent_program_name)
    FND_CONCURRENT_PROCESSORS -- Primary Key: FND_CONCURRENT_QUEUES_PK(columns:application_id,concurrent_processor_id)
                   Primary Key: FND_CONCURRENT_QUEUES_UK(columns:application_id,concurrent_processor_name)
    Let's consider FND_CONCURRENT_QUEUES table for instance.
    As per my understanding, concurrent manager name and id has to be unique throughout the suite.
    But, by decalring them as composite primary/unique key with application_id column,Oracle is saying that the uniqueness of concurrent manager's id and name is maintained across one particular module(application like AP,GL etc) only and not across the entire suite.
    Is that actually the case?
    Also,this concurrent_queue_id column is used as foreign key for many tables.
    Now, for a column to be used as a foreign key, it has to be either unique key or primary key itself alone(not a part of a composite key) in its parent table.
    In this case the column is a part of a composite primary key and still being referred from many tables as foreign key.
    Please clarify.Any additional comments on this are very welcome.
    I have exactly the same questions for the PROGRAMS and PROCESSORS(program library) tables as well.
    Thanks,
    Rushi

    http://etrm.oracle.com/pls/etrmlatest/etrm_search.search
    requires a metalink userid

  • I am using pages '09. I have been trying to put together a report and I am using tables to help keep my data in line. My data is free text and would like to footnote certain data as to it origin, but footnoting is grey-out. How can I footnote on table mod

    I am using pages '09. I have been trying to put together a report and I am using tables to help keep my data in line. My data is free text and would like to footnote certain data as to it origin, but footnoting is grey-out. How can I footnote in table mode inpages '09?

    Footnotes can only be inserted in the main text area between the margins on a Word Processing document.
    Peter

  • Unable to toggle between LiveCycle Designer & Help

    If we opened the LiveCycle Designer Help window, we are unable to switch to the Designer util the help window is minimized. This is slightly annoying the developers.
    It would be better if it can behave like other applications (e.g. Adobe Workbench ES)
    Thanks,
    Nith

    Charlie
    I am unable to duplicate the problem you are experiencing.  I was able to use Acrobat Pro 9 and X, to apply the Reader Extension permissions (to the sample form I posted earlier) and open and sign the form in both Reader 9 and X.
    What is the exact version of Acrobat you are using to apply the Reader Extension rights.  The dialog I see when doing so with Acrobat 9 Pro is...
    If you are using Acrobat Standard, it seems there is a limitation (save data only) on the Reader Extension permissions that you can apply.
    Regards
    Steve

  • F4-Help without using a table search help

    Hi,
    We´re using CRM 2007 and I have created several F4-Helps for different fields on the webui.
    There it was always necessary to use an existing table search help in the GET_V-method:
    CREATE OBJECT rv_valuehelp_descriptor
        TYPE
          cl_bsp_wd_valuehelp_f4descr
        EXPORTING
          iv_help_id                  = lv_help_id   "search help name
          iv_help_id_kind             = if_bsp_wd_valuehelp_f4descr=>help_id_kind_name
          iv_input_mapping            = lt_inmap
          iv_output_mapping           = lt_outmap
          iv_trigger_submit           = abap_true.
    But how can I create a f4-help without an existing search help. I have an internal table that I want to be shown like an f4-help (not as dropdown -> a dropdown-field wouldn´t be a problem).
    Structure of the internal table: COML_PROD_CAT_REL_F4
    Thanx for help.
    Greetings,
    Sven
    Edited by: Sven Keller on Aug 13, 2008 4:26 PM

    Hi Sven,
    you already pasted the correct call for creating a value help. Now what you have to alter is the variable lv_help_id to reflect a F4-Valuehelp class.
          CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_f4descr
            EXPORTING
              iv_help_id        = '(CL_CRM_UIU_BP_IDTYPE_2_F4)' "#EC NOTEXT
              iv_help_id_kind   = if_bsp_wd_valuehelp_f4descr=>help_id_kind_comp
              iv_input_mapping  = lt_inmap
              iv_output_mapping = lt_outmap.
    As you can see CL_CRM_UIU_BP_IDTYPE_2_F4 is a normal ABAP class implementing interface IF_BSP_WD_CUSTOM_F4_CALLBACK. Please take a look at it.
    It should not be very hard to implement the single method
    cheers Carsten

  • Fact table design horizontal vs vertical

    Hi Guys,
    I am putting together a list of advantages and disadvatages of horizontal vs vertical fact table orientation.
    Vertical:
    ID, DimensionKey1, DimensionKey2, Factno (or KPIDimensionKey), Fact
    Advantages:
    -Easily extendible when new facts are integration
    -A lot more rows
    -Density
    Disadvantages:
    -Applications that can only deal with the horizontal format require a few to
    transpose the rows into columns (additional computing time)
    Horizontal:
    ID, DimensionKey1, DimensionKey2, Fact1, Fact2, Fact3, Fact4, Fact5,...
    Advantages:
    -The most common fact table design
    -Possibly faster access
    Disadvantages:
    -Sparsity
    -Not easy to extend

    Do you agree or can add something?

  • Table design question

    Hello,
    I have a quick question on a table design. I currently have a table that will store approval information on a report. The individual report will need to go through 3 levels of approval before it's considered final. I have considered a few different scenarios on how to design the table but I'm not sure on what is the best choice. Currently I'm using 3 columns that will store each approval. For example,
    Table 1:
    file_id,
    subject,
    summary,
    division_approve,
    program_approve,
    group_approve
    I thought about using one column and simply stepping through a higher numeric value for each approval but found that doesn't work if I want to view items that were approved only at the division_approve level. Does anyone else have any suggestions? Hopefully I provided enough information.....
    Thanks in advance!
    Randy

    yes, better going for higher level of normalisation and desiging more tables:
    tab_aproval ( id,File_id,Approval_authority,rank )
    id      File_id Approval_level rank
    1     1 first_level 1
    2     1 second_level 2
    3     1 third_level 3
    4     2 first_level 1
    5     2 second_level 2
    tab_file_approval
    file_id, subject, summary, id
    1 'doc 1' 'first level done' 1
    1 'doc 1' 'second level done' 2
    1 'doc 1' 'third level done' 3

  • How do I total across multiple Tables? Help!

    how do I total across multiple Tables? Help!
    I feel like a complete noob.

    Hi Marc,
    There is no function explicitly for that sort of array calculation in Numbers.
    My favorite way is to use a list of Table Names and the INDIRECT(ADDRESS) function combination to produce a SUM across tables. I'm making the assumption that you want to do something like adding up all the values in a particular cell of multiple tables.  For example "give me the total of all the A1 cells in tables T1, T2, T3 and T4".  For this I would use the formula:
    =INDIRECT(ADDRESS(1,1,1,,A))
    to grab the cell contents of the table names mentioned in column A of a summary table.  Once you have them collected in your summary table, add them up.
    Here's a screen shot...
    Hope that gives you an idea for approaching this problem.
    Jerry

Maybe you are looking for