Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The non-descript error 150 is usually related to foreign key data type or length mismatches, or a missing index on the parent table's column.</p> <p>This look s to be a matter of case sensitivity in the table name <code>Bill_Header</code> (should be <code>BILL_HEADER</code>).<br> <a href="http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html">From the MySQL docs on identifier case sensitivity:</a></p> <blockquote> <p>In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory (and possibly more, depending on the storage engine). Consequently, the case sensitivity of the underlying operating system plays a part in the case sensitivity of database and table names. This means database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix.</p> </blockquote> <p>Fix the case and it should work:</p> <pre><code>CREATE TABLE TOS.BILL_ITEM (Bill_No Char(10), BSeq_No INTEGER, Toy_Id Char(10), OTime DateTime, Quan INT, DCondition Char(1), PRIMARY KEY(Bill_No,BSeq_No), FOREIGN KEY(Bill_No) REFERENCES TOS.BILL_HEADER(Bill_No), # Here-----------------------------^^^^^^^^^^^^^^ FOREIGN KEY(Toy_Id) REFERENCES TOS.TOY(Toy_Id)); </code></pre> <p>Since your code worked as is at SQLFiddle.com (<a href="http://sqlfiddle.com/#!2/08d1e">http://sqlfiddle.com/#!2/08d1e</a>) the underlying platform there must not be case-sensitive.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload