当前位置: 首页 > news >正文

如何建设一个电商网站网站做导航设计的作用是什么

如何建设一个电商网站,网站做导航设计的作用是什么,辽宁建设工程信息网丰田商务,网站建设合同的要素需求说明#xff1a;表中有 id, info, cnt 三个字段#xff0c;对应的增量表多idu增量标记字段和时间戳字段ctimestamp。增量表中的 id 会有重复#xff0c;其他字段 info、cnt 会不断更新#xff0c;idu为增量标记字段#xff0c;ctimestamp为IDU操作的时间戳。目的时要做…需求说明表中有 id, info, cnt 三个字段对应的增量表多idu增量标记字段和时间戳字段ctimestamp。增量表中的 id 会有重复其他字段 info、cnt 会不断更新idu为增量标记字段ctimestamp为IDU操作的时间戳。目的时要做到 1获取增量表中的时间戳字段ctimestamp为最新值对应的记录、进行id去重 2将第一步的查询结果进行脱IDU标记和时间戳字段、合并到最终的表中不带IDU标记和时间戳字段。 SQL查询根据时间戳字段和id字段获取最新值的记录 -- 表字段说明id 会有重复其他字段 info、cnt 会不断更新idu为增量标记字段ctimestamp为IDU操作的时间戳需求是要获取时间戳字段ctimestamp为最新值对应的记录 -- 脱IDU和时间戳以后的最终目的表不带增量标记和时间戳字段 drop table if exists test81; -- 带IDU标记idu字段和时间戳字段ctimestampid字段可能存在重复的值的记录 drop table if exists test81_idu; -- 基于 test81_idu 生成的 D 的记录id唯一去重后无重复记录 drop table if exists test81_tmp2_d; -- 基于 test81_idu 生成的 I、U 的记录id唯一去重后无重复记录 drop table if exists test81_tmp3_iu; -- 创建最终目的表、并构部分已有数据 create table test81 (   id int not null,    info varchar(100),    cnt int,   primary key(id)); insert into test81 (id,info,cnt) values (1, aaa, 31);  insert into test81 (id,info,cnt) values (2, bbb, 33);  insert into test81 (id,info,cnt) values (3, ccc, 35); 注意如果是GBase8a primary key(id)  主键约束无效。  select * from test81; 查询结果 ---------------- | id | info | cnt  | ---------------- |  1 | aaa  |   31 | |  2 | bbb  |   33 | |  3 | ccc  |   35 | ---------------- -- 创建带IDU标记的表id存在重复多条记录 create table test81_idu (   id int not null,    info varchar(100),    cnt int,   idu varchar(10),   ctimestamp timestamp);     insert into test81_idu (id,info,cnt,idu,ctimestamp) values (1, aaa, 31, I, 2023-10-27 12:31:31.123456789);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (2, bbb, 33, I, 2023-10-27 12:33:33.123456789);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (3, ccc, 35, I, 2023-10-27 12:35:35.123456789);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (1, aaa, 50, U, 2023-10-27 12:50:50.123456789);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (1, aaa, 41, U, 2023-10-27 12:41:41.123456789);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (2, NULL, NULL, D, 2023-10-27 12:52:52.123456789);    注意MySQL支持上面9位精确到纳秒的输入只是数据库行为实际上丢弃后面3位只取前面6位但不会报错能执行成功。但如果是GBase8a则不行只能指定6位  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (1, aaa, 31, I, 2023-10-27 12:31:31.123456);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (2, bbb, 33, I, 2023-10-27 12:33:33.123456);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (3, ccc, 35, I, 2023-10-27 12:35:35.123456);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (1, aaa, 50, U, 2023-10-27 12:50:50.123456);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (1, aaa, 41, U, 2023-10-27 12:41:41.123456);  insert into test81_idu (id,info,cnt,idu,ctimestamp) values (2, NULL, NULL, D, 2023-10-27 12:52:52.123456); select * from test81_idu; 执行结果 ------------------------------------------- | id | info | cnt  | idu  | ctimestamp          | ------------------------------------------- |  1 | aaa  |   31 | I    | 2023-10-27 12:31:31 | |  2 | bbb  |   33 | I    | 2023-10-27 12:33:33 | |  3 | ccc  |   35 | I    | 2023-10-27 12:35:35 | |  1 | aaa  |   50 | U    | 2023-10-27 12:50:50 | |  1 | aaa  |   41 | U    | 2023-10-27 12:41:41 | |  2 | NULL | NULL | D    | 2023-10-27 12:52:52 | ------------------------------------------- 表字段说明id 会有重复其他字段 info、cnt 会不断更新idu为增量标记字段ctimestamp为IDU操作的时间戳需求是要获取时间戳字段ctimestamp为最新值对应的记录 脱IDU标记合并处理中间用多个到临时表 -- 先查询一下根据时间戳字段和id进行处理对id去重同一个id的多条重复记录只取时间戳最新的一条记录 SELECT a.id,a.info,a.cnt,a.idu FROM test81_idu a,( SELECT  id, MAX(ctimestamp)AS time FROM test81_idu GROUP BY id ORDER BY COUNT(*)DESC)b WHERE a.idb.id and a.ctimestampb.time; 执行结果 ---------------------- | id | info | cnt  | idu  | ---------------------- |  3 | ccc  |   35 | I    | |  1 | aaa  |   50 | U    | |  2 | NULL | NULL | D    | ---------------------- -- 如果用 INSERT INTO 则需要先创建目标表、如果用 SELECT INTO 则要保证目标表不存在执行时会创建目标表 DROP TABLE IF EXISTS test81_tmp2_d; -- CREATE TABLE IF NOT EXISTS test81_tmp2_d  LIKE test81_idu; -- 根据id和时间戳查询最新记录、并只显示iduD的结果 -- MySQL不支持的方式 -- SELECT id,info,cnt INTO test81_tmp2_d FROM test81_idu; -- MySQL能支持的方式 DROP TABLE IF EXISTS test81_tmp2_d; CREATE TABLE test81_tmp2_d  ( SELECT a.id,a.info,a.cnt,a.idu FROM test81_idu a,( SELECT  id, MAX(ctimestamp)AS time FROM test81_idu GROUP BY id ORDER BY COUNT(*)DESC)b WHERE a.idb.id AND a.ctimestampb.time AND a.iduD ); -- 查询结果 select * from test81_tmp2_d; ---------------------- | id | info | cnt  | idu  | ---------------------- |  2 | NULL | NULL | D    | ---------------------- -- 根据id和时间戳查询最新记录、并只显示iduIU的结果 -- MySQL能支持的方式 DROP TABLE IF EXISTS test81_tmp3_iu; CREATE TABLE test81_tmp3_iu  ( SELECT a.id,a.info,a.cnt,a.idu FROM test81_idu a,( SELECT  id, MAX(ctimestamp)AS time FROM test81_idu GROUP BY id ORDER BY COUNT(*)DESC)b WHERE a.idb.id AND a.ctimestampb.time AND (a.idu IN (I,U)) ); -- 查询结果 select * from test81_tmp3_iu; ---------------------- | id | info | cnt  | idu  | ---------------------- |  3 | ccc  |   35 | I    | |  1 | aaa  |   50 | U    | ---------------------- -- 将D的数据从最终目标表删除 DELETE FROM test81 WHERE id in (SELECT DISTINCT id FROM test81_tmp2_d); -- D 记录删除后查看目的表数据 select * from test81; ---------------- | id | info | cnt  | ---------------- |  1 | aaa  |   31 | |  3 | ccc  |   35 | ---------------- -- 将I和U的数据插入或更新到最终的目标表 -- merge into, 目的表的关联id存在则update、不存在则insert -- GBase8a 使用 merge into MySQL 不支持该语法 -- merge into test81 t1 using test81_tmp3_iu tmp on t1.idtmp.id when matched then update set t1.infotmp.info,t1.cnttmp.cnt when not matched then insert(id,info,cnt)values(tmp.id,tmp.info,tmp.cnt); -- MySQL 使用 insert into GBase8a 不支持该语法 INSERT INTO test81(id,info,cnt) SELECT id,info,cnt FROM test81_tmp3_iu ON DUPLICATE KEY UPDATE infoVALUES(info), cntVALUES(cnt); -- I和U合并到目的表后查询结果 select * from test81; ---------------- | id | info | cnt  | ---------------- |  1 | aaa  |   50 | |  3 | ccc  |   35 | ---------------- 到此为止整个脱IDU表级和时间戳的流程处理完毕。
http://www.hkea.cn/news/14477529/

相关文章:

  • 自助建站模板使用方法秦淮html5响应式网站
  • 广东平台网站建设怎么做网站认证
  • 茶叶外贸网站建设阳江招聘网站哪里最好找工作
  • 建设工程职称 在哪个网站重庆有哪些公司
  • 公司网站建设费用明细表个人网站的搭建步骤
  • 新手建立企业网站流程郑州建筑工程有限公司
  • 加强网站建设 统计局自己做网站能关联支付宝吗
  • 中企网站建设网站托管服务合同范本
  • 南通做网站哪家好小程序制作后维护成本
  • 吴江区经济开发区规建设局网站借贷网站建设
  • 新都兴城建设投资有限公司网站外国网站上做Task
  • 哈尔滨住房建设发展集团网站做网站全部乱码怎么办
  • 免费空间做淘宝客网站网站排名推广软件
  • 设计网站推荐html云南营销网站建设
  • 洛阳瀍河建设局网站wordpress no.7高级版
  • wordpress手机网站插件装修设计公司电话
  • 网站建设 知乎网站后台乱码
  • 一般公司网站用什么域名套餐个人业务网站制作
  • 新乡手机网站建设江苏宏澄建设有限公司网站
  • 深圳家居网站建设网络营销的常用策略
  • 乐清开发网站公司word做网站框架
  • 用手机做电影网站百家号如何给网站做推广
  • wordpress演示站网站建设哪家好公司
  • 免费网站建设合同书网上购物网站网站建设分析
  • google地图嵌入网站电子商务管理系统
  • 想开个网站做外贸怎么做设计图的网站
  • 佛山网站建设公司排名榜淘宝联盟网上的网站建设
  • 阿里绿网网站违规新产品宣传推广策划方案
  • 石台做网站怎样自己做代刷网站
  • 网站创建要多少钱超市网站怎么做的