CREATE TABLE `typ_suboru` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `nazov` varchar(50) DEFAULT NULL,
  `code` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `priradenie_suboru` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `nazov` varchar(50) DEFAULT NULL,
  `code` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE `subor` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `typ_suboru_id` int(11) unsigned NOT NULL,
  `priradenie_suboru_id` int(11) unsigned NOT NULL,
  `popis` varchar(255) DEFAULT NULL,
  `nazov` varchar(255) DEFAULT NULL,
  `primarna` int(11) unsigned DEFAULT NULL,
  `primary_id` int(11) unsigned DEFAULT NULL,
  `poradie` int(11) DEFAULT NULL,
  `visibility_type` tinyint(1) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `subor_FKIndex1` (`priradenie_suboru_id`),
  KEY `subor_FKIndex2` (`typ_suboru_id`),
  CONSTRAINT `fk_subor_typ_suboru` FOREIGN KEY (`typ_suboru_id`) REFERENCES `typ_suboru` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_subor_priradenie_suboru` FOREIGN KEY (`priradenie_suboru_id`) REFERENCES `priradenie_suboru` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

