【发布时间】:2016-02-05 08:22:21
【问题描述】:
我的代码:
create table Products
(
ProductID int not null auto_increment primary key,
ProductName varchar(20),
Recommendedprice decimal(10,2),
Category varchar(10)
)
create table customers
(
CustomerID int not null auto_increment primary key,
FirstName varchar(50),
LastName varchar(50),
city varchar(50),
State char(2),
zip varchar(10)
)
create table sales
(
SalesID int not null auto_increment primary key,
ProductID int,
CustomerID int,
CONSTRAINT fk_PerProducts FOREIGN KEY (ProductId)
REFERENCES Products(ProductId),
CONSTRAINT fk_PerCustomers FOREIGN KEY (CustomerId)
REFERENCES customers(customerId),
SalesPrice decimal(10,2),
SalesDate date
)
我在表格列表中得到空值。
【问题讨论】:
-
创建数据库实践 创建表 Products ( ProductID int not null auto_increment 主键, ProductName varchar(20), Recommendedprice decimal(10,2), Category varchar(10) ) 创建表 customers ( CustomerID int not null auto_increment 主键,FirstName varchar(50),LastName varchar(50),city varchar(50),State char(2),zip varchar(10))
-
你能再具体一点吗?
-
查询的是什么?你有
left join桌子吗? -
有没有人可以帮助摆脱这种情况? :D
-
no....我只在创建表语句中使用了两个外键....应该有整数值,但我得到的是 Null 值....不知道为什么?需要一些修改吗?我是初学者!