CREATE TABLE CarsCustomers (
CodiceFiscale CHAR ( 16 ) NOT NULL,
Lastname CHAR ( 20 ) ,
Name CHAR ( 20 ) ,
BirthdayDate DATE,
Address CHAR ( 80 ) ,
PRIMARY KEY ( CodiceFiscale)
) ;
CREATE TABLE Cars (
ChassisNumber CHAR ( 20 ) NOT NULL,
Brand CHAR ( 20 ) ,
Model CHAR ( 20 ) ,
RegistrationDate DATE,
CodiceFiscale CHAR ( 16 ) CONSTRAINT CustomerCar REFERENCES CarsCustomers ( CodiceFiscale) ,
PRIMARY KEY ( ChassisNumber)
) ;
CREATE TABLE Insurances (
ChassisNumber CHAR ( 20 ) NOT NULL UNIQUE CONSTRAINT CarsInsurances REFERENCES Cars ( ChassisNumber) ,
InsurancesDate DATE,
InsurancesNumber INT,
AnnualCost MONEY,
PRIMARY KEY ( ChassisNumber)
) ;
INSERT INTO CarsCustomers VALUES ( "RSSMRA80A01F205X" , "Rossi" , "Mario" , "01-01-1980" , "Via dei Girasoli 20, Torino" ) ;
INSERT INTO CarsCustomers VALUES ( "BNCRRT80A47L219L" , "Bianchi" , "Roberta" , "07-01-1980" , "Via Roma 100, Torino" ) ;
INSERT INTO CarsCustomers VALUES ( "VRDPLA70R07I726H" , "Verdi" , "Paolo" , "07-10-1970" , "Via dei Ciclamini 128, Siena" ) ;
INSERT INTO Cars VALUES ( "FIAT50034567890ABCDF" , "FIAT" , "500" , "31-01-2020" , "RSSMRA80A01F205X" ) ;
INSERT INTO Cars VALUES ( "FIAT01234567890PUNTO" , "FIAT" , "Grande Punto" , "31-01-2018" , "RSSMRA80A01F205X" ) ;
INSERT INTO Cars VALUES ( "FORD500345678ESCORT1" , "Ford" , "Escort" , "22-07-2018" , "VRDPLA70R07I726H" ) ;
INSERT INTO Cars VALUES ( "OPEL111345678DICORSA" , "Opel" , "Corsa" , "30-08-2019" , "BNCRRT80A47L219L" ) ;
UPDATE Cars SET RegistrationDate = "23-08-2018" WHERE ChassisNumber= "FORD500345678ESCORT1" ;
INSERT INTO Insurances VALUES ( "FIAT50034567890ABCDF" , "31-01-2020" , 1010.99 ) ;
INSERT INTO Insurances VALUES ( "FIAT01234567890PUNTO" , "31-12-2019" , 1310.00 ) ;
INSERT INTO Insurances VALUES ( "FORD500345678ESCORT1" , "15-02-2019" , 801.50 ) ;
INSERT INTO Insurances VALUES ( "OPEL111345678DICORSA" , "30-08-2020" , 320.80 ) ;
SELECT * FROM CarsCustomers;
SELECT * FROM Cars;
SELECT * FROM Insurances;
Q1JFQVRFIFRBQkxFIENhcnNDdXN0b21lcnMgKAogICBDb2RpY2VGaXNjYWxlIENIQVIgKDE2KSBOT1QgTlVMTCwKICAgTGFzdG5hbWUgQ0hBUiAoMjApLAogICBOYW1lIENIQVIgKDIwKSwKICAgQmlydGhkYXlEYXRlIERBVEUsCiAgIEFkZHJlc3MgQ0hBUiAoODApLAogICBQUklNQVJZIEtFWSAoQ29kaWNlRmlzY2FsZSkKKTsgCgpDUkVBVEUgVEFCTEUgQ2FycyAoCiAgIENoYXNzaXNOdW1iZXIgQ0hBUiAoMjApIE5PVCBOVUxMLAogICBCcmFuZCBDSEFSICgyMCksCiAgICBNb2RlbCBDSEFSICgyMCksCiAgICBSZWdpc3RyYXRpb25EYXRlIERBVEUsCiAgICBDb2RpY2VGaXNjYWxlIENIQVIgKDE2KSBDT05TVFJBSU5UIEN1c3RvbWVyQ2FyIFJFRkVSRU5DRVMgQ2Fyc0N1c3RvbWVycyAoQ29kaWNlRmlzY2FsZSksCiAgICBQUklNQVJZIEtFWSAoQ2hhc3Npc051bWJlcikKKTsKCkNSRUFURSBUQUJMRSBJbnN1cmFuY2VzICgKICAgQ2hhc3Npc051bWJlciBDSEFSICgyMCkgTk9UIE5VTEwgVU5JUVVFIENPTlNUUkFJTlQgQ2Fyc0luc3VyYW5jZXMgUkVGRVJFTkNFUyBDYXJzIChDaGFzc2lzTnVtYmVyKSwKICAgSW5zdXJhbmNlc0RhdGUgREFURSwKICAgICBJbnN1cmFuY2VzTnVtYm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