mysql

SHOW INDEX from inventoryBase_items;   
  ALTER TABLE inventoryBase_items add INDEX baseID(baseId,warehouseCode,goodsBatch);
--add constraints
-- add primary key
alter table users add constraints users_id_pk primary key(id);
alter table user_infos add constraints user_infos_id_pk primary key(id);
alter table products add constraints products_id_pk primary key(id);
alter table orders add constraints orders_id_pk primary key(id);
alter table orderLines add constraints orderLines_id_pk primary key(id);

-- add foreign key
alter table user_infos add constraints user_info_id_fk foreign key(id) refencese users(id);
alter table orders add constraints orders_user_id_fk foreign key(user_id) refencese users(id);
alter table orderLines add constraints orderLines_order_id_fk foreign key(order_id) refencese orders(id);
alter table orderLines add constraints orderLines_product_id_fk foreign key(procudt_id) refencese product(id);

-- add uniue key
alter table users add constraints users_login_name unique(login_name);
alter table products add constraints products_code unique(code);
alter table orders add constraints orders_code unique(code);

-- add not null
alter table users modify login_name not null;
alter table procudts modify code not null;
alter table orders modify user_id not null;
alter table orders modify code not null;
alter table orderLines modify order_id not null;
alter table orderLines modify product_id not null;
-- add sequence
drop sequence my_key;
create sequence my_key

TRUNCATE 清除数据
比如你要将 表 tb1里面的 f1字段的abc替换为def

UPDATE tb1 SET f1=REPLACE(f1, 'abc', 'def');

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值