⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aa.sql

📁 hibernate 简单的例子
💻 SQL
字号:
-------------------------------------------
-- Export file for user SHOPPING         --
-- Created by new on 2008-3-15, 15:08:02 --
-------------------------------------------

spool aa.log

prompt
prompt Creating table SIGNON
prompt =====================
prompt
create table SIGNON
(
  USERID   VARCHAR2(80) not null,
  USERNAME VARCHAR2(25) not null,
  PASSWORD VARCHAR2(25) not null
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table SIGNON
  add constraint PK_SIGNON primary key (USERID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating table ACCOUNT
prompt ======================
prompt
create table ACCOUNT
(
  USERID    VARCHAR2(80) not null,
  EMAIL     VARCHAR2(80) not null,
  FIRSTNAME VARCHAR2(80) not null,
  LASTNAME  VARCHAR2(80) not null,
  STATUS    VARCHAR2(2),
  ADDR1     VARCHAR2(80) not null,
  ADDR2     VARCHAR2(40),
  CITY      VARCHAR2(80) not null,
  STATE     VARCHAR2(80) not null,
  ZIP       VARCHAR2(20) not null,
  COUNTRY   VARCHAR2(20) not null,
  PHONE     VARCHAR2(80) not null
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table ACCOUNT
  add constraint PK_ACCOUNT primary key (USERID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table ACCOUNT
  add constraint FK_ACCOUNT_A_SIGNON foreign key (USERID)
  references SIGNON (USERID);

prompt
prompt Creating table BANNERDATA
prompt =========================
prompt
create table BANNERDATA
(
  FAVCATEGORY VARCHAR2(80) not null,
  BANNERNAME  VARCHAR2(255)
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table BANNERDATA
  add constraint PK_BANNERDATA primary key (FAVCATEGORY)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating table CATEGORY
prompt =======================
prompt
create table CATEGORY
(
  CATID VARCHAR2(10) not null,
  NAME  VARCHAR2(80),
  DESCN VARCHAR2(255)
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table CATEGORY
  add constraint PK_CATEGORY primary key (CATID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating table PRODUCT
prompt ======================
prompt
create table PRODUCT
(
  PRODUCTID VARCHAR2(10) not null,
  CATID     VARCHAR2(10) not null,
  NAME      VARCHAR2(80),
  DESCN     VARCHAR2(255)
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table PRODUCT
  add constraint PK_PRODUCT primary key (PRODUCTID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table PRODUCT
  add constraint FK_PRODUCT_FK_PRODUC_CATEGORY foreign key (CATID)
  references CATEGORY (CATID);
create index FK_PRODUCT_1_FK on PRODUCT (CATID)
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating table SUPPLIER
prompt =======================
prompt
create table SUPPLIER
(
  SUPPID NUMBER not null,
  NAME   VARCHAR2(80),
  STATUS VARCHAR2(2) not null,
  ADDR1  VARCHAR2(80),
  ADDR2  VARCHAR2(80),
  CITY   VARCHAR2(80),
  STATE  VARCHAR2(80),
  ZIP    VARCHAR2(5),
  PHONE  VARCHAR2(80)
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table SUPPLIER
  add constraint PK_SUPPLIER primary key (SUPPID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating table ITEM
prompt ===================
prompt
create table ITEM
(
  ITEMID    VARCHAR2(10) not null,
  PRODUCTID VARCHAR2(10) not null,
  SUPPID    NUMBER,
  LISTPRICE NUMBER(10,2),
  UNITCOST  NUMBER(10,2),
  STATUS    VARCHAR2(2),
  ATTR1     VARCHAR2(80),
  ATTR2     VARCHAR2(80),
  ATTR3     VARCHAR2(80),
  ATTR4     VARCHAR2(80),
  ATTR5     VARCHAR2(80)
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table ITEM
  add constraint PK_ITEM primary key (ITEMID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table ITEM
  add constraint FK_ITEM_FK_ITEM_1_PRODUCT foreign key (PRODUCTID)
  references PRODUCT (PRODUCTID);
alter table ITEM
  add constraint FK_ITEM_FK_ITEM_2_SUPPLIER foreign key (SUPPID)
  references SUPPLIER (SUPPID);
create index FK_ITEM_1_FK on ITEM (PRODUCTID)
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index FK_ITEM_2_FK on ITEM (SUPPID)
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating table INVENTORY
prompt ========================
prompt
create table INVENTORY
(
  ITEMID VARCHAR2(10) not null,
  QTY    NUMBER not null
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table INVENTORY
  add constraint PK_INVENTORY primary key (ITEMID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table INVENTORY
  add constraint FK_INVENTOR_RELATIONS_ITEM foreign key (ITEMID)
  references ITEM (ITEMID);

prompt
prompt Creating table ORDERS
prompt =====================
prompt
create table ORDERS
(
  ORDERID         NUMBER not null,
  USERID          VARCHAR2(80) not null,
  ORDERDATE       DATE,
  TOTALPRICE      NUMBER(10,2),
  SHIPADDR1       VARCHAR2(80),
  SHIPADDR2       VARCHAR2(80),
  SHIPCITY        VARCHAR2(80),
  SHIPSTATE       VARCHAR2(80),
  SHIPZIP         VARCHAR2(20),
  SHIPCOUNTRY     VARCHAR2(20),
  SHIPTOFIRSTNAME VARCHAR2(80),
  SHIPTOLASTNAME  VARCHAR2(80),
  BILLADDR1       VARCHAR2(80),
  BILLADDR2       VARCHAR2(80),
  BILLCITY        VARCHAR2(80),
  BILLSTATE       VARCHAR2(80),
  BILLZIP         VARCHAR2(20),
  BILLCOUNTRY     VARCHAR2(20),
  BILLTOFIRSTNAME VARCHAR2(80),
  BILLTOLASTNAME  VARCHAR2(80),
  CREDITCARD      VARCHAR2(80),
  EXPRDATE        VARCHAR2(20),
  CARDTYPE        VARCHAR2(80),
  LOCAL           VARCHAR2(80)
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table ORDERS
  add constraint PK_ORDERS primary key (ORDERID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table ORDERS
  add constraint FK_ORDERS_FK_ORDERS_ACCOUNT foreign key (USERID)
  references ACCOUNT (USERID);
create index FK_ORDERS_1_FK on ORDERS (USERID)
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating table LINEITEM
prompt =======================
prompt
create table LINEITEM
(
  ORDERID   NUMBER not null,
  LINENUM   NUMBER not null,
  ITEMID    VARCHAR2(10),
  QUANTITY  NUMBER,
  LISTPRICE NUMBER(10,2)
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table LINEITEM
  add constraint PK_LINEITEM primary key (ORDERID, LINENUM)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table LINEITEM
  add constraint FK_LINEITEM_FK_LINEIT_ORDERS foreign key (ORDERID)
  references ORDERS (ORDERID);
alter table LINEITEM
  add constraint FK_LINEITEM_RELATIONS_ITEM foreign key (ITEMID)
  references ITEM (ITEMID);
create index FK_LINEITEM_1_FK on LINEITEM (ORDERID)
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
create index Relationship_10_FK on LINEITEM (ITEMID)
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating table ORDERSTATUS
prompt ==========================
prompt
create table ORDERSTATUS
(
  ORDERID   NUMBER not null,
  TIMESTAMP DATE not null,
  STATUS    CHAR(1) not null
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table ORDERSTATUS
  add constraint PK_ORDERSTATUS primary key (ORDERID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table ORDERSTATUS
  add constraint FK_ORDERSTA_FK_ORDERS_ORDERS foreign key (ORDERID)
  references ORDERS (ORDERID);

prompt
prompt Creating table PROFILE
prompt ======================
prompt
create table PROFILE
(
  USERID      VARCHAR2(80) not null,
  LANGPREF    VARCHAR2(80) not null,
  FAVCATEGORY VARCHAR2(30),
  MYLISTOPT   NUMBER,
  BANNEROPT   NUMBER
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table PROFILE
  add constraint PK_PROFILE primary key (USERID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table PROFILE
  add constraint FK_PROFILE_B_SIGNON foreign key (USERID)
  references SIGNON (USERID);

prompt
prompt Creating table SEQUENCE
prompt =======================
prompt
create table SEQUENCE
(
  NAME   VARCHAR2(30) not null,
  NEXTID NUMBER not null
)
tablespace USERS
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table SEQUENCE
  add constraint PK_SEQUENCE primary key (NAME)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );

prompt
prompt Creating sequence HIBERNATE_SEQUENCE
prompt ====================================
prompt
create sequence HIBERNATE_SEQUENCE
minvalue 1
maxvalue 9999999999999999999
start with 281
increment by 1
cache 20
cycle
order;


spool off

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -