– 更改和新增数据
update 商家编码表 set 产品简码=“4098白预定” where 商家编码=“ZP0017”;
insert into 商家编码表 values(“ZP0008”,“其他”),(“ZP0009”,“其他”);
use skg数据库;
SET SQL_SAFE_UPDATES = 0; – 打开变更数据约束
delete from tg直通车关键词 where 日期>‘2021-05-17’;
– 删除部分数据
SET SQL_SAFE_UPDATES = 1; – 执行更新后关闭变更数据约束
insert into kf商家编码表 values(“1105050054”,“T5”);
update 竞品列表 set 产品名称=“K6预定” where 产品ID=“617722444343”;
delete from skg数据库.kf订单报表 where 订单编号=" 1909245350821274222" ;
update tg直通车关键词 set 花费=花费*0.01;
alter table kf宝贝报表 add ID INT primary key auto_increment;
ALTER TABLE tg直通车明细 ADD 花费 float ;
ALTER TABLE 竞品列表 ADD 网址链接 TINYTEXT;
update 竞品列表 set 网址链接=“https://detail.tmall.com/item.htm?id=624705855483”
where 原始命名=“官旗K5白”;
update 竞品列表 set 原始命名2=原始命名;
update kf商家编码表 set 原始命名=concat(“官旗”,产品简码);
update 竞品列表 set 网址链接=concat(“https://detail.tmall.com/item.htm?id=”,产品ID);
ALTER TABLE tg直通车明细 drop 花费 ;
ALTER TABLE tg直通车关键词 CHANGE 宝贝类型 推广类型 varchar(20);
ALTER TABLE tg明星店铺明细 CHANGE 预售成交金额 预售成交金额 float;
alter table tg直通车明细 add ID INT primary key auto_increment;
– 删除部分数据
SET SQL_SAFE_UPDATES = 0; – 打开变更数据约束
select * from tg超推定向人群 where 日期 between “2022-01-01” and “2022-01-31”;
– 删除重复数据
delete from tg直通车明细 where ID in(
select id from (select max(ID) as id,concat(日期,计划名称,推广类型) as a,count() as c from tg直通车明细
where 日期=“2021-06-23”
group by 日期,计划名称,推广类型 having c>1)as t);
– 设置账户权限
use mysql;
CREATE USER ‘shf’@‘172.18.0.18’ identified BY ‘shf123456’;
GRANT select ON skg数据库. TO ‘shf’@‘172.18.0.18’;
CREATE USER ‘gy’@’%’ identified BY ‘123456’;
GRANT select ON . TO ‘gy’@’%’;