sql server建表语句 如何改成mysql
CREATETABLEorders(orderIdBIGINTPRIMARYKEYidentity(1,1),userIdBIGINTCONSTRAINTfk_clien...
CREATE TABLE orders(
orderId BIGINT PRIMARY KEY identity(1,1),
userId BIGINT CONSTRAINT fk_client_id REFERENCES users(userid),
orderDate DATETIME DEFAULT getDate(),
payMode VARCHAR(20)CHECK (payMode IN('货到付款','支付宝付款')) DEFAULT '货到付款',
isPayed BIT CHECK ( isPayed IN (0,1)),
totalPrice FLOAT NOT NULL
) 展开
orderId BIGINT PRIMARY KEY identity(1,1),
userId BIGINT CONSTRAINT fk_client_id REFERENCES users(userid),
orderDate DATETIME DEFAULT getDate(),
payMode VARCHAR(20)CHECK (payMode IN('货到付款','支付宝付款')) DEFAULT '货到付款',
isPayed BIT CHECK ( isPayed IN (0,1)),
totalPrice FLOAT NOT NULL
) 展开
1个回答
展开全部
create table orders
(
orderId bigint not null auto_increment,
orderDate datetime default CURRENT_TIMESTAMP,
userid bigint,
totalPrice decimal,
payMode varchar(20) default '货到付款',
isPayed bit,
primary key (orderId),
constraint FK_Reference_1 foreign key (userid)
references users (user_id) on delete restrict on update restrict
);
更多追问追答
追问
我试了你的,执行不了。
追答
报什么错?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询