-- Collection of code snippets by Arne Vajhøj 
-- posted to eksperten.dk, usenet and other places (2002-now) 
CREATE TABLE lottotraekning (
  trid INTEGER NOT NULL AUTO_INCREMENT,
  dato DATE NOT NULL,
  PRIMARY KEY (trid)
);

CREATE TABLE lottotal (
  trid INTEGER NOT NULL,
  nummer INTEGER NOT NULL,
  PRIMARY KEY  (trid, nummer)
);

INSERT INTO lottotraekning(dato) VALUES('2008-11-8');
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 2);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 5);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 9);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 18);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 23);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 29);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 39);
INSERT INTO lottotraekning(dato) VALUES('2008-11-15');
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 11);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 17);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 22);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 23);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 31);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 32);
INSERT INTO lottotal VALUES(LAST_INSERT_ID(), 35);

SELECT * FROM lottotraekning;
SELECT * FROM lottotal;

DROP TABLE lottotraekning;
DROP TABLE lottotal;
