473,671 Members | 2,283 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 5333
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
6572
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 about 100 records and a field.status=1 in a existing_table and i want to create a temp_table with all the recordse and values of the existing_table and then update the field.status to 2 and insert in 1 query the temp_table in the existing_table
3
2029
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 some MySQL to create the first table: the players table. It will need to include (as a minimum): - ID (unique)
2
3843
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
1805
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 dropped? I was thinking of renaming the fields somehow, then using sql to add /drop? Please give an example.
2
22109
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 of syntex error too. How can i create a DBF table with proper indexing ability ?? The "UNIQUE" keyword has already been proved to be failed to perform normally. Please help string sql = "CREATE TABLE datafile (field1 C(10) PRIMARY KEY, field2...
2
11069
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 can I do this via VBA ? Rgds, Prakash.
1
3654
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 body having code plz send it.
3
4920
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 ADODB.Connection objADOConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Database\abc.mdb;User Id=admin;Password=;") objCatalog = New ADOX.Catalog objCatalog.ActiveConnection = objADOConnection ...
1
1514
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 peace Friede ... 2. luce luz light Licht ... 3. rege rei king König ...
0
1347
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 student. Each user have some similar info (user id, password, email, contactno, status) and some different info to be stored(e.g. department, class, section, etc). All will login to website.
0
8474
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8392
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7428
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2049
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.