

Tables
========================================================================



PUBLIC.BOOKS.AUTHORS                                             [table]
------------------------------------------------------------------------
Contact details for book authors
1   ID                                INTEGER NOT NULL            
2   FIRSTNAME                         VARCHAR(20) NOT NULL        
3   LASTNAME                          VARCHAR(20) NOT NULL        
4   ADDRESS1                          VARCHAR(255)                
5   ADDRESS2                          VARCHAR(255)                
6   CITY                              VARCHAR(50)                 
7   STATE                             CHARACTER(2)                
8   POSTALCODE                        VARCHAR(10)                 
9   COUNTRY                           VARCHAR(50)                 
                                    default 'USA'               

Primary Key

PK_AUTHORS                                                 [primary key]
1   ID                                                            

Foreign Keys

Z_FK_AUTHOR                                [foreign key, with no action]
 1  ID <--(1..many) PUBLIC.BOOKS.BOOKAUTHORS.AUTHORID                              

Indexes

PK_AUTHORS                                                [unique index]
1   ID                                ascending                   

IDX_B_AUTHORS                                         [non-unique index]
3   LASTNAME                          ascending                   
2   FIRSTNAME                         ascending                   

IDX_A_AUTHORS                                         [non-unique index]
6   CITY                              ascending                   
7   STATE                             ascending                   
8   POSTALCODE                        ascending                   
9   COUNTRY                           ascending                   

Triggers

TRG_AUTHORS                                                    [trigger]
  after delete, per row
                                                      [action statement]
UPDATE BOOKS.PUBLISHERS SET PUBLISHER='Jacob'WHERE PUBLISHER='John'

Table Constraints

CHECK_UPPERCASE_STATE                                 [check constraint]
7   STATE                                                         

SYS_CT_10105                                          [check constraint]
1   ID                                                            

SYS_CT_10106                                          [check constraint]
2   FIRSTNAME                                                     

SYS_CT_10107                                          [check constraint]
3   LASTNAME                                                      



PUBLIC.BOOKS.AUTHORSLIST                                          [view]
------------------------------------------------------------------------
1   ID                                INTEGER                     
2   FIRSTNAME                         VARCHAR(20)                 
3   LASTNAME                          VARCHAR(20)                 



PUBLIC.BOOKS.BOOKAUTHORS                                         [table]
------------------------------------------------------------------------
Relationship between books and their authors, 
along with the latest updated information
1   BOOKID                            INTEGER NOT NULL            
2   AUTHORID                          INTEGER NOT NULL            
3   SOMEDATA                          VARCHAR(30)                 

Foreign Keys

Z_FK_AUTHOR                                [foreign key, with no action]
 1  AUTHORID (1..many)--> PUBLIC.BOOKS.AUTHORS.ID                              

SYS_FK_10121                               [foreign key, with no action]
 1  BOOKID (1..many)--> PUBLIC.BOOKS.BOOKS.ID                              

Indexes

Z_FK_AUTHOR                                           [non-unique index]
2   AUTHORID                          ascending                   

SYS_FK_10121                                          [non-unique index]
1   BOOKID                            ascending                   

UIDX_BOOKAUTHORS                                          [unique index]
1   BOOKID                            ascending                   
2   AUTHORID                          ascending                   

Table Constraints

SYS_CT_10119                                          [check constraint]
1   BOOKID                                                        

SYS_CT_10120                                          [check constraint]
2   AUTHORID                                                      



PUBLIC.BOOKS.BOOKS                                               [table]
------------------------------------------------------------------------
Details for published books
1   ID                                INTEGER NOT NULL            
                                    Unique (internal) id for book
2   TITLE                             VARCHAR(255) NOT NULL       
                                    Book title                  
3   DESCRIPTION                       VARCHAR(255)                
                                    Book description
(Usually the blurb from the book jacket or promotional materials)
4   PUBLISHERID                       INTEGER NOT NULL            
                                    Foreign key to the book publisher
5   PUBLICATIONDATE                   DATE                        
                                    Book publication date       
6   PRICE                             DOUBLE(64, 0)               
                                    Current price for the book  
7   PREVIOUSEDITIONID                 INTEGER                     

Primary Key

PK_BOOKS                                                   [primary key]
1   ID                                                            

Foreign Keys

FK_SALES_BOOK                              [foreign key, with no action]
 1  ID <--(0..many) PUBLIC."PUBLISHER SALES".SALES.BOOKID                              

SYS_FK_10121                               [foreign key, with no action]
 1  ID <--(1..many) PUBLIC.BOOKS.BOOKAUTHORS.BOOKID                              

FK_PREVIOUSEDITION                         [foreign key, with no action]
 1  ID <--(0..1) PREVIOUSEDITIONID                                

Indexes

PK_BOOKS                                                  [unique index]
1   ID                                ascending                   

U_PREVIOUSEDITION                                         [unique index]
7   PREVIOUSEDITIONID                 ascending                   

FK_PREVIOUSEDITION                                    [non-unique index]
7   PREVIOUSEDITIONID                 ascending                   

Table Constraints

U_PREVIOUSEDITION                                    [unique constraint]
7   PREVIOUSEDITIONID                                             

SYS_CT_10112                                          [check constraint]
1   ID                                                            

SYS_CT_10113                                          [check constraint]
2   TITLE                                                         

SYS_CT_10114                                          [check constraint]
4   PUBLISHERID                                                   



PUBLIC.BOOKS."Celebrities"                                       [table]
------------------------------------------------------------------------
1   "Id"                              INTEGER NOT NULL            
2   NAME                              VARCHAR(20)                 

Primary Key

"PK_Celebrities"                                           [primary key]
1   "Id"                                                          

Foreign Keys

SYS_FK_10131                               [foreign key, with no action]
 1  "Id" <--(1..1) PUBLIC.BOOKS."Celebrity Updates"."Celebrity Id"                              

Indexes

"PK_Celebrities"                                          [unique index]
1   "Id"                              ascending                   

Table Constraints

SYS_CT_10128                                          [check constraint]
1   "Id"                                                          



PUBLIC.BOOKS."Celebrity Updates"                                 [table]
------------------------------------------------------------------------
1   "Celebrity Id"                    INTEGER NOT NULL            
2   "UPDATE"                          VARCHAR(20)                 

Primary Key

"PK Celebrity Updates"                                     [primary key]
1   "Celebrity Id"                                                

Foreign Keys

SYS_FK_10131                               [foreign key, with no action]
 1  "Celebrity Id" (1..1)--> PUBLIC.BOOKS."Celebrities"."Id"                              

Indexes

"PK Celebrity Updates"                                    [unique index]
1   "Celebrity Id"                    ascending                   

SYS_FK_10131                                          [non-unique index]
1   "Celebrity Id"                    ascending                   

Table Constraints

SYS_CT_10130                                          [check constraint]
1   "Celebrity Id"                                                



PUBLIC.BOOKS.COUPONS                                             [table]
------------------------------------------------------------------------
1   ID                                INTEGER NOT NULL            
2   DATA                              CLOB                        
3   COUPONS                           INTEGER ARRAY               
                                    default ARRAY[]             
4   BOOKS                             VARCHAR(20) ARRAY[10]       

Primary Key

PK_COUPONS                                                 [primary key]
1   ID                                                            

Indexes

PK_COUPONS                                                [unique index]
1   ID                                ascending                   

Table Constraints

SYS_CT_10091                                          [check constraint]
1   ID                                                            



PUBLIC.BOOKS.CUSTOMERDATA                                        [table]
------------------------------------------------------------------------
1   CUSTOMERID                        INTEGER NOT NULL            
2   DATAID                            INTEGER NOT NULL            
3   DATA                              VALID_STRING(20)            

Primary Key

PK_CUSTOMERDATA                                            [primary key]
1   CUSTOMERID                                                    
2   DATAID                                                        

Foreign Keys

FK_CUSTOMER                                [foreign key, with no action]
 1  CUSTOMERID (1..many)--> PUBLIC.BOOKS.CUSTOMERS.ID                              

Indexes

FK_CUSTOMER                                           [non-unique index]
1   CUSTOMERID                        ascending                   

PK_CUSTOMERDATA                                           [unique index]
1   CUSTOMERID                        ascending                   
2   DATAID                            ascending                   

Table Constraints

SYS_CT_10100                                          [check constraint]
1   CUSTOMERID                                                    

SYS_CT_10101                                          [check constraint]
2   DATAID                                                        



PUBLIC.BOOKS.CUSTOMERS                                           [table]
------------------------------------------------------------------------
1   ID                                INTEGER NOT NULL            
2   FIRSTNAME                         NAME_TYPE NOT NULL          
3   LASTNAME                          NAME_TYPE NOT NULL          
4   AGE                               AGE_TYPE                    

Primary Key

PK_CUSTOMERS                                               [primary key]
1   ID                                                            

Foreign Keys

FK_CUSTOMER                                [foreign key, with no action]
 1  ID <--(1..many) PUBLIC.BOOKS.CUSTOMERDATA.CUSTOMERID                              

Indexes

PK_CUSTOMERS                                              [unique index]
1   ID                                ascending                   

Table Constraints

SYS_CT_10093                                          [check constraint]
1   ID                                                            

SYS_CT_10094                                          [check constraint]
2   FIRSTNAME                                                     

SYS_CT_10095                                          [check constraint]
3   LASTNAME                                                      



PUBLIC.BOOKS.PUBLISHERS                                          [table]
------------------------------------------------------------------------
List of book publishers
1   ID                                INTEGER NOT NULL            
                                    auto-incremented            
                                    Unique (internal) id for book publisher
2   PUBLISHER                         VARCHAR(255)                
                                    Name of book publisher      

Primary Key

SYS_PK_10127                                               [primary key]
1   ID                                                            

Foreign Keys

FK_ΒΙΒΛΊΑ_PUBLISHERS                       [foreign key, with no action]
 1  ID <--(1..many) PUBLIC.BOOKS.ΒΙΒΛΊΑ.ΕΚΔΌΤΗΣ                              

Indexes

SYS_PK_10127                                              [unique index]
1   ID                                ascending                   



PUBLIC.BOOKS.ΒΙΒΛΊΑ                                              [table]
------------------------------------------------------------------------
1   ΜΟΝΑΔΙΚΌΣ                         SMALLINT NOT NULL           
2   ΤΊΤΛΟΣ                            VARCHAR(255) NOT NULL       
3   ΠΕΡΙΓΡΑΦΉ                         VARCHAR(255)                
4   ΕΚΔΌΤΗΣ                           SMALLINT NOT NULL           

Primary Key

PK_ΒΙΒΛΊΑ                                                  [primary key]
1   ΜΟΝΑΔΙΚΌΣ                                                     

Foreign Keys

FK_ΒΙΒΛΊΑ_PUBLISHERS                       [foreign key, with no action]
 1  ΕΚΔΌΤΗΣ (1..many)--> PUBLIC.BOOKS.PUBLISHERS.ID                              

Indexes

FK_ΒΙΒΛΊΑ_PUBLISHERS                                  [non-unique index]
4   ΕΚΔΌΤΗΣ                           ascending                   

PK_ΒΙΒΛΊΑ                                                 [unique index]
1   ΜΟΝΑΔΙΚΌΣ                         ascending                   

Table Constraints

SYS_CT_10134                                          [check constraint]
1   ΜΟΝΑΔΙΚΌΣ                                                     

SYS_CT_10135                                          [check constraint]
2   ΤΊΤΛΟΣ                                                        

SYS_CT_10136                                          [check constraint]
4   ΕΚΔΌΤΗΣ                                                       



PUBLIC."PUBLISHER SALES".REGIONS                                 [table]
------------------------------------------------------------------------
1   CITY                              VARCHAR(50) NOT NULL        
2   STATE                             VARCHAR(2) NOT NULL         
3   POSTALCODE                        VARCHAR(10) NOT NULL        
4   COUNTRY                           VARCHAR(50) NOT NULL        

Primary Key

PK_CUSTOMERS                                               [primary key]
3   POSTALCODE                                                    
4   COUNTRY                                                       

Foreign Keys

FK_SALES_REGIONS                           [foreign key, with no action]
 1  POSTALCODE <--(1..many) PUBLIC."PUBLISHER SALES".SALES.POSTALCODE                              
 2  COUNTRY <--(1..many) PUBLIC."PUBLISHER SALES".SALES.COUNTRY                              

Indexes

PK_CUSTOMERS                                              [unique index]
3   POSTALCODE                        ascending                   
4   COUNTRY                           ascending                   

Table Constraints

SYS_CT_10207                                          [check constraint]
1   CITY                                                          

SYS_CT_10208                                          [check constraint]
2   STATE                                                         

SYS_CT_10209                                          [check constraint]
3   POSTALCODE                                                    

SYS_CT_10210                                          [check constraint]
4   COUNTRY                                                       



PUBLIC."PUBLISHER SALES".SALES                                   [table]
------------------------------------------------------------------------
1   POSTALCODE                        VARCHAR(10) NOT NULL        
2   COUNTRY                           VARCHAR(50) NOT NULL        
3   BOOKID                            INTEGER                     
4   COUPON_ID                         INTEGER                     
5   PERIODENDDATE                     DATE                        
6   TOTALAMOUNT                       DOUBLE(64, 0)               
7   SALESDATAID                       INTEGER                     

Foreign Keys

FK_SALES_BOOK                              [foreign key, with no action]
 1  BOOKID (0..many)--> PUBLIC.BOOKS.BOOKS.ID                              

FK_SALES_SALESDATA                         [foreign key, with no action]
 1  SALESDATAID (0..many)--> PUBLIC."PUBLISHER SALES".SALESDATA.SALESDATAID                              

FK_SALES_REGIONS                           [foreign key, with no action]
 1  POSTALCODE (1..many)--> PUBLIC."PUBLISHER SALES".REGIONS.POSTALCODE                              
 2  COUNTRY (1..many)--> PUBLIC."PUBLISHER SALES".REGIONS.COUNTRY                              

Indexes

FK_SALES_BOOK                                         [non-unique index]
3   BOOKID                            ascending                   

FK_SALES_SALESDATA                                    [non-unique index]
7   SALESDATAID                       ascending                   

FK_SALES_REGIONS                                      [non-unique index]
1   POSTALCODE                        ascending                   
2   COUNTRY                           ascending                   

Table Constraints

SYS_CT_10216                                          [check constraint]
1   POSTALCODE                                                    

SYS_CT_10217                                          [check constraint]
2   COUNTRY                                                       



PUBLIC."PUBLISHER SALES".SALESDATA                               [table]
------------------------------------------------------------------------
1   SALESDATAID                       INTEGER                     
2   YEARLYAMOUNT                      DOUBLE(64, 0)               

Foreign Keys

FK_SALES_SALESDATA                         [foreign key, with no action]
 1  SALESDATAID <--(0..many) PUBLIC."PUBLISHER SALES".SALES.SALESDATAID                              

Indexes

UQ_CUSTOMERS                                              [unique index]
1   SALESDATAID                       ascending                   

Table Constraints

UQ_CUSTOMERS                                         [unique constraint]
1   SALESDATAID                                                   

