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

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;
时间: 2024-07-31 22:01:42

数据库的一些增删改查的操作的相关文章

ORM 实现数据库表的增删改查

这次通过反射技术来实现一下数据库表的增删改查对象关系映射(英语:Object Relational Mapping,简称ORM,或O/RM,或O/R mapping) 注:引用时约束了以下几点: 数据库表的表名与类的类名一致 数据库字段名和类字段名一致 自增字段的访问权限为private其余字段都为public 注:如果用的是MySql数据库,有提供好的MySqlhelper非MySql数据库可以参考我写好的SqlHelper SqlHelper参考位置:http://www.cnblogs.c

Android(java)学习笔记245:ContentProvider之银行数据库创建和增删改查的实现

1.Android的四大组件: (1)Activity  用户交互的UI界面 (2)Service  后台运行的服务 (3)BroadcastReceiver 广播接收者 (4)ContentProvider  内容提供者 2. ContentProvider  内容提供者 用途:把应用程序私有的数据暴露给别的应用程序. 3.下面通过一个银行数据库创建和增删改查的实现案例说明ContentProvider的使用: (1)首先我们这里要用到数据库,首先我们必须先扩展一个抽象类SQLiteOpenH

使用DOM进行xml文档的crud(增删改查)操作&amp;lt;操作详解&amp;gt;

很多朋友对DOM有感冒,这里我花了一些时间写了一个小小的教程,这个能看懂,会操作了,我相信基于DOM的其它API(如JDOM,DOM4J等)一般不会有什么问题. 后附java代码,也可以下载(可点击这里入下载)导入到Eclipse或MyEclipse. Node和Element的关系 Element是Node的子接口,所以Element的方法要比Node方法要多,这样的话使用起来比较方便,一般情况我们都把节点转换成元素(或者叫标签,即Element); Element是Node的子类型: 比如我

使用DOM进行xml文档的crud(增删改查)操作&lt;操作详解&gt;

很多朋友对DOM有感冒,这里我花了一些时间写了一个小小的教程,这个能看懂,会操作了,我相信基于DOM的其它API(如JDOM,DOM4J等)一般不会有什么问题. 后附java代码,也可以下载(可点击这里入下载)导入到Eclipse或MyEclipse. Node和Element的关系 Element是Node的子接口,所以Element的方法要比Node方法要多,这样的话使用起来比较方便,一般情况我们都把节点转换成元素(或者叫标签,即Element); Element是Node的子类型: 比如我

利用SQLiteOpenHelper创建数据库,进行增删改查操作

Android中提供SQLiteOpenHelper类,在该类的构造器中,调用Context中的方法创建并打开一个指定名称的数据库对象.继承和扩展SQLiteOpenHelper类主要做的工作就是重写以下两个方法.onCreate(SQLiteDatabase db) : 当数据库被首次创建时执行该方法,一般将创建表等初始化操作在该方法中执行. onUpgrade(SQLiteDatabse dv, int oldVersion,int new Version):当打开数据库时传入的版本号与当前

[Android] SQLite数据库之增删改查基础操作

    在编程中常常会遇到数据库的操作,而Android系统内置了SQLite,它是一款轻型数据库,遵守事务ACID的关系型数据库管理系统,它占用的资源非常低,可以支持Windows/Linux/Unix等主流操作系统,同一时候可以跟非常多程序语言如C#.PHP.Java等相结合.以下先回想SQL的基本语句,再讲述Android的基本操作. 一. adb shell回想SQL语句     首先,我感觉自己整个大学印象最深的几门课就包含<数据库>,所以想先回想SQL增删改查的基本语句.而在And

48.Python中ORM模型实现mysql数据库基本的增删改查操作

首先需要配置settings.py文件中的DATABASES与数据库的连接信息, DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'orm_intro_dem', 'USER': 'root', 'PASSWORD': 'root', 'HOST': '127.0.0.1', 'PORT': '3306', } } 之后将创建的app添加到settings.py文件中的INSTALLED_APPS中

练习:Ado.Net 数据库增删改查--面向对象操作

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 //实体类 (封装字段.属性) 9 public class Nation 10 { 11 private string code; 12 13 public string Code 14 { 15 get { return cod

数据库增删改查部分操作

对库和表的增删改查 创建: create database xxx default character set utf8 create table  yyy( aaa int, bbb varchar(10), ccc datetime ddd double ) 显示: show databases show database xxx show tables 删除: drop database xxx drop table yyy 修改: alter database xxx default c