Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1559998
  • 博文数量: 201
  • 博客积分: 2812
  • 博客等级: 少校
  • 技术积分: 3029
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-18 18:28
个人简介

从事数据库工作多年,目前看好分布式NeSQL/HTAP数据库在企业客户市场的发展。未来的主要方向是——致力于 NewSQL/HTAP 数据库的推广普及。

文章存档

2016年(1)

2015年(8)

2014年(23)

2013年(50)

2012年(32)

2011年(87)

分类: Sybase

2011-01-27 12:10:27

4.创建数据库对象
   在创建完数据库、用户并进行了授权之后,接下来将创建用户数据库对象。create_tables.sql脚本如下:
 
/* ============================================================ */
/*   Table: service                                             */
/* ============================================================ */
create table service
(
    service_key          int      not null,
    call_waiting_flag    char(1)  null    ,
    caller_id_flag       char(1)  null    ,
    voice_mail_flag      char(1)  null    ,
    cellular_flag        char(1)  null    ,
    internet_flag        char(1)  null    ,
    isdn_flag            char(1)  null    ,
    primary key (service_key)
);

/* ============================================================ */
/*   Table: month                                               */
/* ============================================================ */
create table month
(
    month_key            int      not null,
    month_text           char(9)  null    ,
    month_number         int      null    ,
    fiscal_period        char(2)  null    ,
    year                 int      null    ,
    period_and_year      char(7)  null    ,
    month_and_year       char(7)  null    ,
    primary key (month_key)
);
/* ============================================================ */
/*   Table: customer                                */
/* ============================================================ */
create table customer
(
    customer_key         int   not null,
    customer_first_name  char(11)  null    ,
    customer_last_name   char(15)  null    ,
    customer_gender      char(1)   null    ,
    street_address       char(18)  null    ,
    city                 char(20)  null    ,
    state                char(2)   null    ,
    postal_code          char(9)   null    ,
    phone_number         char(10)  null    ,
    primary key (customer_key)
);
/* ============================================================ */
/*   Table: status                                              */
/* ============================================================ */
create table status
(
    status_key           int       not null,
    new_customer         char(1)   null    ,
    new_address          char(1)   null    ,
    call_waiting_status  char(10)  null    ,
    caller_id_status     char(10)  null    ,
    voice_mail_status    char(10)  null    ,
    cellular_status      char(10)  null    ,
    internet_status      char(10)  null    ,
    isdn_status          char(10)  null    ,
    closed_this_period   char(1)   null    ,
    primary key (status_key)
);
/* ============================================================ */
/*   Table: telco_facts                                         */
/* ============================================================ */
create table telco_facts
(
    month_key                   int     not null,
    customer_key                int  not null,
    service_key                 int     not null,
    status_key                  int     not null,
    combined_revenue            money   null    ,
    number_of_lines             int    null    ,
    local_call_count            int     null    ,
    local_call_minutes          int     null    ,
    long_distance_call_count    int     null    ,
    long_distance_call_minutes  int    null    ,
    minutes_online              int    null    ,
    primary key (month_key,customer_key,service_key,status_key),
);
 
 有了创建数据库对象的脚本,具体怎么执行呢?按照下面的步骤即可:
  (1) 使用dbisql执行建表脚本create_tables.sql
      dbisql -c "uid=mpuser;pwd=mpuserpwd;eng=mp2" -nogui create_tables.sql
阅读(1225) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~