Chinaunix首页 | 论坛 | 博客
  • 博客访问: 610781
  • 博文数量: 103
  • 博客积分: 2269
  • 博客等级: 大尉
  • 技术积分: 1108
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-23 16:32
文章分类

全部博文(103)

文章存档

2012年(61)

2011年(42)

分类: Oracle

2012-07-31 15:44:47

--------------------------------------------------------
--  文件已创建 - 星期二-七月-31-2012   
--------------------------------------------------------
  CREATE TABLE "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"
   (    "ID" VARCHAR2(32 CHAR),
    "TYPE_ID" VARCHAR2(32 CHAR),
    "TAG_NAME" VARCHAR2(50 CHAR),
    "IS_ENABLED" NUMBER(*,0),
    "COMMODITY_ID" VARCHAR2(300 CHAR),
    "SORT_NO" NUMBER(*,0),
    "UNIT" VARCHAR2(32 CHAR),
    "TAG_NO" VARCHAR2(32 CHAR)
   ) ;
    COMMENT ON COLUMN "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"."ID" IS '主键id';
    COMMENT ON COLUMN "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"."TYPE_ID" IS '类别id';
    COMMENT ON COLUMN "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"."TAG_NAME" IS '标签名称';
    COMMENT ON COLUMN "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"."IS_ENABLED" IS '是否启用(0禁用 1启用)';
    COMMENT ON COLUMN "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"."COMMODITY_ID" IS '商品编号';
    COMMENT ON COLUMN "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"."SORT_NO" IS '排序号';
    COMMENT ON COLUMN "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"."UNIT" IS 'unit';
    COMMENT ON COLUMN "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"."TAG_NO" IS '标签编号';
    COMMENT ON TABLE "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER"  IS 'roothomes_TBL_TYPE_TAGS_MANAGER';
REM INSERTING into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER
SET DEFINE OFF;
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af01387438150c002b','1L','馈赠朋友',1,'67588454',2,null,'ZKPY');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013874b4aa2d0060','1L','粤西特产',1,'67588458',1,null,'YXCT');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013873e9a1fa0009','B1','赠送同事',1,'67588460',1,null,'ZSTS');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af0138743814fc002a','1L','馈赠朋友',1,'67588457',1,null,'ZKPY');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013874b99fd40062','B1','答谢客户',1,'67588451',1,null,'DXKH');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013873cb99de0003','B1','感谢领导',1,'67588448',1,null,'GXLD');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013873cb99fd0004','B1','感谢领导',1,'67588450',2,null,'GXLD');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013874b32d41005e','1L','潮汕特产',1,'67588460',1,null,'CCTC');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013874b2312e005c','1L','珠三角特产',1,'67588455',1,null,'ZXSJ');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013874b2312e005d','1L','珠三角特产',1,'67588461',2,null,'ZXSJ');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013874b583a50061','B1','回馈员工',1,'67588453',1,null,'HKYG');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af01387437227e0029','1L','孝敬长辈',1,'67588460',1,null,'XJZB');
Insert into roothomes.roothomes_TBL_TYPE_TAGS_MANAGER (ID,TYPE_ID,TAG_NAME,IS_ENABLED,COMMODITY_ID,SORT_NO,UNIT,TAG_NO) values ('402885b73873a6af013874b3fe9b005f','1L','客家特产',1,'67588448',1,null,'KJTC');
--------------------------------------------------------
--  DDL for Index PK_roothomes_TBL_TYPE_TAGS_MANAGER
--------------------------------------------------------

  CREATE UNIQUE INDEX "roothomes"."PK_roothomes_TBL_TYPE_TAGS_MANAGER" ON "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER" ("ID")
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "roothomes" ;
--------------------------------------------------------
--  DDL for Index FK_CAT_TAGS
--------------------------------------------------------

  CREATE INDEX "roothomes"."FK_CAT_TAGS" ON "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER" ("TYPE_ID")
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "roothomes" ;
--------------------------------------------------------
--  Constraints for Table roothomes_TBL_TYPE_TAGS_MANAGER
--------------------------------------------------------

  ALTER TABLE "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER" ADD CONSTRAINT "PK_roothomes_TBL_TYPE_TAGS_MANAGER" PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "roothomes"  ENABLE;
 
  ALTER TABLE "roothomes"."roothomes_TBL_TYPE_TAGS_MANAGER" MODIFY ("ID" NOT NULL ENABLE);

=========================
select *
  from roothomes_TBL_TYPE_TAGS_MANAGER t
 where t.id in (select min(id) over(partition by t.tag_no) id
                  from roothomes_TBL_TYPE_TAGS_MANAGER t)

阅读(2024) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~