Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Primary Key as a Foreign Key

Primary Key as a Foreign Key

Scheduled Pinned Locked Moved Database
databasequestiondesigntutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DotNet_Newbie
    wrote on last edited by
    #1

    Hello all, A quick question, I’m working on designing a SQL (7.0) database and for 37 of the tables I have 2 fields that are common between them and I’m using these 2 fields as the primary key for the 37 tables and also as the Foreign key to define the relations between these tables. For example: Project_ID1: part of the Primary Key Project_ID2: part of the Primary key Both of them together form the primary key for the 37 tables because they are the only unique fields within each table. And when I create a relation between 2 of the tables I use these same 2 fields as the foreign keys So, I would just like to get your opinion on if that is a correct design or not, I had some people telling me that this is a poor design? Thanks in advance

    S 1 Reply Last reply
    0
    • D DotNet_Newbie

      Hello all, A quick question, I’m working on designing a SQL (7.0) database and for 37 of the tables I have 2 fields that are common between them and I’m using these 2 fields as the primary key for the 37 tables and also as the Foreign key to define the relations between these tables. For example: Project_ID1: part of the Primary Key Project_ID2: part of the Primary key Both of them together form the primary key for the 37 tables because they are the only unique fields within each table. And when I create a relation between 2 of the tables I use these same 2 fields as the foreign keys So, I would just like to get your opinion on if that is a correct design or not, I had some people telling me that this is a poor design? Thanks in advance

      S Offline
      S Offline
      STW
      wrote on last edited by
      #2

      I didn't really understand right. Questions: 1. These 37 Tables do they all have the same Fields or what is different between them. 2. Do you store different Projects in different Tables? 3. Just show me the first 4 Fields of two Tables that I can understand. 4. What is the relation between the Tables? Database Design is more difficult than many people think. A good structure may help the developers. Please tell me more. Stefan

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups