Advertisement
Guest User

Deviad

a guest
Aug 24th, 2009
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 3.00 KB | None | 0 0
  1. DROP DATABASE IF EXISTS premiere;
  2.  
  3. CREATE DATABASE premiere;
  4.  
  5. USE premiere;
  6. drop table if exists Articoli;
  7. create table if not exists Articoli(
  8.                   NroArt char(4) primary key,
  9.                   descrizione char(20),
  10.                   giacenza int,
  11.                   categoria char (2),
  12.                   PrezzoUnitario decimal(8,2)
  13. ) ENGINE=INNODB;
  14. drop table if exists Rappresentanti;
  15.  
  16. create table if not exists Rappresentanti(
  17.                  CodRappr char(2) primary key,
  18.                  cognome char(10),
  19.                  nome char(8),
  20.                  via char (15),
  21.                  citta char(15),
  22.                  prov char(2),
  23.                  cap char (5),
  24.                  TotProvv decimal(8,2),
  25.                  PerProvv decimal(8,2)
  26. ) ENGINE=INNODB;
  27.  
  28. drop table if exists Clienti;
  29. create table if not exists clienti(
  30.                 CodCliente char(3) primary key,
  31.                   cognome char(10),
  32.                   nome char(8),
  33.                   via char (15),
  34.                   citta char(15),
  35.                   prov char(2),
  36.                   cap char (5),
  37.                   saldo decimal(8,2),
  38.                   fido decimal(8,2),
  39.                   CodRappr char(2) references Rappresentanti(CodRappr)
  40. ) ENGINE=INNODB;
  41.  
  42. drop table if exists Ordini;
  43. create table if not exists Ordini(NroOrdine char(6) primary key,
  44.                   data date,
  45.                   CodCliente char(3) references Clienti(CodClienti)
  46. ) ENGINE=INNODB;
  47.  
  48.  
  49. insert into articoli values
  50.             ('AX12','ferro da stiro',104,'cs',24.95),
  51.             ('AZ52','freccette',20,'sp',12.95),
  52.             ('BA74','pallone',40,'sp',29.95),
  53.             ('BH22','tritatutto',05,'cs',24.95),
  54.             ('BT04','forno',11,'el',149.49),
  55.             ('BZ66','lavatrice',52,'el',399.99),
  56.             ('CA14','setaccio',78,'cs',39.99),
  57.             ('CB03','bicicletta',44,'sp',299.99),
  58.             ('CX11','frullino',142,'cs',22.95),
  59.             ('CZ81','tavola pesi',68,'sp',349.95);
  60.  
  61.  
  62. insert into Rappresentanti values
  63.             ('03','Jones','Mary','123 Main','Grant','MI','49219',215,5),
  64.             ('06','Smith','William','102 Raymond','Ada','MI','49441',49412.5,7),
  65.             ('12','Diaz','Miguel','419 Harper','Lansing','MI','49224',2150,5);
  66.  
  67.  
  68. insert into clienti values
  69.             ('124','Adams','Sally','481Oak','Lansing','MI','49224',818.75,1000,'03'),
  70.             ('256','Samuel','Ann','215Pete','Grant','MI','49219',21.5,1500,'06'),
  71.             ('311','Charles','Don','48College','Ira','MI','49034',825.75,1000,'12'),
  72.             ('315','Daniels','Tom','914Charry','Kent','MI','48391',770.75,750,'06'),
  73.             ('405','Williams','Al','519Watson','Grant','MI','49219',402.75,1500,'12'),
  74.             ('412','Adams','Sally','16Elm','Lansing','MI','49224',1817.5,2000,'03'),
  75.             ('522','Nelson','Mary','108Pine','Ada','MI','49441',98.75,1500,'12'),
  76.             ('567','Dinh','Tran','808Ridge','Harper','MI','48421',402.4,750,'06'),
  77.             ('587','Galvez','Mara','512Pine','Ada','MI','49441',114.6,1000,'06'),
  78.             ('622','Martin','Dan','419Chip','Grant','MI','49219',1045.75,1000,'03');
  79.  
  80.  
  81. insert into  ordini values
  82.             ('12489','2002-09-02','124'),
  83.             ('12491','2002-09-02','311'),
  84.             ('12494','2002-09-04','315'),
  85.             ('12495','2002-09-04','256'),
  86.             ('12498','2002-09-05','522'),
  87.             ('12500','2002-09-05','124'),
  88.             ('12504','2002-09-05','522');
  89.  
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement