码迷,mamicode.com
首页 > 数据库 > 详细

数据库的一些增删改查的操作

时间:2014-09-18 11:42:14      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:des   style   io   ar   数据   art   sp   cti   on   

select count(*) from ps_product;
select count(*) from ps_product_lang;
select * from ps_product_lang where id_product=(select count(*) from ps_product_lang);
select name,id_product from ps_product_lang where id_product=(select count(*) from ps_product_lang);
select name,id_product from ps_product_lang where id_product=;
select name,id_product from ps_product_lang where name=‘‘;
select count(*) from ps_product where price=0;
delete from ps_product where id_product=;
delete from ps_product_lang where id_product between 4076 and 4079;
delete from ps_product where id_product between 4080 and 4082;
delete from ps_category where id_category between 4080 and 4082;
delete from ps_product_lang where id_product in(274,233,241,339,654);
update ps_product_lang set description=" " where description="";(更改说明)
update ps_product_lang set price=price+179;(更改价格)
delete from ps_product_lang where id_product%2=0 and id_product>666;
update ps_category set id_parent=2 where id_category between 9 and 11;
update ps_image set cover = 0 where id_product=5;
update ps_image set cover = 1 where id_image=9;
select name,id_product from ps_product_lang where name=10465;
update ps_product set active = 0 where id_product in ();
select count(*) from ps_product where pricr<100;
UPDATE `ps_product` SET `price`= concat(round(rand()*200 + 120), ‘.99‘) where price<100;
select * from ps_feature where id_feature = 18;
select * from ps_feature_lang where id_feature = 18;
select * from ps_feature_value_lang where value=‘
    Bateau (2)
    Bateau neck (9)
    Bateau neck/strapless‘;
select count(*) from ps_feature_value_lang;

update ps_feature_product set id_feature = 19 where id_feature = 18;
update ps_feature_product set id_feature = 28 where id_feature = 16;
update ps_feature_product set id_feature = 15 where id_feature = 20;
update ps_feature_product set id_feature = 8 where id_feature = 6;
delete from ps_feature where id_feature in (18,16,20,6);
delete from ps_feature_lang where id_feuture in (18,16,20,6);

update ps_feature_product set id_feature_value=50 where id_feature_value in(72,364,59,351);
select * from ps_feature_lang where name=‘Style‘;


插入订单号

TRUNCATE `ps_orders`;
INSERT INTO `ps_orders` (`id_order`, `id_carrier`, `id_lang`, `id_customer`, `id_cart`, `id_currency`, `id_address_delivery`, `id_address_invoice`, `secure_key`, `payment`,
 `conversion_rate`, `module`, `recyclable`, `gift`, `gift_message`, `shipping_number`, `total_discounts`, `total_paid`, `total_paid_real`, `total_products`, `total_products_wt`,
 `total_shipping`, `carrier_tax_rate`, `total_wrapping`, `invoice_number`, `delivery_number`, `invoice_date`, `delivery_date`, `valid`, `date_add`, `date_upd`) VALUES 
(‘960000‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1.000000‘, ‘1‘, ‘0‘, ‘0‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘1‘, ‘2011-08-03 00:00:00‘,
 ‘2011-08-03 00:00:00‘, ‘1‘, ‘2011-08-03 00:00:00‘, ‘2011-08-03 00:00:00‘);

select id_order from ps_orders;
delete from ps_orders;

删除产品

delete from ps_product where id_product>6404;
delete from ps_product_lang where id_product>6404;
delete from ps_category_product where id_product>6404;
delete from ps_image where id_product > 6404;
delete from ps_product_tag where id_product ;


改分类

update ps_category_product set id_category=4 where id_category = 7;
update ps_category_product set id_category=2 where id_category in (15,17,13,23);
update ps_category_product set id_category=36 where id_category=35;
update ps_category_product set id_category=14 where id_category=34;

修改mysql密码:


分类变成子分类

update ps_category_product set id_parent=14 where id_category=34;


数据库的一些增删改查的操作

标签:des   style   io   ar   数据   art   sp   cti   on   

原文地址:http://my.oschina.net/u/1388018/blog/315354

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!