473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

composite primary key

1
Hi Guys,

I am new to Database and Postgresql.

I created an ERD diagram to store information on students, parents, teachers and schools, part of my design instead of having address for each entity I create a new entity called address and contains a composite primary key from (studentID, partentID, techerID, schoolID), streetName, suburb, postcode and state:

• Student can have one or more Address
• Parent can have one or more Address
• Teacher can have one or more Address
• School can have one or more Address

I used this method avoid the redundancy for address, and I created the tables for each (student, parent, teacher, school, address) then I populated the tables with values using “INSERT VALUE” statement, but I have problem now when I am inserting values for address because I have enter the (studentID, partentID, techerID, schoolID) for each row and the issue is say for instance a studentID and prentID may have the address but for the teacher and school may have different address.

I designed the database to have a separate entity for address and with composite primary key from (studentID, partentID, techerID, schoolID), but after populating the values for the address table how do I know which address belongs to whom, because I have to have 4 IDs from the (studentID, partentID, techerID, schoolID), I am really confuse.

Thank you in advance.
Nov 3 '14 #1
0 2072

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Shaun Evans | last post by:
Is is possible to create a composite primary key on a table variable? Neither of these two statements are successful: DECLARE @opmcjf TABLE ( jobdetailid INT NOT NULL, cjfid INT NOT NULL,...
5
by: John | last post by:
Specifically for joint tables... tblStudents tblClasses tblClasses_Students Is it be good programming to use a composite primary key in tblClasses_Students (where the key is ClassID and...
18
by: Thomas A. Anderson | last post by:
I am a bit confused in creating a composite primary key. I have three table with two of the tables containing primary keys. I have two of the tables (each with a primary key) having one to many...
6
by: mac | last post by:
Summary: 1. I want to define a column in anMS Access table to be lookups on other tables. 2. The table that is the data source (e.g the "parent" table) has a composite primary key. 3. When...
3
by: bvdrsganesh1981 | last post by:
Hi Can We Create a Foreign Key Relation in Table1 with a Table2 Table 2 having Composite Primary key with columns T2Col1,T2Col2,T2Col3, T2Col4 where first 3 columns are composite primary...
7
by: Ronald S. Cook | last post by:
My client manager likes concatenated/composite primary keys. I don't. Can anyone forward any arguments pro or con? Thanks, Ron
1
by: mallz | last post by:
hi, i have two tables: table1: mid,name table2: mid,did,location now, i need to increment against a particular mid value.... how can that be done? please help.
4
by: Wolfgang Keller | last post by:
Hello, so far it seems to me as if the only ORM module for Python which supports composite primary/foreign keys was SQLAlchemy. Which looks a little bit "overbloated" for my needs: I "just" need...
1
by: Madhususdhan | last post by:
Hellow, I am new to MS SQL Server and I have been designing a database for my company. I am using Microsoft Visio for desigin and in my database design, I am planning to use composite primary key for...
3
by: emilyjac | last post by:
Hi. I have a junction table with a composite primary key (ie. two field are used to define the primary key). I need link a third table to the junction table in a one to many relationship. In the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.