Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Can someone explain me why key "Part1" contains Part1 and Part2, and what are good/bad side of this?</p> </blockquote> <p>As far as I can tell, it's just bad naming. As far as performance and data integrity go, the name here isn't important. It <em>might</em> be troublesome if you later need to drop it by name. </p> <p>Like Gordon Linoff said, the key named "Part1_2" in your question can be dropped.</p> <blockquote> <p>Is it better to use FK on Part1/Part2?</p> </blockquote> <p>There are no unique constraints on either of those columns. MySQL will <em>still</em> let you reference them with a foreign key, but MySQL docs tell you not to do it. (Allowing that was a mistake; it's easier to document it than to fix it.) </p> <p><em>Key</em> in MySQL doesn't mean what it means in other SQL dbms. In <em>this</em> CREATE TABLE statement, <a href="http://dev.mysql.com/doc/refman/5.7/en/create-table.html" rel="nofollow">KEY is a synonym for INDEX</a>; it's not a synonym for UNIQUE or a shorthand for PRIMARY KEY. The only column in this table that can be safely referenced by a foreign key constraint is fID.</p> <blockquote> <p>Is there any performance difference using this on MyISAM and InnoDB table?</p> </blockquote> <p>InnoDB supports row-level locking, transactions, and foreign key constraints. MyISAM doesn't. I'd worry about those differences before I'd think about performance differences. It doesn't matter how fast it runs if your database gives you the wrong answers.</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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