1 / 15

Indici

Indici. elenco di valori di un attributo a ciascuno dei quali è associato l’elenco delle posizioni (righe) del valore nella tabella create [ unique ] [ bitmap ] index <nome_indice> on <tabella> (<colonna/e>); drop index <nome_indice>;. Esempi.

grant
Télécharger la présentation

Indici

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Indici • elenco di valori di un attributo a ciascuno dei quali è associato l’elenco delle posizioni (righe) del valore nella tabella create [unique] [bitmap] index <nome_indice> on <tabella> (<colonna/e>); dropindex <nome_indice>; SQL

  2. Esempi create index INOME_IMPIEGATI on IMPIEGATI(INOME); create unique index PNOME_PMGR_PROGETTO on PROGETTO(PNOME, PMGR); SQL

  3. Esempi create bitmap index DIPNO_IMPIEGATI on IMPIEGATI(DIPNO); 10:<0,0,0,0,1> 20:<1,0,0,0,0> 30:<0,1,1,1,0> SQL

  4. Sequenze createsequence <nome_seq> [increment by <intero>] [start with <intero>] [maxvalue <intero> | nomaxvalue] [minvalue <intero> | nominvalue]; SQL

  5. Esempi create sequence IDIMP increment by 1 start with 7000; insert into IMPIEGATI values (IDIMP.nextval, …); insert into ANAGRAFICA values (IDIMP.currval, …); SQL

  6. Dizionario dei dati di Oracle • Descrizione delle tabelle presenti nella base di dati … organizzato in tabelle • Le tabelle del dizionario dei dati contengono metadati (dati che descrivono dati) SQL

  7. Dizionario dei dati di Oracle • livello interno: tabelle che contengono la descrizione di tutte le strutture della base di dati • livello esterno: insieme di viste sulle tabelle del livello interno SQL

  8. Viste del dizionario dei dati • user_: informazioni sugli oggetti dell’utente • all_: informazioni sugli oggetti dell’utente e sugli oggetti accessibili dall’utente • dba_: informazioni su tutti gli oggetti del database SQL

  9. Viste USER_ • user_tables (tabs) • user_catalog (cat) • user_col_comments • user_constraints • user_indexes (ind) • user_tab_columns (cols) • user_tab_comments • user_triggers • user_users • user_views SQL

  10. Esempio SQL> select table_name from tabs; TABLE_NAME ------------------------------ DIPARTIMENTO IMPIEGATI SALARI SQL

  11. Esempio SQL> select table_name, column_name, data_type from cols; TABLE_NAME COLUMN_NAME DATA_TYPE ------------------------------ ------------------------------ ---------------- DIPARTIMENTO DIPNO NUMBER DIPARTIMENTO DIPNOME VARCHAR2 DIPARTIMENTO CITTA VARCHAR2 IMPIEGATI INO NUMBER IMPIEGATI INOME VARCHAR2 IMPIEGATI LAVORO CHAR IMPIEGATI CAPO NUMBER IMPIEGATI DATA_ASS DATE IMPIEGATI STIPENDIO NUMBER IMPIEGATI DIPNO NUMBER SALARI LIVELLO NUMBER SALARI MINSAL NUMBER SALARI MAXSAL NUMBER Selezionate 13 righe. SQL

  12. Esempio SQL> select username, user_id, created from user_users; USERNAME USER_ID CREATED ------------------------------ --------- --------- CECILIA 20 08-FEB-01 SQL

  13. TESSERA ISBN TITOLO COGNOME NOME RESIDENZA AUTORE STATO PRESTITO NUMTES DATA PRESTITO Esercizio • Biblioteca semplice tabella UTENTE tabella LIBRO SQL

  14. COD MATRICOLA SIGLA COGNOME TITOLO NOME INDIRIZZO TIPOL EMAIL TIPOD L_D 1 1000 ProgI ROSSI Programmazione I PAOLO Via Bronzino, 4 – Firenze fo rossi@libero.it fo L 1001 2 ArchI BIANCHI Architettura degli Elaboratori I STEFANO Via Roma, 7 – Prato fo fo D 3 MDA Matematica Discreta: Algebra fo fo 4 LabP Laboratorio di Informatica: Programmazione lf lf 5 AMCD Analisi Matematica I: Calcolo Differenziale fo fo Esercizio • Universita’ tabella CORSO tabella STUDENTE SQL

  15. CODDIP COD_MATERIA DOC CODD COR COGNOME DENOMINAZIONE AFFIDAMENTO MATR_STUD NOME VOTO DIP LODE DATA CREDITI DOCENTE 10 100 100 1 1 AGUZZI Dipartimento di Sistemi e Informatica T 1000 GIANNI 25 10 6 100 20 101 2 104 2 MARCJA Dipartimento di Matematica T 1000 ANNALISA 21 20 6 104 101 30 3 102 3 PERGOLA Dipartimento di Energetica T 1000 ELISA 28 10 6 101 103 102 5 4 MAGNANINI S 1001 ROLANDO 27 20 6 103 103 104 2 5 BONDAVALLI T 1001 ANDREA 30 10 6 104 3 1001 27 6 101 tabella DIPARTIMENTO tabella DOCENTE tabella ESAME tabella DOCENTE-CORSO

More Related