473,511 Members | 16,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a composite entity table in SQL?

1 New Member
Here's my code:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE SALARY
  2.     (
  3.     JOB_ID INT NOT NULL,
  4.     MP_ID INT NOT NULL,
  5.     SALARY_AMOUNT MONEY,
  6.     CONSTRAINT pk_SALARY
  7.     PRIMARY KEY (JOB_ID, MP_ID),
  8.     FOREIGN KEY (JOB_ID, MP_ID) REFERENCES JOB JOIN MP ON UPDATE CASCADE
  9.     );
So the both PKs and FKs come from 2 different tables, everything is working until the foreign key, the part where we have to reference. How do you reference the 2 different tables where the FKs are found? I tried using JOIN but it doesn't work.

Help please, I'm new to SQL.

P.S.
I've made both tables already so this is a new table under the same database. Thanks!
Jun 6 '13 #1
3 5300
fridrai
9 New Member
if u are using the phpmy admin editor, u can access to the relational view on the bottom of the table, click on, then you'll find the column of the forein key with two choices, so that u can add the index to the mentionned entity
Jun 6 '13 #2
Rabbit
12,516 Recognized Expert Moderator MVP
If the two fields reference two different tables, you need to create two foreign keys, not one.
Jun 6 '13 #3
Frinavale
9,735 Recognized Expert Moderator Expert
It would really help if you had a foreign key to the table where MP_ID existed.

It would also help if you posted the select statement that you have tried so far so that we can help you correct any mistakes that you may have made in the statement.

-Frinny
Jun 6 '13 #4

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

Similar topics

6
6560
by: dev | last post by:
how create a temp table as a copy of a existing table and then update1 field and insert the hole temp table back in the existing table? please any help? if i have 10 fields in 1 record and...
3
2015
by: Michael Lauzon | last post by:
This is not for a class, I have a group on SourceForge, this is what one of the Developers is asking; the more advanced you can make it right off all the better!: Can someone please create...
2
3827
by: Andreas | last post by:
Hi, can someone tell me how i do create a jump table in c or c++ ? I tried this: void f() { void *jump_table = { label1,
6
1800
by: Jim's wife | last post by:
Hi all I need to create a new table based on a source table. The new table is almost the same as the source table in that just some field names must change, and a few new fields added or...
2
22087
by: Maverick | last post by:
If i try to create foxpro table by the following "sql" statment, the C# compiler will only return an error "xxxx not support in non-dbc version". The "index on" command statement return some kind...
2
11056
by: prakashwadhwani | last post by:
I have an app with a Front End and a Back-End. My date field is INV_DATE I would like to copy all data with year(inv_date) 2005 to a temp table in both, the front end & the back end. How...
1
3610
by: shyamg | last post by:
how to create a dynamic table in jsp. This is i hava some text fields that text field data will be add in the table same jsp . in that page table can .add.update delete buttons i want. any...
3
4911
by: Vee007 | last post by:
Following is my code: Dim objCatalog As ADOX.Catalog Dim objTableLink As ADOX.Table Dim objADOConnection As ADODB.Connection Try objADOConnection = New...
1
1503
by: cardeal | last post by:
Hi! I have a long field on a mysql table and I would like to create a new table (from the old one) with the (new) content distributed into several fields. Example: oldField: 1. pace paz...
0
1334
by: silwar | last post by:
Qusetion 1 I am developing a website mainly for maintaining students record in asp.net and using sql server 2005 database as backend. These site has three types of user Admin, faculty and...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7081
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
7510
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...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.