fork(3) download
  1. CREATE TABLE CarsCustomers (
  2. CodiceFiscale CHAR (16) NOT NULL,
  3. Lastname CHAR (20),
  4. Name CHAR (20),
  5. BirthdayDate DATE,
  6. Address CHAR (80),
  7. PRIMARY KEY (CodiceFiscale)
  8. );
  9.  
  10. CREATE TABLE Cars (
  11. ChassisNumber CHAR (20) NOT NULL,
  12. Brand CHAR (20),
  13. Model CHAR (20),
  14. RegistrationDate DATE,
  15. CodiceFiscale CHAR (16) CONSTRAINT CustomerCar REFERENCES CarsCustomers (CodiceFiscale),
  16. PRIMARY KEY (ChassisNumber)
  17. );
  18.  
  19. CREATE TABLE Insurances (
  20. ChassisNumber CHAR (20) NOT NULL UNIQUE CONSTRAINT CarsInsurances REFERENCES Cars (ChassisNumber),
  21. InsurancesDate DATE,
  22. InsurancesNumber INT,
  23. AnnualCost MONEY,
  24. PRIMARY KEY (ChassisNumber)
  25. );
  26.  
  27. INSERT INTO CarsCustomers VALUES ("RSSMRA80A01F205X","Rossi","Mario", "01-01-1980", "Via dei Girasoli 20, Torino");
  28. INSERT INTO CarsCustomers VALUES ("BNCRRT80A47L219L","Bianchi","Roberta", "07-01-1980", "Via Roma 100, Torino");
  29. INSERT INTO CarsCustomers VALUES ("VRDPLA70R07I726H","Verdi","Paolo", "07-10-1970", "Via dei Ciclamini 128, Siena");
  30.  
  31. INSERT INTO Cars VALUES ("FIAT50034567890ABCDF","FIAT", "500","31-01-2020", "RSSMRA80A01F205X");
  32. INSERT INTO Cars VALUES ("FIAT01234567890PUNTO","FIAT", "Grande Punto","31-01-2018", "RSSMRA80A01F205X");
  33. INSERT INTO Cars VALUES ("FORD500345678ESCORT1","Ford", "Escort","22-07-2018", "VRDPLA70R07I726H");
  34. INSERT INTO Cars VALUES ("OPEL111345678DICORSA","Opel", "Corsa","30-08-2019", "BNCRRT80A47L219L");
  35.  
  36. UPDATE Cars SET RegistrationDate = "23-08-2018" WHERE ChassisNumber="FORD500345678ESCORT1";
  37.  
  38. INSERT INTO Insurances VALUES ("FIAT50034567890ABCDF","31-01-2020",1010.99);
  39. INSERT INTO Insurances VALUES ("FIAT01234567890PUNTO","31-12-2019", 1310.00);
  40. INSERT INTO Insurances VALUES ("FORD500345678ESCORT1","15-02-2019",801.50);
  41. INSERT INTO Insurances VALUES ("OPEL111345678DICORSA","30-08-2020", 320.80);
  42.  
  43. SELECT * FROM CarsCustomers;
  44. SELECT * FROM Cars;
  45. SELECT * FROM Insurances;
  46.  
Success #stdin #stdout #stderr 0s 4460KB
stdin
Standard input is empty
stdout
RSSMRA80A01F205X|Rossi|Mario|01-01-1980|Via dei Girasoli 20, Torino
BNCRRT80A47L219L|Bianchi|Roberta|07-01-1980|Via Roma 100, Torino
VRDPLA70R07I726H|Verdi|Paolo|07-10-1970|Via dei Ciclamini 128, Siena
FIAT50034567890ABCDF|FIAT|500|31-01-2020|RSSMRA80A01F205X
FIAT01234567890PUNTO|FIAT|Grande Punto|31-01-2018|RSSMRA80A01F205X
FORD500345678ESCORT1|Ford|Escort|23-08-2018|VRDPLA70R07I726H
OPEL111345678DICORSA|Opel|Corsa|30-08-2019|BNCRRT80A47L219L
stderr
Error: near line 38: table Insurances has 4 columns but 3 values were supplied
Error: near line 39: table Insurances has 4 columns but 3 values were supplied
Error: near line 40: table Insurances has 4 columns but 3 values were supplied
Error: near line 41: table Insurances has 4 columns but 3 values were supplied