Crear PK, FK e indices Contabilidad
De CidesaWiki
(New page: --INDICES -- Definition for index i01cfbalcom (OID = 53042) : CREATE INDEX i01cfbalcom ON cfbalcom USING btree (orden); -- Definition for index i01contabb1 (OID = 53043) : CREATE INDEX ...) |
|||
Línea 1: | Línea 1: | ||
+ | |||
+ | ---- | ||
+ | |||
+ | PRIMARY KEY | ||
+ | |||
+ | ALTER TABLE ONLY contaba | ||
+ | ADD CONSTRAINT pkcontaba PRIMARY KEY (codemp); | ||
+ | |||
+ | ALTER TABLE ONLY contaba1 | ||
+ | ADD CONSTRAINT pkcontaba1 PRIMARY KEY (fecini,feccie,pereje); | ||
+ | |||
+ | ALTER TABLE ONLY contabb | ||
+ | ADD CONSTRAINT pkcontabbcodcta PRIMARY KEY (codcta); | ||
+ | |||
+ | ALTER TABLE ONLY contabb1 | ||
+ | ADD CONSTRAINT pk_contabb1 PRIMARY KEY (codcta, fecini, feccie, pereje); | ||
+ | |||
+ | ALTER TABLE ONLY contabc | ||
+ | ADD CONSTRAINT pkcontabc PRIMARY KEY (numcom); | ||
+ | |||
+ | ALTER TABLE ONLY contabc1 | ||
+ | ADD CONSTRAINT pkcontabc1 PRIMARY KEY (numcom, codcta, numasi); | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
--INDICES | --INDICES | ||
- | + | ||
CREATE INDEX i01cfbalcom ON cfbalcom USING btree (orden); | CREATE INDEX i01cfbalcom ON cfbalcom USING btree (orden); | ||
- | |||
CREATE INDEX i01contabb1 ON contabb1 USING btree (codcta); | CREATE INDEX i01contabb1 ON contabb1 USING btree (codcta); | ||
- | |||
CREATE INDEX i01contabc1 ON contabc1 USING btree (numcom); | CREATE INDEX i01contabc1 ON contabc1 USING btree (numcom); | ||
- | |||
CREATE INDEX i02contabb ON contabb USING btree (codcta, fecini, feccie); | CREATE INDEX i02contabb ON contabb USING btree (codcta, fecini, feccie); | ||
- | |||
CREATE INDEX i02contabb1 ON contabb1 USING btree (codcta, fecini, feccie); | CREATE INDEX i02contabb1 ON contabb1 USING btree (codcta, fecini, feccie); | ||
- | |||
CREATE INDEX i02contabc1 ON contabc1 USING btree (codcta); | CREATE INDEX i02contabc1 ON contabc1 USING btree (codcta); | ||
- | |||
CREATE INDEX i03contabc ON contabc USING btree (stacom); | CREATE INDEX i03contabc ON contabc USING btree (stacom); | ||
- | |||
CREATE INDEX i05contabb1 ON contabb1 USING btree (codcta, pereje); | CREATE INDEX i05contabb1 ON contabb1 USING btree (codcta, pereje); | ||
- | |||
CREATE INDEX i06contabb1 ON contabb1 USING btree (codcta, pereje, fecini, feccie); | CREATE INDEX i06contabb1 ON contabb1 USING btree (codcta, pereje, fecini, feccie); | ||
- | |||
CREATE INDEX i10contabb ON contabb USING btree (codcta, cargab); | CREATE INDEX i10contabb ON contabb USING btree (codcta, cargab); |
Revisión de 19:12 27 nov 2008
PRIMARY KEY
ALTER TABLE ONLY contaba
ADD CONSTRAINT pkcontaba PRIMARY KEY (codemp);
ALTER TABLE ONLY contaba1
ADD CONSTRAINT pkcontaba1 PRIMARY KEY (fecini,feccie,pereje);
ALTER TABLE ONLY contabb
ADD CONSTRAINT pkcontabbcodcta PRIMARY KEY (codcta);
ALTER TABLE ONLY contabb1
ADD CONSTRAINT pk_contabb1 PRIMARY KEY (codcta, fecini, feccie, pereje);
ALTER TABLE ONLY contabc
ADD CONSTRAINT pkcontabc PRIMARY KEY (numcom);
ALTER TABLE ONLY contabc1
ADD CONSTRAINT pkcontabc1 PRIMARY KEY (numcom, codcta, numasi);
--INDICES
CREATE INDEX i01cfbalcom ON cfbalcom USING btree (orden);
CREATE INDEX i01contabb1 ON contabb1 USING btree (codcta);
CREATE INDEX i01contabc1 ON contabc1 USING btree (numcom);
CREATE INDEX i02contabb ON contabb USING btree (codcta, fecini, feccie);
CREATE INDEX i02contabb1 ON contabb1 USING btree (codcta, fecini, feccie);
CREATE INDEX i02contabc1 ON contabc1 USING btree (codcta);
CREATE INDEX i03contabc ON contabc USING btree (stacom);
CREATE INDEX i05contabb1 ON contabb1 USING btree (codcta, pereje);
CREATE INDEX i06contabb1 ON contabb1 USING btree (codcta, pereje, fecini, feccie);
CREATE INDEX i10contabb ON contabb USING btree (codcta, cargab);