h-you / branches / ddl / 20180405_SQL.txt @ 359
履歴 | 表示 | アノテート | ダウンロード (6.84 KB)
| 1 | 338 | h-you | -- ?H????{???
|
|---|---|---|---|
| 2 | DROP TABLE IF EXISTS constructionbaseinfo_OLD; |
||
| 3 | CREATE TABLE constructionbaseinfo_OLD As Select * from constructionbaseinfo; |
||
| 4 | |||
| 5 | drop table if exists constructionbaseinfo cascade; |
||
| 6 | |||
| 7 | create table constructionbaseinfo ( |
||
| 8 | ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
||
| 9 | , TyingFlg decimal(1,0) not null comment '?R?t?f?[?^?t???O' |
||
| 10 | , JoinFlg decimal(1,0) not null comment '?????_??H???t???O' |
||
| 11 | , ConstructionYear smallint(5) unsigned not null comment '?H???N?x' |
||
| 12 | , ConstructionPeriod smallint(5) unsigned not null comment '?H??????' |
||
| 13 | , RequestedDate date comment '??????' |
||
| 14 | , EstimatesSubmitDeadline date comment '?????o????' |
||
| 15 | , EstimatesSubmittedDate date comment '?????o??' |
||
| 16 | , ProvisionalOrderDate date comment '?????' |
||
| 17 | , OrderDate date comment '???' |
||
| 18 | , OrderStartingDate date comment '?J?n?\???' |
||
| 19 | , OrderCompletionDate date comment '?????\???' |
||
| 20 | , PreparationStartDate date comment '?{?H?????J?n??'
|
||
| 21 | , ConstructionStartingDate date comment '?{?H?J?n??'
|
||
| 22 | , ConstructionCompletionDate date comment '?{?H??????'
|
||
| 23 | , NonOrderDate date comment '????' |
||
| 24 | , OrdersDecisionPrice decimal(12,0) not null comment '??????????z' |
||
| 25 | , OrdersDecisionPriceInTax decimal(12,0) not null comment '??????????z' |
||
| 26 | , SalesDepCode decimal(5,0) unsigned not null comment '?c??S????????R?[?h' |
||
| 27 | , SalesPersonCode decimal(8,0) unsigned not null comment '?c??S????R?[?h' |
||
| 28 | , SalesSubDepCode decimal(5,0) unsigned not null comment '?c????S????????R?[?h' |
||
| 29 | , SalesSubPersonCode decimal(8,0) unsigned not null comment '?c????S????R?[?h' |
||
| 30 | , ConstrDepCode decimal(5,0) unsigned not null comment '?H???S????????R?[?h' |
||
| 31 | , ConstructionPersonCode decimal(8,0) not null comment '?H???S????R?[?h' |
||
| 32 | , ConstrSubDepCode decimal(5,0) unsigned not null comment '?H?????S????????R?[?h' |
||
| 33 | , ConstrSubPersonCode decimal(8,0) not null comment '?H?????S????R?[?h' |
||
| 34 | , ConstrInstrDepCode decimal(5,0) unsigned not null comment '?H???w?????????R?[?h' |
||
| 35 | , ConstructionInstructor decimal(8,0) not null comment '?H???w?????R?[?h' |
||
| 36 | , TransferConstruction decimal(8,0) not null comment '?H??????R?[?h' |
||
| 37 | , TransferConstructionDate date comment '?H??????' |
||
| 38 | , OrderersDivision decimal(5,0) not null comment '????????R?[?h' |
||
| 39 | , OrderersCode decimal(5,0) unsigned not null comment '??????R?[?h' |
||
| 40 | , EstimatesExpirationDate date comment '????L??????' |
||
| 41 | , ConstructionPeriodStart date comment '?_??H???J?n??' |
||
| 42 | , ConstructionPeriodEnd date comment '?_??H??????' |
||
| 43 | , ConstructionPeriodStart2 date comment '?_??H???J?n?i???????j' |
||
| 44 | , ConstructionPeriodEnd2 date comment '?_??H???????i???????j' |
||
| 45 | , StartDate date comment '?H???J?n??' |
||
| 46 | , EndDate date comment '?H???I????' |
||
| 47 | , PurchaseOrderMailingDate date comment '???????X????' |
||
| 48 | , PurchaseOrderReturnDate date comment '???????????' |
||
| 49 | , PurchaseOrderReturnCheckDate date comment '??????????m?F??' |
||
| 50 | , ConsumptionTaxFlg decimal(1,0) not null comment '?????t???O' |
||
| 51 | , PrimeContractorFlg decimal(1,0) not null comment '?????t???O' |
||
| 52 | , SalesCostFlg decimal(1,0) not null comment '?c??o?????t???O' |
||
| 53 | , ConstructionStatusFlg decimal(2,0) not null comment '?H?????t???O' |
||
| 54 | , ConstructionType decimal(5,0) not null comment '?H?????R?[?h' |
||
| 55 | , EstimateType decimal(1,0) not null comment '??????' |
||
| 56 | , BillingStartDate date not null comment '?????????J?n??' |
||
| 57 | , BillingDate date not null comment '??????' |
||
| 58 | , BillingSplitFlg decimal(1,0) not null comment '??????t???O' |
||
| 59 | , BillingSendDate date comment '???????X??/??n????' |
||
| 60 | , LedgerComplateDate date not null comment '?H????????????????t' |
||
| 61 | , InspectPlanningDate date not null comment '?????\???' |
||
| 62 | , InspectExecuteDate date not null comment '???????s??' |
||
| 63 | , RevCompleteDate date not null comment '??????????????' |
||
| 64 | , EntryDate datetime not null comment '?o?^???t' |
||
| 65 | , UpdateDate datetime not null comment '?X?V???t' |
||
| 66 | , constraint constructionbaseinfo_PKC primary key (ConstructionCode) |
||
| 67 | ) comment '?H????{???' ;
|
||
| 68 | |||
| 69 | create index BaseInfo_Index1 |
||
| 70 | on constructionbaseinfo(ConstructionStatusFlg); |
||
| 71 | |||
| 72 | create index BaseInfo_Index2 |
||
| 73 | on constructionbaseinfo(EstimateType); |
||
| 74 | |||
| 75 | create index BaseInfo_Index3 |
||
| 76 | on constructionbaseinfo(SalesPersonCode); |
||
| 77 | |||
| 78 | create index BaseInfo_Index4 |
||
| 79 | on constructionbaseinfo(ConstructionPersonCode); |
||
| 80 | |||
| 81 | create index BaseInfo_Index5 |
||
| 82 | on constructionbaseinfo(ConstructionInstructor); |
||
| 83 | |||
| 84 | create index BaseInfo_Index6 |
||
| 85 | on constructionbaseinfo(ConstructionPeriod); |
||
| 86 | |||
| 87 | Insert INTO constructionbaseinfo |
||
| 88 | Select |
||
| 89 | ConstructionCode |
||
| 90 | , TyingFlg |
||
| 91 | , JoinFlg |
||
| 92 | , ConstructionYear |
||
| 93 | , ConstructionPeriod |
||
| 94 | , RequestedDate |
||
| 95 | , EstimatesSubmitDeadline |
||
| 96 | , EstimatesSubmittedDate |
||
| 97 | , ProvisionalOrderDate |
||
| 98 | , OrderDate |
||
| 99 | , OrderStartingDate |
||
| 100 | , OrderCompletionDate |
||
| 101 | , PreparationStartDate |
||
| 102 | , ConstructionStartingDate |
||
| 103 | , ConstructionCompletionDate |
||
| 104 | , NonOrderDate |
||
| 105 | , OrdersDecisionPrice |
||
| 106 | , OrdersDecisionPriceInTax |
||
| 107 | , SalesDepCode |
||
| 108 | , SalesPersonCode |
||
| 109 | , 0 |
||
| 110 | , 0 |
||
| 111 | , ConstrDepCode |
||
| 112 | , ConstructionPersonCode |
||
| 113 | , ConstrSubDepCode |
||
| 114 | , ConstrSubPersonCode |
||
| 115 | , ConstrInstrDepCode |
||
| 116 | , ConstructionInstructor |
||
| 117 | , TransferConstruction |
||
| 118 | , TransferConstructionDate |
||
| 119 | , OrderersDivision |
||
| 120 | , OrderersCode |
||
| 121 | , EstimatesExpirationDate |
||
| 122 | , ConstructionPeriodStart |
||
| 123 | , ConstructionPeriodEnd |
||
| 124 | , ConstructionPeriodStart2 |
||
| 125 | , ConstructionPeriodEnd2 |
||
| 126 | , StartDate |
||
| 127 | , EndDate |
||
| 128 | , PurchaseOrderMailingDate |
||
| 129 | , PurchaseOrderReturnDate |
||
| 130 | , PurchaseOrderReturnCheckDate |
||
| 131 | , ConsumptionTaxFlg |
||
| 132 | , PrimeContractorFlg |
||
| 133 | , SalesCostFlg |
||
| 134 | , ConstructionStatusFlg |
||
| 135 | , ConstructionType |
||
| 136 | , EstimateType |
||
| 137 | , BillingStartDate |
||
| 138 | , BillingDate |
||
| 139 | , BillingSplitFlg |
||
| 140 | , BillingSendDate |
||
| 141 | , LedgerComplateDate |
||
| 142 | , InspectPlanningDate |
||
| 143 | , InspectExecuteDate |
||
| 144 | , RevCompleteDate |
||
| 145 | , EntryDate |
||
| 146 | , UpdateDate |
||
| 147 | From constructionbaseinfo_OLD; |
||
| 148 | |||
| 149 | -- ?N?}?X?^ |
||
| 150 | DROP TABLE IF EXISTS yearmaster_OLD; |
||
| 151 | CREATE TABLE yearmaster_OLD As Select * from yearmaster; |
||
| 152 | |||
| 153 | drop table if exists yearmaster cascade; |
||
| 154 | |||
| 155 | create table yearmaster ( |
||
| 156 | years smallint(6) not null comment '?N' |
||
| 157 | , constraint yearmaster_PKC primary key (years) |
||
| 158 | ) comment '?N?}?X?^' ; |
||
| 159 | |||
| 160 | Insert INTO yearmaster |
||
| 161 | Select * From yearmaster_OLD; |
||
| 162 | |||
| 163 | |||
| 164 | -- ???}?X?^ |
||
| 165 | DROP TABLE IF EXISTS monthmaster_OLD; |
||
| 166 | CREATE TABLE monthmaster_OLD As Select * from monthmaster; |
||
| 167 | |||
| 168 | drop table if exists monthmaster cascade; |
||
| 169 | |||
| 170 | create table monthmaster ( |
||
| 171 | month smallint(6) not null comment '??' |
||
| 172 | , constraint monthmaster_PKC primary key (month) |
||
| 173 | ) comment '???}?X?^' ; |
||
| 174 | |||
| 175 | Insert INTO monthmaster |
||
| 176 | Select * From monthmaster_OLD; |
||
| 177 | |||
| 178 | |||
| 179 | -- ???}?X?^ |
||
| 180 | DROP TABLE IF EXISTS daymaster_OLD; |
||
| 181 | CREATE TABLE daymaster_OLD As Select * from daymaster; |
||
| 182 | |||
| 183 | drop table if exists daymaster cascade; |
||
| 184 | |||
| 185 | create table daymaster ( |
||
| 186 | days smallint(6) not null comment '??' |
||
| 187 | , constraint daymaster_PKC primary key (days) |
||
| 188 | ) comment '???}?X?^' ; |
||
| 189 | |||
| 190 | Insert INTO daymaster |
||
| 191 | Select * From daymaster_OLD; |
||
| 192 | |||
| 193 | commit; |