Note that there are some explanatory texts on larger screens.

plurals
  1. PODatabase design help
    text
    copied!<p><pre><code> CREATE TABLE <code>cards</code> ( <code>id</code> INTEGER(1) NOT NULL AUTO_INCREMENT, <code>name</code> VARCHAR(50) NOT NULL DEFAULT 'NULL', <code>expire</code> DATETIME NOT NULL DEFAULT 'NULL', PRIMARY KEY (<code>id</code>) );</p> <p>CREATE TABLE <code>services</code> ( <code>id</code> INTEGER AUTO_INCREMENT DEFAULT NULL, <code>name</code> VARCHAR(50) NOT NULL DEFAULT 'NULL', PRIMARY KEY (<code>id</code>) );</p> <p>CREATE TABLE <code>shops</code> ( <code>id</code> INTEGER AUTO_INCREMENT DEFAULT NULL, <code>name</code> VARCHAR(50) NOT NULL DEFAULT 'NULL', PRIMARY KEY (<code>id</code>) );</p> <p>CREATE TABLE <code>card_transactions</code> ( <code>id</code> INTEGER AUTO_INCREMENT DEFAULT NULL, <code>id_card</code> INTEGER(1) NOT NULL, <code>funds</code> DOUBLE(6,2) NOT NULL, <code>timeCET</code> DATETIME NOT NULL, <code>id_shops</code> INTEGER DEFAULT NULL, <code>id_services</code> INTEGER DEFAULT NULL, <code>id_payment_systems</code> INTEGER DEFAULT NULL, <code>user</code> ENUM('y','n') NOT NULL, PRIMARY KEY (<code>id</code>) );</p> <p>CREATE TABLE <code>payment_systems</code> ( <code>id</code> INTEGER AUTO_INCREMENT DEFAULT NULL, <code>name</code> VARCHAR(50) NOT NULL, PRIMARY KEY (<code>id</code>) );</p> <p>CREATE TABLE <code>shop_sales</code> (<code> <code> <code>id</code> INTEGER AUTO_INCREMENT DEFAULT NULL, <code>id_shops</code> INTEGER DEFAULT NULL, <code>delivery_price</code> DOUBLE NOT NULL, sales price</code> DOUBLE NOT NULL, PRIMARY KEY (id</code>) ); </pre></code></p> <p>Sorry i have an image but can't post it. So i post the code.<br /> Is this a good db design? Would it be better if replace the last four columns from card_transactions table with for example reference_id and put them in new table called reference?</p>
 

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