473,396 Members | 1,859 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,396 software developers and data experts.

creating foreign key..

Hi
I have problem in creating foreign keys in mysql.
I created the tables first. Then used the "Alter Table"
command to associate a foreign key.
"alter table answer add foreign key(QId) references query (QId);"
The command was executed successfully.
But when I used the "show create table answer" command,
I couldnt find the created foreifn key.
The screen output was like following..
------------------------------------------------------
| answer | CREATE TABLE `answer` (
`AId` int(11) NOT NULL default '0',
`QId` int(11) default NULL,
`AnsweredBy` text,
`Answereddate` date default NULL,
PRIMARY KEY (`AId`)
) TYPE=MyISAM |
-------------------------------------------------------
So I think the key was not created.
Can anyone help me in this.
I am using mysql4.1, Windows Xp home edition.
Ramesh.
Jul 19 '05 #1
3 1229
You can't create a foreign key with this type of table.
MyISAM type table don't allow you to add an extern key.
You must use InnoDB table
bye Estevan
Jul 19 '05 #2
You can't create a foreign key with this type of table.
MyISAM type table don't allow you to add an extern key.
You must use InnoDB table
bye Estevan
Jul 19 '05 #3
You can't create a foreign key with this type of table.
MyISAM type table don't allow you to add an extern key.
You must use InnoDB table
bye Estevan
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ahk | last post by:
Hi, As above. The error I got is "ORA-00942: table or view does not exist". Any ideas? TIA.
3
by: bk3 | last post by:
I'm having a bit of a problem creating foreign keys on a MySQL database. The tables create and everything seems to be fine. But I just wanted to test out adding a row to one of the child tables...
2
by: Kamlesh | last post by:
Hi, I am using SQL Server 7.0 TABLE1 ====== Fld1 Fld2 Fld3
5
by: Barbara Lindsey | last post by:
Thank you for your help on the trigger question. The RULE worked for most of the cases I had for this, but I have one that is giving me trouble. Here are my table definitions: CREATE SEQUENCE...
8
by: Brian S. Smith | last post by:
Hi gang, Please help. I've been through the Access help, searched the Web, and I can't seem to get a straight answer. As the Subject line suggests, I want to run a fairly simple VB/Access Sub...
5
by: Peter Erickson | last post by:
I am running postgresql 7.4.2 and having problems creating a trigger function properly. I keep getting the following error: ERROR: OLD used in query that is not in rule I have a table called...
2
by: Ian Davies | last post by:
I have created a database with about 17 tables. I have been creating foreign keys some of which have worked but when creating others I get the message below ************************* 1005...
5
by: John | last post by:
I have 2 tables, one with dates and information about those dates, and one with people information. I want to create a report listing each date and the people who attended on that date (who have...
2
by: astolpho | last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output: ...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.