SlideShare a Scribd company logo
1 of 25
BASI DI DATI ESERCITAZIONI -2- MSSQL - SQL Email: francesco.magagnino@ewave.it Università di Trento Corso di Laurea in Ingegneria dell’Informazione e dell’Organizzazione
NORTWIND  TABLES MSSQL 2000
NORTWIND  TABLES MSSQL 2005
MSSQL 2000 NORTWIND  TABLE Orders Table Design Table Per impostare un contatore Identity = Yes Per impostare Primary Key Pulsante dx -> Set Primary Key
Per impostare un contatore Identity = Yes Per impostare Primary Key Pulsante dx -> Set Primary Key MSSQL 2005 NORTWIND  TABLE Orders Table Design Table
Vincoli ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Data types -1- ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Data types -2- ,[object Object],[object Object],[object Object],[object Object],[object Object]
Data types -3- TextArea tipico campo da   NText TextField tipico campo da   Nvarchar
A globally unique identifier   uniqueidentifier   A database-wide unique number that gets updated every time a row gets updated   timestamp   A special data type used to store a result set for later processing   table   A data type that stores values of various data types, except text, ntext, timestamp, and sql_variant   sql_variant   A reference to a cursor   cursor   Variable-length binary data with a maximum length of 2^31 - 1 bytes   image   Variable-length binary data with a maximum length of 8,000 bytes   varbinary   Fixed-length binary data with a maximum length of 8,000 bytes   binary   Variable-length Unicode data with a maximum length of 2^30 - 1 characters   ntext   Variable-length Unicode data with a maximum length of 4,000 characters   nvarchar   Fixed-length Unicode data with a maximum length of 4,000 characters   nchar   Variable-length data with a maximum length of 2^31 - 1 characters   text   Variable-length data with a maximum of 8,000 characters   varchar   Fixed-length character data with a maximum length of 8,000 characters   char   Date and time data from January 1, 1900, through June 6, 2079, with an accuracy of one minute   smalldatetime   Date and time data from January 1, 1753, through December 31, 9999, with an accuracy of 3.33 milliseconds   datetime   Floating precision number data from -3.40E + 38 through 3.40E + 38   real   Floating precision number data from -1.79E + 308 through 1.79E + 308   float   Monetary data values from -214,748.3648 through +214,748.3647   smallmoney   Monetary data values from -2^63 through 2^63 - 1   money   Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1   numeric   Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1   decimal   Integer data with either a 1 or 0 value   bit   Integer data from 0 through 255   tinyint   Integer data from -2^15 through 2^15 - 1   smallint   Integer data from -2^31 through 2^31 - 1   int   Integer data from -2^63 through 2^63-1   bigint   Description   Data Types
Da sapere ,[object Object],[object Object]
Views ,[object Object],[object Object],[object Object],[object Object]
[object Object],NORTWIND  VIEWS Design View
 
Stored Procedures ,[object Object],[object Object],[object Object],[object Object]
Le Stored Procedures permettono di togliere tutto il carico di lavoro dall’applicazione esterna. L’applicazione non fa altro che passare le variabili alla SP.
Sintassi tabelle ,[object Object],[object Object],[object Object],[object Object],[object Object]
Sintassi tabelle di relazione ,[object Object],[object Object],[object Object],[object Object]
Sintassi Views e Stored Procedures ,[object Object],[object Object],[object Object],[object Object],[object Object]
Riassunto sulla sintassi in SQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ESERCIZIO ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ESERCIZIO
 
Lavorando sulle Views (e iniziando a guardare Sql) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Lavorando sulle Views (e iniziando a guardare Sql) ,[object Object],[object Object],[object Object]

More Related Content

What's hot (6)

primi comandi SQL con Mysql
primi comandi SQL con Mysqlprimi comandi SQL con Mysql
primi comandi SQL con Mysql
 
Sql 1
Sql 1Sql 1
Sql 1
 
IBM i db2 udb vs Microsoft SQL Server
IBM i db2 udb vs Microsoft SQL ServerIBM i db2 udb vs Microsoft SQL Server
IBM i db2 udb vs Microsoft SQL Server
 
MySQL
MySQLMySQL
MySQL
 
Strutture dati 07-multiindex
Strutture dati 07-multiindexStrutture dati 07-multiindex
Strutture dati 07-multiindex
 
12 Struct
12   Struct12   Struct
12 Struct
 

Similar to Basi Di Dati 02

Lezione 20 (2 maggio 2012) prima parte
Lezione 20 (2 maggio 2012) prima parteLezione 20 (2 maggio 2012) prima parte
Lezione 20 (2 maggio 2012) prima parte
STELITANO
 
Lezione 10 (21 marzo 2012)
Lezione 10 (21 marzo 2012)Lezione 10 (21 marzo 2012)
Lezione 10 (21 marzo 2012)
STELITANO
 
Lezione 10 (21 marzo 2012)
Lezione 10 (21 marzo 2012)Lezione 10 (21 marzo 2012)
Lezione 10 (21 marzo 2012)
STELITANO
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
guest5c2d35b
 
Presentazione Nuvola Vertica Full
Presentazione Nuvola Vertica FullPresentazione Nuvola Vertica Full
Presentazione Nuvola Vertica Full
Alberto.F
 
Presentazione Nuvola Vertica F
Presentazione Nuvola Vertica FPresentazione Nuvola Vertica F
Presentazione Nuvola Vertica F
Alberto.F
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
Alberto.F
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
Alberto.F
 
Presentazione Nuvola Vertica Full New
Presentazione Nuvola Vertica Full NewPresentazione Nuvola Vertica Full New
Presentazione Nuvola Vertica Full New
Alberto.F
 
06 1 array_stringhe_typedef
06 1 array_stringhe_typedef06 1 array_stringhe_typedef
06 1 array_stringhe_typedef
Piero Fraternali
 
Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...
Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...
Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...
laboratoridalbasso
 
ECDL modulo 1 ud1: algoritmi rappr informazione
ECDL modulo 1 ud1: algoritmi rappr informazioneECDL modulo 1 ud1: algoritmi rappr informazione
ECDL modulo 1 ud1: algoritmi rappr informazione
Fabio Cantaro
 
Access parte terza
Access parte terzaAccess parte terza
Access parte terza
Matekanc
 

Similar to Basi Di Dati 02 (20)

Data profiling
Data profilingData profiling
Data profiling
 
1.02 Rappresentazione dei dati
1.02 Rappresentazione dei dati1.02 Rappresentazione dei dati
1.02 Rappresentazione dei dati
 
SQL Server2000
SQL Server2000SQL Server2000
SQL Server2000
 
Database
DatabaseDatabase
Database
 
Lezione 20 (2 maggio 2012) prima parte
Lezione 20 (2 maggio 2012) prima parteLezione 20 (2 maggio 2012) prima parte
Lezione 20 (2 maggio 2012) prima parte
 
Lezione 10 (21 marzo 2012)
Lezione 10 (21 marzo 2012)Lezione 10 (21 marzo 2012)
Lezione 10 (21 marzo 2012)
 
Lezione 10 (21 marzo 2012)
Lezione 10 (21 marzo 2012)Lezione 10 (21 marzo 2012)
Lezione 10 (21 marzo 2012)
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
 
Presentazione Nuvola Vertica Full
Presentazione Nuvola Vertica FullPresentazione Nuvola Vertica Full
Presentazione Nuvola Vertica Full
 
Presentazione Nuvola Vertica F
Presentazione Nuvola Vertica FPresentazione Nuvola Vertica F
Presentazione Nuvola Vertica F
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
 
Presentazione Nuvola Vertica Full New
Presentazione Nuvola Vertica Full NewPresentazione Nuvola Vertica Full New
Presentazione Nuvola Vertica Full New
 
06 1 array_stringhe_typedef
06 1 array_stringhe_typedef06 1 array_stringhe_typedef
06 1 array_stringhe_typedef
 
Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...
Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...
Ldb 25 strumenti gis e webgis_2014-05-15 gullotta - 4 tabelle attributi e lor...
 
corso web - Introduzione ai Database
corso web - Introduzione ai Databasecorso web - Introduzione ai Database
corso web - Introduzione ai Database
 
ECDL modulo 1 ud1: algoritmi rappr informazione
ECDL modulo 1 ud1: algoritmi rappr informazioneECDL modulo 1 ud1: algoritmi rappr informazione
ECDL modulo 1 ud1: algoritmi rappr informazione
 
noSQL La nuova frontiera dei Database [DB05-S]
noSQL La nuova frontiera dei Database [DB05-S]noSQL La nuova frontiera dei Database [DB05-S]
noSQL La nuova frontiera dei Database [DB05-S]
 
Access parte terza
Access parte terzaAccess parte terza
Access parte terza
 
Information technology
Information technologyInformation technology
Information technology
 

More from Francesco Magagnino

Wiki for Governance Risk and Compliance
Wiki for Governance Risk and ComplianceWiki for Governance Risk and Compliance
Wiki for Governance Risk and Compliance
Francesco Magagnino
 
Web-line. From web 1.0 to web 2.0 and on!
Web-line. From web 1.0 to web 2.0 and on!Web-line. From web 1.0 to web 2.0 and on!
Web-line. From web 1.0 to web 2.0 and on!
Francesco Magagnino
 
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Tesi
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - TesiIl Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Tesi
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Tesi
Francesco Magagnino
 
Considerazioni E Mail Marketing, Spamming E Ipersfruttamento Delle Risorse ...
Considerazioni   E Mail Marketing, Spamming E Ipersfruttamento Delle Risorse ...Considerazioni   E Mail Marketing, Spamming E Ipersfruttamento Delle Risorse ...
Considerazioni E Mail Marketing, Spamming E Ipersfruttamento Delle Risorse ...
Francesco Magagnino
 
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Presen...
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Presen...Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Presen...
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Presen...
Francesco Magagnino
 

More from Francesco Magagnino (9)

Presentazione TEDxVerona a AIDP 2015
Presentazione TEDxVerona a AIDP 2015Presentazione TEDxVerona a AIDP 2015
Presentazione TEDxVerona a AIDP 2015
 
Enterprise 2.0 Framework
Enterprise 2.0 FrameworkEnterprise 2.0 Framework
Enterprise 2.0 Framework
 
Wiki for Governance Risk and Compliance
Wiki for Governance Risk and ComplianceWiki for Governance Risk and Compliance
Wiki for Governance Risk and Compliance
 
L’approccio web 2.0 e le sue ricadute sulle applicazioni di E-Learning: lo ...
L’approccio web 2.0 e le sue ricadute sulle applicazioni di E-Learning: lo ...L’approccio web 2.0 e le sue ricadute sulle applicazioni di E-Learning: lo ...
L’approccio web 2.0 e le sue ricadute sulle applicazioni di E-Learning: lo ...
 
L’approccio web 2.0 e le sue ricadute sulle applicazioni di E-Learning: lo ...
L’approccio web 2.0 e le sue ricadute sulle applicazioni di E-Learning: lo ...L’approccio web 2.0 e le sue ricadute sulle applicazioni di E-Learning: lo ...
L’approccio web 2.0 e le sue ricadute sulle applicazioni di E-Learning: lo ...
 
Web-line. From web 1.0 to web 2.0 and on!
Web-line. From web 1.0 to web 2.0 and on!Web-line. From web 1.0 to web 2.0 and on!
Web-line. From web 1.0 to web 2.0 and on!
 
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Tesi
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - TesiIl Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Tesi
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Tesi
 
Considerazioni E Mail Marketing, Spamming E Ipersfruttamento Delle Risorse ...
Considerazioni   E Mail Marketing, Spamming E Ipersfruttamento Delle Risorse ...Considerazioni   E Mail Marketing, Spamming E Ipersfruttamento Delle Risorse ...
Considerazioni E Mail Marketing, Spamming E Ipersfruttamento Delle Risorse ...
 
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Presen...
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Presen...Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Presen...
Il Modello Pragmatico Elementare per lo sviluppo di Sistemi Adattivi - Presen...
 

Basi Di Dati 02

  • 1. BASI DI DATI ESERCITAZIONI -2- MSSQL - SQL Email: francesco.magagnino@ewave.it Università di Trento Corso di Laurea in Ingegneria dell’Informazione e dell’Organizzazione
  • 2. NORTWIND TABLES MSSQL 2000
  • 3. NORTWIND TABLES MSSQL 2005
  • 4. MSSQL 2000 NORTWIND TABLE Orders Table Design Table Per impostare un contatore Identity = Yes Per impostare Primary Key Pulsante dx -> Set Primary Key
  • 5. Per impostare un contatore Identity = Yes Per impostare Primary Key Pulsante dx -> Set Primary Key MSSQL 2005 NORTWIND TABLE Orders Table Design Table
  • 6.
  • 7.
  • 8.
  • 9. Data types -3- TextArea tipico campo da NText TextField tipico campo da Nvarchar
  • 10. A globally unique identifier uniqueidentifier A database-wide unique number that gets updated every time a row gets updated timestamp A special data type used to store a result set for later processing table A data type that stores values of various data types, except text, ntext, timestamp, and sql_variant sql_variant A reference to a cursor cursor Variable-length binary data with a maximum length of 2^31 - 1 bytes image Variable-length binary data with a maximum length of 8,000 bytes varbinary Fixed-length binary data with a maximum length of 8,000 bytes binary Variable-length Unicode data with a maximum length of 2^30 - 1 characters ntext Variable-length Unicode data with a maximum length of 4,000 characters nvarchar Fixed-length Unicode data with a maximum length of 4,000 characters nchar Variable-length data with a maximum length of 2^31 - 1 characters text Variable-length data with a maximum of 8,000 characters varchar Fixed-length character data with a maximum length of 8,000 characters char Date and time data from January 1, 1900, through June 6, 2079, with an accuracy of one minute smalldatetime Date and time data from January 1, 1753, through December 31, 9999, with an accuracy of 3.33 milliseconds datetime Floating precision number data from -3.40E + 38 through 3.40E + 38 real Floating precision number data from -1.79E + 308 through 1.79E + 308 float Monetary data values from -214,748.3648 through +214,748.3647 smallmoney Monetary data values from -2^63 through 2^63 - 1 money Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1 numeric Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1 decimal Integer data with either a 1 or 0 value bit Integer data from 0 through 255 tinyint Integer data from -2^15 through 2^15 - 1 smallint Integer data from -2^31 through 2^31 - 1 int Integer data from -2^63 through 2^63-1 bigint Description Data Types
  • 11.
  • 12.
  • 13.
  • 14.  
  • 15.
  • 16. Le Stored Procedures permettono di togliere tutto il carico di lavoro dall’applicazione esterna. L’applicazione non fa altro che passare le variabili alla SP.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 23.  
  • 24.
  • 25.