SlideShare a Scribd company logo
1 of 11
JJJJ
Simone Matteoni
Dove eravamo
rimasti?
ah si avevo creato la
chiave per la testa,
mi accorgo solo ora
che è però presente
un errore,
nella tabella attività
collegata alla testa
non ho inserito
il codice della ditta,
e fatto in questo
modo funzionerà
ma non rappresenta
quello che voglio
ottenere,
cioè specificare per
ogni azienda
una o più attività con
proprio codice.
Simone Matteoni
Provvedo a correggere,
è possibile correggere,
anche una volta che il
software è in produzione,
ovviamente sarà più
complesso e rischioso,
ed è importante che
quindi il database
venga progettato
correttamente.
Aggiungeremo il codice società
all'interno dell'entità attività,
ovviamente sarà chiave
e sarà relazionato
per dipendenza all'entità
azienda e per referenza
all'entità testa,
sarà presente anche
una chiave in comune,
il codice società ma affronterò
il problema in seguito.
Ho due scelte:
1. Conteggiare l'ultimo numero emesso e incrementare una unità.
2. Utilizzare una tabella esterna che conterrà la mia chiave e gestire il contatore con
incremento.
Scelgo la seconda soluzione, molto più flessibile.
Il numeratore BIS nel caso venga usato sarà gestito manualmente dall’operatore.
Un'ultima piccola
osservazione, il numeratore
del documento è un attributo
della tabella, ma come
determino l'incremento?
Simone Matteoni
Avrei potuto crearla più semplice, ad esempio con un attributo auto incrementale o
gestire per ogni esercizio un progressivo, ma ritengo questa soluzione con chiave
parlante migliore e resto fermo su questa scelta.
In definitiva,
per fortuna non abbiamo
apportato grosse modifiche
alla nostra chiave.
Simone Matteoni
Chiave realizzata,
univocità e durata
garantita.
Mi occuperò ora,
del resto dei campi
necessari.
… … …
Il documento emesso
da un'azienda,
andrà intestato
ad un soggetto,
tipicamente
un cliente o un fornitore.
Simone Matteoni
Il dato come da logica
dovrà essere preso da
apposita tabella e sarà un
riferimento alla testa.
Userò una sola tabella per
cliente e fornitore,
inserendo nella
chiave il tipo.
Non mi interessa poter
gestire il progressivo.
Per il conteggio, quindi, in
questo caso il numero
verrà prelevato in fase di
inserimento dall'ultimo
record presente per tipo.
Simone Matteoni
... infine inseriremo il riferimento
sull’entità testa.
Simone Matteoni
Questo dato sarà
quindi una chiave
della mia tabella testa,
non primaria ma
esterna, questo tipo di
chiave non è
indicizzato e tornerò
su questo punto, non
permetterà in ogni
caso di inserire valori
non presenti nella
tabella di riferimento.
Chiaramente dalla
tabella referenziata
non potrò eliminare il
dato se presente in
altra tabella, e
nemmeno modificarlo,
ma che senso avrebbe
modificare una
chiave?
Tramite la relazione inserita, potremo in un secondo tempo
estrarre tutti i dati del soggetto collegato, alle volte tuttavia,
capita che i dati collegati non chiave vengano modificati, ad
esempio cambia la ragione sociale o l'indirizzo o il comune, e se
un domani dovessimo rivedere o stampare un documento
emesso non avremmo allineamento temporale.
Per questo motivo taluni dati li riporterò nella testa e li compilerò
in fase di creazione documento.
Il soggetto a cui intestiamo il
documento può poi avere più
sedi, e ad esempio potremmo
aver bisogno di spedire della
merce in una di esse, non è
ovviamente accettabile creare
un nuovo soggetto per
specificare questo dato.
Inseriremo quindi un'entità
relazionata.
Come sempre porremo la
referenza all'interno della
nostra tabella testa.
Simone Matteoni
Qui abbiamo un caso particolare, l'entità creata per essere relazionata alla tabella dei
soggetti deve avere tale chiave, ma la stessa è già presente nelle teste e quindi come
posso risolvere questo problema?
Possiamo ripetere lo stesso campo nella medesima tabella? No, non è possibile ...
Per ovviare possiamo operare in uno di questi modi:
1. usare campi con nomi diversi
2. usare un'ulteriore tabella con i riferimenti necessari
3. usare una chiave condivisa
Opto per la terza scelta, la chiave del cliente sarà anche quella di referenza all'entità
indirizzi, tanto non potrò inserire un indirizzo non esistente per un soggetto e gli indirizzi
di mio interesse sono quelli dell’intestatario.
Simone Matteoni
Infine, come ultima cosa, inserisco il pagamento legato al documento e i dati di
pagamento relativi al cliente.
Creerò apposita entità con le modalità di pagamento.
Quindi imposterò il legame al nostro documento.
Inserirò infine un'entità tramite cui specificherò i dati di pagamento relativi al soggetto
come ad esempio l‘IBAN, la stesse entità la legherò ai documenti per referenza e per
dipendenza al soggetto, con un progressivo interno potrò inserire più record.
Simone Matteoni
Bene direi che adesso
siamo a buon punto
per il completamento
della testa.
E adesso …
rilassiamoci …
Simone Matteoni

More Related Content

Featured

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Una testa perfetta - parte 2

  • 2. Dove eravamo rimasti? ah si avevo creato la chiave per la testa, mi accorgo solo ora che è però presente un errore, nella tabella attività collegata alla testa non ho inserito il codice della ditta, e fatto in questo modo funzionerà ma non rappresenta quello che voglio ottenere, cioè specificare per ogni azienda una o più attività con proprio codice. Simone Matteoni Provvedo a correggere, è possibile correggere, anche una volta che il software è in produzione, ovviamente sarà più complesso e rischioso, ed è importante che quindi il database venga progettato correttamente. Aggiungeremo il codice società all'interno dell'entità attività, ovviamente sarà chiave e sarà relazionato per dipendenza all'entità azienda e per referenza all'entità testa, sarà presente anche una chiave in comune, il codice società ma affronterò il problema in seguito.
  • 3. Ho due scelte: 1. Conteggiare l'ultimo numero emesso e incrementare una unità. 2. Utilizzare una tabella esterna che conterrà la mia chiave e gestire il contatore con incremento. Scelgo la seconda soluzione, molto più flessibile. Il numeratore BIS nel caso venga usato sarà gestito manualmente dall’operatore. Un'ultima piccola osservazione, il numeratore del documento è un attributo della tabella, ma come determino l'incremento? Simone Matteoni
  • 4. Avrei potuto crearla più semplice, ad esempio con un attributo auto incrementale o gestire per ogni esercizio un progressivo, ma ritengo questa soluzione con chiave parlante migliore e resto fermo su questa scelta. In definitiva, per fortuna non abbiamo apportato grosse modifiche alla nostra chiave. Simone Matteoni
  • 5. Chiave realizzata, univocità e durata garantita. Mi occuperò ora, del resto dei campi necessari. … … … Il documento emesso da un'azienda, andrà intestato ad un soggetto, tipicamente un cliente o un fornitore. Simone Matteoni
  • 6. Il dato come da logica dovrà essere preso da apposita tabella e sarà un riferimento alla testa. Userò una sola tabella per cliente e fornitore, inserendo nella chiave il tipo. Non mi interessa poter gestire il progressivo. Per il conteggio, quindi, in questo caso il numero verrà prelevato in fase di inserimento dall'ultimo record presente per tipo. Simone Matteoni ... infine inseriremo il riferimento sull’entità testa.
  • 7. Simone Matteoni Questo dato sarà quindi una chiave della mia tabella testa, non primaria ma esterna, questo tipo di chiave non è indicizzato e tornerò su questo punto, non permetterà in ogni caso di inserire valori non presenti nella tabella di riferimento. Chiaramente dalla tabella referenziata non potrò eliminare il dato se presente in altra tabella, e nemmeno modificarlo, ma che senso avrebbe modificare una chiave? Tramite la relazione inserita, potremo in un secondo tempo estrarre tutti i dati del soggetto collegato, alle volte tuttavia, capita che i dati collegati non chiave vengano modificati, ad esempio cambia la ragione sociale o l'indirizzo o il comune, e se un domani dovessimo rivedere o stampare un documento emesso non avremmo allineamento temporale. Per questo motivo taluni dati li riporterò nella testa e li compilerò in fase di creazione documento.
  • 8. Il soggetto a cui intestiamo il documento può poi avere più sedi, e ad esempio potremmo aver bisogno di spedire della merce in una di esse, non è ovviamente accettabile creare un nuovo soggetto per specificare questo dato. Inseriremo quindi un'entità relazionata. Come sempre porremo la referenza all'interno della nostra tabella testa. Simone Matteoni
  • 9. Qui abbiamo un caso particolare, l'entità creata per essere relazionata alla tabella dei soggetti deve avere tale chiave, ma la stessa è già presente nelle teste e quindi come posso risolvere questo problema? Possiamo ripetere lo stesso campo nella medesima tabella? No, non è possibile ... Per ovviare possiamo operare in uno di questi modi: 1. usare campi con nomi diversi 2. usare un'ulteriore tabella con i riferimenti necessari 3. usare una chiave condivisa Opto per la terza scelta, la chiave del cliente sarà anche quella di referenza all'entità indirizzi, tanto non potrò inserire un indirizzo non esistente per un soggetto e gli indirizzi di mio interesse sono quelli dell’intestatario. Simone Matteoni
  • 10. Infine, come ultima cosa, inserisco il pagamento legato al documento e i dati di pagamento relativi al cliente. Creerò apposita entità con le modalità di pagamento. Quindi imposterò il legame al nostro documento. Inserirò infine un'entità tramite cui specificherò i dati di pagamento relativi al soggetto come ad esempio l‘IBAN, la stesse entità la legherò ai documenti per referenza e per dipendenza al soggetto, con un progressivo interno potrò inserire più record. Simone Matteoni
  • 11. Bene direi che adesso siamo a buon punto per il completamento della testa. E adesso … rilassiamoci … Simone Matteoni