标签归档:foreign-key

RSS feed of foreign-key

最后更新于 .

1.创建列


alter table tablename add colname type not null default '0';
例:
alter table mmanapp_mmanmedia add appid_id integer not null default 372;

2.删除列


alter table tablename drop column colname;
例:
alter table mmanapp_mmanmedia drop column appid_id;

3.在已经存在的列上创建外键关联


ALTER TABLE yourtablename    ADD [CONSTRAINT symbol] FOREIGN KEY [id] (index_col_name, ...)    REFERENCES tbl_name (index_col_name, ...)    [ON DELETE ...