-- phpMyAdmin SQL Dump -- version 3.3.7deb8 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Mar 26, 2015 at 04:45 PM -- Server version: 5.1.73 -- PHP Version: 5.3.3-7+squeeze23 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `jaagup_2015` -- -- -------------------------------------------------------- -- -- Table structure for table `a24_keretyybid` -- DROP TABLE IF EXISTS `a24_keretyybid`; CREATE TABLE IF NOT EXISTS `a24_keretyybid` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tyybinimi` varchar(45) NOT NULL, `soidukityyp` varchar(45) NOT NULL, PRIMARY KEY (`id`), KEY `fk_a24_keretyybid_a24_soidukityybid_idx` (`soidukityyp`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -- Dumping data for table `a24_keretyybid` -- INSERT INTO `a24_keretyybid` (`id`, `tyybinimi`, `soidukityyp`) VALUES (1, 'luukpära', 'sõiduauto'), (2, 'sedaan', 'sõiduauto'), (3, 'universaal', 'sõiduauto'), (4, 'mahtuniversaal', 'sõiduauto'), (5, 'väikekaubik', 'kaubik'), (6, 'kaubik', 'kaubik'), (7, 'veok', 'kaubik'); -- -------------------------------------------------------- -- -- Table structure for table `a24_margid` -- DROP TABLE IF EXISTS `a24_margid`; CREATE TABLE IF NOT EXISTS `a24_margid` ( `mark` varchar(45) NOT NULL, PRIMARY KEY (`mark`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `a24_margid` -- INSERT INTO `a24_margid` (`mark`) VALUES ('Opel'), ('Volkswagen'); -- -------------------------------------------------------- -- -- Table structure for table `a24_mudelid` -- DROP TABLE IF EXISTS `a24_mudelid`; CREATE TABLE IF NOT EXISTS `a24_mudelid` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mudel` varchar(45) DEFAULT NULL, `mark` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_a24_mudelid_a24_margid1_idx` (`mark`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; -- -- Dumping data for table `a24_mudelid` -- INSERT INTO `a24_mudelid` (`id`, `mudel`, `mark`) VALUES (1, 'Caravelle', 'Volkswagen'), (2, 'Golf', 'Volkswagen'), (3, 'Touran', 'Volkswagen'), (4, 'Sharan', 'Volkswagen'), (5, 'Adam', 'Opel'), (6, 'Corsa', 'Opel'), (7, 'Kadett', 'Opel'), (8, 'Meriva', 'Opel'); -- -------------------------------------------------------- -- -- Table structure for table `a24_myyjad` -- DROP TABLE IF EXISTS `a24_myyjad`; CREATE TABLE IF NOT EXISTS `a24_myyjad` ( `knimi` varchar(45) NOT NULL, `paroorir2si` char(41) DEFAULT NULL, `telefon` varchar(45) DEFAULT NULL, `epost` varchar(45) DEFAULT NULL, PRIMARY KEY (`knimi`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `a24_myyjad` -- INSERT INTO `a24_myyjad` (`knimi`, `paroorir2si`, `telefon`, `epost`) VALUES ('juku', NULL, '123456', 'juku@mail.ee'), ('kati', NULL, '665443', 'kati@mail.ee'); -- -------------------------------------------------------- -- -- Table structure for table `a24_pildid` -- DROP TABLE IF EXISTS `a24_pildid`; CREATE TABLE IF NOT EXISTS `a24_pildid` ( `id` int(11) NOT NULL, `soiduki_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `fk_a24_pildid_a24_soidukid1_idx` (`soiduki_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `a24_pildid` -- -- -------------------------------------------------------- -- -- Table structure for table `a24_soidukid` -- DROP TABLE IF EXISTS `a24_soidukid`; CREATE TABLE IF NOT EXISTS `a24_soidukid` ( `id` int(11) NOT NULL AUTO_INCREMENT, `keretyybi_id` int(11) NOT NULL, `mudeli_id` int(11) NOT NULL, `myyja` varchar(45) NOT NULL, `hind` int(11) NOT NULL, `esmanereg` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_a24_soidukid_a24_keretyybid1_idx` (`keretyybi_id`), KEY `fk_a24_soidukid_a24_mudelid1_idx` (`mudeli_id`), KEY `fk_a24_soidukid_a24_myyjad1_idx` (`myyja`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -- Dumping data for table `a24_soidukid` -- INSERT INTO `a24_soidukid` (`id`, `keretyybi_id`, `mudeli_id`, `myyja`, `hind`, `esmanereg`) VALUES (1, 3, 8, 'juku', 700, '2004-03-01'), (2, 4, 3, 'kati', 2500, '2009-11-12'), (3, 6, 6, 'kati', 8700, '2015-02-09'); -- -------------------------------------------------------- -- -- Table structure for table `a24_soidukityybid` -- DROP TABLE IF EXISTS `a24_soidukityybid`; CREATE TABLE IF NOT EXISTS `a24_soidukityybid` ( `soidukityyp` varchar(50) NOT NULL, PRIMARY KEY (`soidukityyp`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `a24_soidukityybid` -- INSERT INTO `a24_soidukityybid` (`soidukityyp`) VALUES ('kaubik'), ('maastur'), ('sõiduauto'), ('veoauto'); -- -------------------------------------------------------- -- -- Table structure for table `a24_soiduk_varustus` -- DROP TABLE IF EXISTS `a24_soiduk_varustus`; CREATE TABLE IF NOT EXISTS `a24_soiduk_varustus` ( `id` int(11) NOT NULL AUTO_INCREMENT, `soiduki_id` int(11) NOT NULL, `varustuse_id` int(11) NOT NULL, `kommentaar` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_a24_soiduk_varustus_a24_soidukid1_idx` (`soiduki_id`), KEY `fk_a24_soiduk_varustus_a24_varustus1_idx` (`varustuse_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data for table `a24_soiduk_varustus` -- INSERT INTO `a24_soiduk_varustus` (`id`, `soiduki_id`, `varustuse_id`, `kommentaar`) VALUES (1, 2, 1, 'punane'), (2, 1, 1, NULL); -- -------------------------------------------------------- -- -- Table structure for table `a24_varustus` -- DROP TABLE IF EXISTS `a24_varustus`; CREATE TABLE IF NOT EXISTS `a24_varustus` ( `id` int(11) NOT NULL AUTO_INCREMENT, `varustusgrupp` varchar(45) NOT NULL, `varustus` varchar(45) NOT NULL, PRIMARY KEY (`id`), KEY `fk_a24_varustus_a24_varustusgrupp1_idx` (`varustusgrupp`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -- Dumping data for table `a24_varustus` -- INSERT INTO `a24_varustus` (`id`, `varustusgrupp`, `varustus`) VALUES (1, 'Tuled', 'Tugev pidurituli'), (2, 'Tuled', 'Lisapidurituli'), (3, 'Tuled', 'Lisaudutuli'); -- -------------------------------------------------------- -- -- Table structure for table `a24_varustusgrupp` -- DROP TABLE IF EXISTS `a24_varustusgrupp`; CREATE TABLE IF NOT EXISTS `a24_varustusgrupp` ( `grupinimi` varchar(45) NOT NULL, PRIMARY KEY (`grupinimi`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `a24_varustusgrupp` -- INSERT INTO `a24_varustusgrupp` (`grupinimi`) VALUES ('Mugavusvarustus'), ('Sisustus'), ('Tuled'), ('Turva- ja ohutusvarustus'); -- -- Constraints for dumped tables -- -- -- Constraints for table `a24_keretyybid` -- ALTER TABLE `a24_keretyybid` ADD CONSTRAINT `fk_a24_keretyybid_a24_soidukityybid` FOREIGN KEY (`soidukityyp`) REFERENCES `a24_soidukityybid` (`soidukityyp`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `a24_mudelid` -- ALTER TABLE `a24_mudelid` ADD CONSTRAINT `fk_a24_mudelid_a24_margid1` FOREIGN KEY (`mark`) REFERENCES `a24_margid` (`mark`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `a24_pildid` -- ALTER TABLE `a24_pildid` ADD CONSTRAINT `fk_a24_pildid_a24_soidukid1` FOREIGN KEY (`soiduki_id`) REFERENCES `a24_soidukid` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `a24_soidukid` -- ALTER TABLE `a24_soidukid` ADD CONSTRAINT `fk_a24_soidukid_a24_keretyybid1` FOREIGN KEY (`keretyybi_id`) REFERENCES `a24_keretyybid` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_a24_soidukid_a24_mudelid1` FOREIGN KEY (`mudeli_id`) REFERENCES `a24_mudelid` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_a24_soidukid_a24_myyjad1` FOREIGN KEY (`myyja`) REFERENCES `a24_myyjad` (`knimi`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `a24_soiduk_varustus` -- ALTER TABLE `a24_soiduk_varustus` ADD CONSTRAINT `fk_a24_soiduk_varustus_a24_soidukid1` FOREIGN KEY (`soiduki_id`) REFERENCES `a24_soidukid` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_a24_soiduk_varustus_a24_varustus1` FOREIGN KEY (`varustuse_id`) REFERENCES `a24_varustus` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `a24_varustus` -- ALTER TABLE `a24_varustus` ADD CONSTRAINT `fk_a24_varustus_a24_varustusgrupp1` FOREIGN KEY (`varustusgrupp`) REFERENCES `a24_varustusgrupp` (`grupinimi`) ON DELETE NO ACTION ON UPDATE NO ACTION;