DROP TABLE IF EXISTS `akcesoria`; CREATE TABLE `akcesoria` ( `id` int(5) unsigned NOT NULL auto_increment, `nazwa` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `akcesoria` WRITE; INSERT INTO `akcesoria` VALUES (null,'obiektyw'),(null,'zaslepka'); UNLOCK TABLES; DROP TABLE IF EXISTS `aparaty`; CREATE TABLE `aparaty` ( `id` int(5) unsigned NOT NULL auto_increment, `marka` varchar(20) default NULL, `model` varchar(20) default NULL, `cyfr` enum('Y','N') default NULL, `rozdzielczosc` varchar(12) default NULL, `obiektyw` varchar(10) default NULL, `pam_wewn` varchar(10) default 'brak', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `aparaty` WRITE; INSERT INTO `aparaty` VALUES (null,'Olympus','Mju_Digital_600','Y','2816x212','35-105',''),(null,'Panasonic','Dmc_lz_1','Y','2304x1704','37-222','14MB'),(null,'Samsung','Digimax_A_50','Y','2592x1944','35-105','11MB'),(null,'Fujifilm','Finepix_S_3500','Y','2304x1708','35-105','14MB'),(null,'Fujifilm','E_50','Y','2304x1708','35-105',''),(null,'Canon','EOS','N','','35-70',''); UNLOCK TABLES; DROP TABLE IF EXISTS `komentarze`; CREATE TABLE `komentarze` ( `id` int(5) unsigned NOT NULL auto_increment, `opis` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `komentarze` WRITE; INSERT INTO `komentarze` VALUES (null,'Zdjecia przedstawia Puszcze Bialowieska'),(null,'Zdjecia przedstawia kosciol sw.Anny w Bialej Podlaskiej'); UNLOCK TABLES; DROP TABLE IF EXISTS `sceny`; CREATE TABLE `sceny` ( `id` int(5) unsigned NOT NULL auto_increment, `kategorie` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `sceny` WRITE; INSERT INTO `sceny` VALUES (null,'krajobraz'),(null,'perspektywy'),(null,'portrety'),(null,'zdjecia_w_ruchu'); UNLOCK TABLES; DROP TABLE IF EXISTS `zdjecia`; CREATE TABLE `zdjecia` ( `id` int(5) unsigned NOT NULL auto_increment, `data_wyk` date default NULL, `rozdzielczosc` varchar(12) default NULL, `id_aut` int(5) unsigned default NULL, `id_apar` int(5) unsigned default NULL, `id_kom` int(5) unsigned default NULL, `id_sc` int(5) unsigned default NULL, `id_akc` int(5) unsigned default NULL, PRIMARY KEY (`id`), KEY `idx_aut` (`id_aut`), KEY `idx_apar` (`id_apar`), KEY `idx_kom` (`id_kom`), KEY `idx_sc` (`id_sc`), KEY `idx_akc` (`id_akc`), CONSTRAINT `zdjecia_ibfk_1` FOREIGN KEY (`id_aut`) REFERENCES `autorzy` (`id`), CONSTRAINT `zdjecia_ibfk_2` FOREIGN KEY (`id_apar`) REFERENCES `aparaty` (`id`), CONSTRAINT `zdjecia_ibfk_3` FOREIGN KEY (`id_kom`) REFERENCES `komentarze` (`id`), CONSTRAINT `zdjecia_ibfk_4` FOREIGN KEY (`id_sc`) REFERENCES `sceny` (`id`), CONSTRAINT `zdjecia_ibfk_5` FOREIGN KEY (`id_akc`) REFERENCES `akcesoria` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `zdjecia` WRITE; INSERT INTO `zdjecia` VALUES (null,'2005-06-15','400x200',1,1,1,1,1),(null,'2004-07-05','1024x768',2,2,2,2,2); UNLOCK TABLES;