CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2010
    Posts
    5

    3 tables, common schema

    I need to create 3 database tables: Male Names, Female Name and Surnames. Each of these tables will have exactly the same fields: Name, Frequency, and Rank. What's the best way to implement this in C# / .NET?

    1) Create 3 tables within the same database and give each the same fields. Probably the easiest to do initially but it would result in 3 separate schema.

    2) Create a single table and save the data in 3 separate database files. Connection strings are easy enough to change at runtime, but this seems a bit extreme.

    3) Put all data into a single table and add a field to specify what type of name it is. This will slow down searches and it also means I can't use rank as the primary key, should I want to.

    4) A better method that I don't know about yet.

    Cheers!

  2. #2
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: 3 tables, common schema

    I would go for option 3. Create a single table, use the rank and type of name as primay key. And if you create the correct indexes, it won't slow down searches..

  3. #3
    Join Date
    Dec 2007
    Posts
    234

    Re: 3 tables, common schema

    What is "Rank"? I'm not sure that's a good candidate for being a PKey... I'd be more inclined to use Name and NameType as the PKey...

    -tg
    * I don't respond to private requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help - how to remove eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to???
    * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming.
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN
    MVP '06-'10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured