CREATE TABLE cards
(
id
INTEGER(1) NOT NULL AUTO_INCREMENT,
name
VARCHAR(50) NOT NULL DEFAULT 'NULL',
expire
DATETIME NOT NULL DEFAULT 'NULL',
PRIMARY KEY (id
)
);
CREATE TABLE services
(
id
INTEGER AUTO_INCREMENT DEFAULT NULL,
name
VARCHAR(50) NOT NULL DEFAULT 'NULL',
PRIMARY KEY (id
)
);
CREATE TABLE shops
(
id
INTEGER AUTO_INCREMENT DEFAULT NULL,
name
VARCHAR(50) NOT NULL DEFAULT 'NULL',
PRIMARY KEY (id
)
);
CREATE TABLE card_transactions
(
id
INTEGER AUTO_INCREMENT DEFAULT NULL,
id_card
INTEGER(1) NOT NULL,
funds
DOUBLE(6,2) NOT NULL,
timeCET
DATETIME NOT NULL,
id_shops
INTEGER DEFAULT NULL,
id_services
INTEGER DEFAULT NULL,
id_payment_systems
INTEGER DEFAULT NULL,
user
ENUM('y','n') NOT NULL,
PRIMARY KEY (id
)
);
CREATE TABLE payment_systems
(
id
INTEGER AUTO_INCREMENT DEFAULT NULL,
name
VARCHAR(50) NOT NULL,
PRIMARY KEY (id
)
);
CREATE TABLE shop_sales
(
id
INTEGER AUTO_INCREMENT DEFAULT NULL,
id_shops
INTEGER DEFAULT NULL,
delivery_price
DOUBLE NOT NULL,
sales price
DOUBLE NOT NULL,
PRIMARY KEY (id
)
);
抱歉,我有图片但无法发布。所以我发布了代码 这是一个很好的数据库设计吗?如果用例如reference_id替换card_transactions表中的最后四列并将它们放在名为reference的新表中会更好吗?
答案 0 :(得分:2)
我只能猜测。可能存在的问题包括