1. 程式人生 > >資料庫基礎知識(一)-sql常見操作

資料庫基礎知識(一)-sql常見操作

create table if not exists userservice ( serviceid int(4) NOT NULL AUTO_INCREMENT comment '某項id設定主鍵自增', userid int(4) NOT NULL comment '所屬使用者', sname varchar(20) NOT NULL comment '服務名', other varchar(20) comment '其他欄位', PRIMARY KEY (`serviceid`), CONSTRAINT fkuserid FOREIGN KEY
(userid) REFERENCES user(userid) )ENGINE=InnoDB DEFAULT CHARSET=utf8 comment '使用者某項服務表';