Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
333 views
in Technique[技术] by (71.8m points)

mysql怎样批量删除表数据?

delete FROM yoshop_awards_record
delete FROM yoshop_dealer_apply
delete FROM yoshop_dealer_capital
delete FROM yoshop_dealer_order
delete FROM yoshop_dealer_referee
delete FROM yoshop_dealer_user
delete FROM yoshop_dealer_withdraw
delete FROM yoshop_goods_sku
delete FROM yoshop_goods_spec_rel
delete FROM yoshop_order
delete FROM yoshop_order_address
delete FROM yoshop_order_goods
delete FROM yoshop_recharge_order
delete FROM yoshop_return_address
delete FROM yoshop_store_role
delete FROM yoshop_store_user
delete FROM yoshop_user
delete FROM yoshop_user_address
delete FROM yoshop_user_balance_log
delete FROM yoshop_user_grade_log

我放在navicat查询中,全选中执行提示错误。怎样才能批量删除呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

同时执行多条SQL要用分号分割,例如:

delete FROM yoshop_awards_record;
delete FROM yoshop_dealer_apply;
delete FROM yoshop_dealer_capital;

如果是全表删除,改用truncate table 表名执行更快!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...