Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Why do yo use several fields for a primary field (also known as a "composite primary field") ?</p> <p>Some schools and books teach to use "Composite Primary Keys", but in reality, they are not a good idea. Many software does not allow these fields, and even if it does, it's difficult to handle.</p> <p>Is always better to use a single field primary key.</p> <p>My suggestion, is to keep those fields as standard fields, or foreign keys, an <strong>add a new field</strong>, that is assigned or incremented automatically.</p> <p>Example:</p> <pre><code>&lt;Table Name="Screen"&gt; &lt;Column Name="ScreenKey" Type="System.Int64" IsPrimaryKey="true" CanBeNull="false" UpdateCheck="Never" /&gt; &lt;Column Name="ScreenField1" Type="System.Int64" IsPrimaryKey="false" CanBeNull="false" UpdateCheck="Never" /&gt; &lt;Column Name="ScreenField2" Type="System.Int32" IsPrimaryKey="false" CanBeNull="false" UpdateCheck="Never" /&gt; &lt;Association Name="Screen_Pixel" Member="Pixels" ThisKey="ScreenKey" OtherKey="ScreenKey" Type="Pixel" /&gt; &lt;/Table&gt; &lt;Table Name="Pixel&gt; &lt;Column Name="PixelKey" Type="System.Int64" IsPrimaryKey="true" CanBeNull="false" UpdateCheck="Never" /&gt; &lt;Column Name="ScreenKey" Type="System.Int64" IsPrimaryKey="false" CanBeNull="false" UpdateCheck="Never" /&gt; &lt;Column Name="PixelField1" Type="System.Int64" IsPrimaryKey="false" CanBeNull="false" UpdateCheck="Never" /&gt; &lt;Column Name="PixelField2" Type="System.Int32" IsPrimaryKey="false" CanBeNull="false" UpdateCheck="Never" /&gt; &lt;Column Name="PixelField3" Type="System.Int32" IsPrimaryKey="false" CanBeNull="false" UpdateCheck="Never" /&gt; &lt;Association Name="Screen_Pixel" Member="Screen" ThisKey="ScreenKey" OtherKey="ScreenKey" Type="Screen" IsForeignKey="true" /&gt; &lt;/Table&gt; </code></pre>
 

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