• Non ci sono risultati.

1 7LSLDVWUDWWL 7LSLHQQXSOD 7LSLHQQXSOD %DVLGLGDWL³2EMHFW5HODWLRQDO´ 0RGHOORGHLGDWLGL64/

N/A
N/A
Protected

Academic year: 2021

Condividi "1 7LSLDVWUDWWL 7LSLHQQXSOD 7LSLHQQXSOD %DVLGLGDWL³2EMHFW5HODWLRQDO´ 0RGHOORGHLGDWLGL64/"

Copied!
2
0
0

Testo completo

(1)

1

Paolo Atzeni, 21 maggio 1999 1

%DVLGLGDWL³2EMHFW5HODWLRQDO´

• Modello dei dati

• Linguaggio di interrogazione

• La futura (forse approvata in questi mesi) versione di SQL (noto come SQL-3 o forse SQL-99)

• Si tratta di una estensione “compatibile” di SQL-2 (cioè il codice SQL-2 è valido anche come SQL-3)

Paolo Atzeni, 21 maggio 1999 2

0RGHOORGHLGDWLGL64/

• È possibile definire tipi:

– tipi ennupla, con struttura anche complessa e con gerarchie:

• utilizzabili per definire tabelle con lo stesso schema

• utilizzabili come componenti

• utilizzabili nell’ambito di relationship – tipi astratti

Paolo Atzeni, 21 maggio 1999 3

7LSLHQQXSOD

create row type PersType Name varchar (30) not null, Residence varchar(30),

SSN char(16) primary key)

create table Professor of type PersType create table Student of type PersType

• le ennuple sono gli oggetti

• le relazioni le classi

• gli identificatori possono essere manipolabili

• si possono usare riferimenti e/o incorporare oggetti

Paolo Atzeni, 21 maggio 1999 4

7LSLHQQXSOD

create row type FactoryType(

Name varchar (25), City varchar (7), NoOfEmployees(7))

create row type ManufacturerType(

ManufID ref(ManufacturerType), Name varchar (25), President ref(PersType), Factories setof(FactoryType))

create row type CarPartType(

Engine char(10), SchockAbsorber char(5))

create row type AutoType(

RegistrationNumber char(10) primary key, Model varchar (30),

Maker ref(ManufacturerType), MechanicalParts ref(CarPartType))

Paolo Atzeni, 21 maggio 1999 5

create table Automobile of type AutoType

create table Manufacturer of type ManufacturerType values for ManufID are system generated scope for President is Professor

create row type VintageCarType(

Manufactureyear integer) under AutoType

FUHDWHWDEOH9LQWDJH&DURIW\SH9LQWDJH&DU7\SH XQGHU$XWRPRELOH

– DOWHUQDWLYDPHQWH PDFRQWLSR³QRQULXWLOL]]DELOH´  create table VintageCar(

Manufactureyear integer) under Automobile

Paolo Atzeni, 21 maggio 1999 6

7LSLDVWUDWWL

• permettono di definire tipi da utilizzare per i singoli attributi (anche a struttura complessa)

• possono avere funzioni associate (qui si ha la “estensibilità” del sistema di tipi), definite in SQL-3 o in linguaggi esterni

create type CarPartType(

Engine char(10), Power integer, Cylinders integer, greater than GreaterPower)

create function GreaterPower(:p1 CarPartType, p2: CarPartType) returns boolean;

returns ((:p1.Power > :p2.Power) or ((:p1.Power = :p2.Power and (:p1.Cylinders = :p2. Cylinders)))

(2)

2

Paolo Atzeni, 21 maggio 1999 7

,QWHUURJD]LRQLLQ64/

• Le interrogazioni SQL-2 sono ammesse in SQL-3

• Inoltre:

– si possono “seguire” i riferimenti – si possono citare gli OID (se visibili) – si può accedere alle strutture interne – si puo’ nidificare (nest) e denidificare (unnest)

Paolo Atzeni, 21 maggio 1999 8

,QWHUURJD]LRQLLQ64/

select President -> Name from Manufacturer where Name = ‘Fiat’

select Name

from Manufacturer, Industrial where Manufacturer.Name = ‘Fiat’

and Manufacturer.President = Industrial.ManufId

select Maker -> President -> Name from Automobile

where MechanicalParts..Motor = ‘XV154’

Paolo Atzeni, 21 maggio 1999 9

8QQHVWLQJHQHVWLQJLQ64/

select C.Name, S.City

from Manufacturer as C, C.Factories as S

select City, set(name) from manufacturer group by City

Riferimenti

Documenti correlati

The main result of this paper amounts to the fact that the intersection type se- mantics of a given term in context induces a partial function from Opponent to Proponent moves,

An alternative description of the interpretation of λ-terms in the game model is given by means of a type assignment system1. The equivalence between this description and

 Wait (and act) for a single thread within a large group of

The steps below for creating a two-variable data table follow a specific example (rather than using generic steps) to help you understand exactly how to use this feature.. The

First and second fundamental theorems are given for polynomial invariants of a class of pseudo-reflection groups (including the Weyl groups of type B n ), under the assumption that

[r]

,O'LUHWWRUHGHL/DYRULRO¶HVHFXWRUHFRPXQLFDQRDOUHVSRQVDELOHGHOSURFHGLPHQWROHFRQWHVWD]LRQL

.)) Or bene; la scuola tecnica, qual è oggi costituita, non soddisfa, a cre- dere nostro, che assai incompiutamente ad entrambi questi bisogni di coloro che la