/*==============================================================*/
/* Database name:  %DATABASE%                                   */
/* DBMS name:      ORACLE Version 9i                            */
/* Created on:     2009-8-16 10:41:29                           */
/*==============================================================*/
alter table DB
   drop constraint FK_DB_LINE;alter table DB
   drop constraint FK_DB_POWERUSE;alter table DB
   drop constraint FK_DB_PRICE;alter table DLDF
   drop constraint FK_DLDF_LINE;alter table DLDF
   drop constraint FK_DLUSE;alter table DLDF
   drop constraint FK_DLDF_DB;alter table DLDF
   drop constraint FK_DLDF_PRICE;alter table Poweruser
   drop constraint FK_USERLINE;drop table DB cascade constraints;drop table DLDF cascade constraints;drop table Line cascade constraints;drop table PRICE cascade constraints;drop table Poweruser cascade constraints;/*==============================================================*/
/* Table: DB                                                    */
/*==============================================================*/
create table DB  (
   Db_ID                number                          not null,
   Line_ID              number,
   User_ID              number,
   PRI_Price_id         number,
   DB_no                VARCHAR(5),
   DB_len               number,
   DB_type              VARCHAR(20),
   Price_ID             VARCHAR(20),
   DB_bl                number,
   firstnumber          number,
   Regist_time          date,
   constraint PK_DB primary key (Db_ID)
);/*==============================================================*/
/* Table: DLDF                                                  */
/*==============================================================*/
create table DLDF  (
   DL_ID                NUMBER                          not null,
   Line_ID              number,
   User_ID              number,
   Db_ID                number,
   jfrq                 date,
   First_dl             number,
   last_dl              number,
   DB_bl                number,
   dl                   number,
   Price_id             number,
   Price                Decimal(18,2),
   ysDf                 Decimal(18,2),
   ssdf                 Decimal(18,2),
   constraint PK_DLDF primary key (DL_ID)
);/*==============================================================*/
/* Table: Line                                                  */
/*==============================================================*/
create table Line  (
   Line_ID              number                          not null,
   Line_NO              VARCHAR(20)                     not null,
   Line_Name            VARCHAR(20),
   Line_len             number,
   Line_own             VARCHAR(50),
   Line_bdz             number,
   Line_parent          number,
   Line_tyday           date,
   Line_swt             VARCHAR(20),
   Line_lx              number,
   Line_status          number,
   constraint PK_LINE primary key (Line_ID),
   constraint AK_KEY_2_LINE unique (Line_NO)
);/*==============================================================*/
/* Table: PRICE                                                 */
/*==============================================================*/
create table PRICE  (
   Price_id             number                          not null,
   Price_no             VARCHAR(20),
   Price_name           VARCHAR(50),
   Price_f              Decimal(18,2),
   Price_p              Decimal(18,2),
   Prcie_k              Decimal(18,2),
   constraint PK_PRICE primary key (Price_id)
);/*==============================================================*/
/* Table: Poweruser                                             */
/*==============================================================*/
create table Poweruser  (
   User_ID              number                          not null,
   Line_ID              number,
   User_NO              number,
   User_name            VARCHAR(50),
   Identity_card        VARCHAR2(20),
   Moblie_no            Varchar2(12),
   Telphone_no          VARCHAR(12),
   Danbao_name          VARCHAR(50),
   Danbao_card          VARCHA2(12),
   Danbao_telno         VARCHAR(12),
   Bankno               number,
   cardno               VARCHAR2(50),
   bankregister         VARCHAR(50),
   Pay_method           number,
   fapiao               number,
   Regist_time          date,
   Stop_time            date,
   User_status          number,
   constraint PK_POWERUSER primary key (User_ID),
   constraint AK_KEY_2_USE unique (User_NO)
);alter table DB
   add constraint FK_DB_LINE foreign key (Line_ID)
      references Line (Line_ID);alter table DB
   add constraint FK_DB_POWERUSE foreign key (User_ID)
      references Poweruser (User_ID);alter table DB
   add constraint FK_DB_PRICE foreign key (PRI_Price_id)
      references PRICE (Price_id);alter table DLDF
   add constraint FK_DLDF_LINE foreign key (Line_ID)
      references Line (Line_ID);alter table DLDF
   add constraint FK_DLUSE foreign key (User_ID)
      references Poweruser (User_ID);alter table DLDF
   add constraint FK_DLDF_DB foreign key (Db_ID)
      references DB (Db_ID);alter table DLDF
   add constraint FK_DLDF_PRICE foreign key (Price_id)
      references PRICE (Price_id);alter table Poweruser
   add constraint FK_USERLINE foreign key (Line_ID)
      references Line (Line_ID);