sql, Query
Hark ye experts!

Here I stand an expert grunt.
Trying to understand,
The syntax of constraint.

I was directed to the constraint doc.
And found the constraint doc doth suck.

Here's my ploy, renewed, refined.
Please see if you can help.

To create my Foreign table I used the following script

CREATE TABLE IIM_InventoryItemMaster(
IIM_InventoryItemMaster_ID MEDIUMINT(8) NOT NULL,
IIM_ItemNm VARCHAR(64),
IIM_ItemDescCD VARCHAR(1) DEFAULT 'U',
IIM_GenderCD VARCHAR(1),
IIM_ItemPN VARCHAR(36),
IIM_Spec1Nm VARCHAR(48),
IIM_Spec2Nm VARCHAR(48),
IIM_RecordCreatedBY VARCHAR(24),
IIM_RecordCreatedDT DATETIME,
IIM_LastEditBY VARCHAR(24),
IIM_LastEditDT DATETIME,
PRIMARY KEY(IIM_InventoryItemMaster_ID),
KEY(IIM_GenderCD),
KEY(IIM_ITEMNm),
KEY(IIM_ItemDescCD),
key(IIM_ItemPN)
)
        Type = INNoDB;

Then SHOW CREATE TABLE Told  me the table type
is MyISAM. Don't I need InnoDB to use Constraints?

Does INNoDB cause it woe?
<===============================================================>
Now for some clear and Poignant questions about MySQL hell?
<===============================================================>
>From the following URL:http://www.mysql.com/doc/en/CREATE_TABLE.html
I found Constraint docs
<===============================================================>
[CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
[reference_definition: REFERENCES tbl_name [(index_col_name,...)] [MATCH 
FULL | MATCH PARTIAL] [ON DELETE reference_option] [ON UPDATE 
reference_option]
<===============================================================>

Question I.
If there is a Foreign Key in a Foreign Table, then there must be a Native 
key in a Native Table.
What is the correct technical name of the {Native} Field?

Question II
I understand CONSTRAINT symbol to be the name of the constraint.
true or false?

Then there is FOREIGN KEY [index_name]
        What Index_name, The name of the Foreign Key field's Index
        (located in the Foreign Table?)
        So this is the name of an index in the Foreign Table?

Question III.
Then comes (index_col_name,...)
I guess this means the name of the Foreign Key Field(s)?
true or false;

Question IV.
Next comes REFERENCES tbl_name. [(index_col_name,...)]
The name of the Native Table or he Fireign Table?
[(index_col_name)], This must mean the name of the Foreign Key Field(s) 
AGAIN?
true or false

Question V.
I suppose I should include the Constraint syntax in the SQL that creates the 
Native Table and not in the SQL that creats the Foreign Table?
True or false?

Thanks for your help
Jim Bailey





_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to