Crear PRIMARY KEY, FOREING KEY e INDICES Presupuesto
De CidesaWiki
Revisión a fecha de 23:41 27 nov 2008; Pablosilva (Discusión | contribuciones)
PRIMARY KEY
ALTER TABLE ONLY cpadidis ADD CONSTRAINT i_cpadidis PRIMARY KEY (refadi); ALTER TABLE ONLY cpajuste ADD CONSTRAINT i_cpajuste PRIMARY KEY (refaju); ALTER TABLE ONLY cpasiini ADD CONSTRAINT i_cpasiini PRIMARY KEY (codpre, perpre, anopre); ALTER TABLE ONLY cpcausad ADD CONSTRAINT i_cpcausad PRIMARY KEY (refcau); ALTER TABLE ONLY cpcompro ADD CONSTRAINT i_cpcompro PRIMARY KEY (refcom); ALTER TABLE ONLY cpdefniv ADD CONSTRAINT i_cpdefniv PRIMARY KEY (codemp); ALTER TABLE ONLY cpdeftit ADD CONSTRAINT i_cpdeftit PRIMARY KEY (codpre); ALTER TABLE ONLY cpdocaju ADD CONSTRAINT i_cpdocaju PRIMARY KEY (tipaju); ALTER TABLE ONLY cpdoccau ADD CONSTRAINT i_cpdoccau PRIMARY KEY (tipcau); ALTER TABLE ONLY cpdoccom ADD CONSTRAINT i_cpdoccom PRIMARY KEY (tipcom); ALTER TABLE ONLY cpdocpag ADD CONSTRAINT i_cpdocpag PRIMARY KEY (tippag); ALTER TABLE ONLY cpdocprc ADD CONSTRAINT i_cpdocprc PRIMARY KEY (tipprc); ALTER TABLE ONLY cpmovadi ADD CONSTRAINT i_cpmovadi PRIMARY KEY (refadi, codpre); ALTER TABLE ONLY cpmovaju ADD CONSTRAINT i_cpmovaju PRIMARY KEY (refaju, codpre); ALTER TABLE ONLY cpmovtra ADD CONSTRAINT i_cpmovtra PRIMARY KEY (reftra, codori, coddes); ALTER TABLE ONLY cpniveles ADD CONSTRAINT i_cpniveles PRIMARY KEY (catpar, consec); ALTER TABLE ONLY cppagos ADD CONSTRAINT i_cppagos PRIMARY KEY (refpag); ALTER TABLE ONLY cpprecom ADD CONSTRAINT i_cpprecom PRIMARY KEY (refprc); ALTER TABLE ONLY cprelapa ADD CONSTRAINT i_cprelapa PRIMARY KEY (refrel); ALTER TABLE ONLY cptrasla ADD CONSTRAINT i_cptrasla PRIMARY KEY (reftra); ALTER TABLE ONLY cpunimed ADD CONSTRAINT i_cpunimed PRIMARY KEY (coduni);
FOREING KEY
INDICES
CREATE INDEX i01cpdisniv ON cpdisniv USING btree (codpre); CREATE INDEX i01cpimpcau ON cpimpcau USING btree (refcau); CREATE INDEX i01cpimpcom ON cpimpcom USING btree (refcom); CREATE INDEX i01cpimppag ON cpimppag USING btree (refpag); CREATE INDEX i01cpmovadi ON cpmovadi USING btree (refadi); CREATE INDEX i01cpmovtra ON cpmovtra USING btree (reftra); CREATE INDEX i01cptrasla ON cptrasla USING btree (reftra, fectra); CREATE INDEX i02cpasiini ON cpasiini USING btree (codpre); CREATE INDEX i02cpimpcau ON cpimpcau USING btree (refcau, refere, refprc, codpre); CREATE INDEX i02cpimpcom ON cpimpcom USING btree (refcom, refere, codpre); CREATE INDEX i02cpimppag ON cpimppag USING btree (codpre); CREATE INDEX i03cpasiini ON cpasiini USING btree (codpre, perpre); CREATE INDEX i03cpimpcau ON cpimpcau USING btree (codpre); CREATE INDEX i03cpimpcom ON cpimpcom USING btree (codpre);