Forum Clubic

BDD : Région/Département - Cherche structure et data en *.SQL

Bonjour,

dans le but de simplifier l’utilisation d’une interface intranet. Je souhaite insérer une table REGION et DEPARTEMENT… bien sûr, liée entre elles… :whistle:

Donc si quelqu’un avait un lien ou le/les fichiers *.sql … qu’il me fasse signe !!!

Merci d’avance

@+ :wink:

pour les tables, ceci doit correspondre :


create table region(
id_region int primary key,
nom_region varchar(30)
);

create table departement(
id_departement varchar(3) primary key,
nom_departement varchar(30)
region int references region.id_region
)

pour les remplir, soit, tu trouve la liste dans un fichier txt, que tu parse si besoin et insert ensuite, soit tun te palluche tout à la main, comme ça, tu pourra réviser ta géographie :slight_smile:

C’est justement ce que j’aimerais éviter … :ane:

Google est ton ami

le 1er site de la liste dans google, et ya tout
ensuite tu copies dans un fichier txt, tu parses ça et hop

bon apres, si tu attend que ça te tombe vraiment tout cuit dans le bec, tu risque d’attendre longtps, pasque ya personne qui fera ton boulot à ta place …

C’est bien parce que je taf dessus en ce moment :wink: :


- 
-- Structure de la table `region`
-- 

CREATE TABLE `region` (
  `NUMREGION` char(32) NOT NULL default '',
  `NOMREGION` char(32) default NULL,
  PRIMARY KEY  (`NUMREGION`)
) TYPE=MyISAM;

-- 
-- Contenu de la table `region`
-- 

INSERT INTO `region` VALUES ('1', 'Alsace');
INSERT INTO `region` VALUES ('2', 'Aquitaine');
INSERT INTO `region` VALUES ('3', 'Auvergne');
INSERT INTO `region` VALUES ('4', 'Basse Normandie');
INSERT INTO `region` VALUES ('5', 'Bourgogne');
INSERT INTO `region` VALUES ('6', 'Bretagne');
INSERT INTO `region` VALUES ('7', 'Centre');
INSERT INTO `region` VALUES ('8', 'Champagne Ardenne');
INSERT INTO `region` VALUES ('9', 'Corse');
INSERT INTO `region` VALUES ('10', 'Franche Comte');
INSERT INTO `region` VALUES ('11', 'Haute Normandie');
INSERT INTO `region` VALUES ('12', 'Ile de France');
INSERT INTO `region` VALUES ('13', 'Languedoc Roussillon');
INSERT INTO `region` VALUES ('14', 'Limousin');
INSERT INTO `region` VALUES ('15', 'Lorraine');
INSERT INTO `region` VALUES ('16', 'Midi-Pyrénées');
INSERT INTO `region` VALUES ('17', 'Nord Pas de Calais');
INSERT INTO `region` VALUES ('18', 'P.A.C.A');
INSERT INTO `region` VALUES ('19', 'Pays de la Loire');
INSERT INTO `region` VALUES ('20', 'Picardie');
INSERT INTO `region` VALUES ('21', 'Poitou Charente');
INSERT INTO `region` VALUES ('22', 'Rhone Alpes');

        
-- 
-- Structure de la table `departement`
-- 

CREATE TABLE `departement` (
  `NUMDEPT` char(2) NOT NULL default '',
  `NUMREGION` char(32) NOT NULL default '',
  `NOMDEPT` char(32) default NULL,
  PRIMARY KEY  (`NUMDEPT`),
  KEY `FK_DEPARTEMENT_REGION` (`NUMREGION`)
) TYPE=MyISAM;

-- 
-- Contenu de la table `departement`
-- 

INSERT INTO `departement` VALUES ('1', '22', 'Ain');
INSERT INTO `departement` VALUES ('2', '20', 'Aisne');
INSERT INTO `departement` VALUES ('3', '3', 'Allier');
INSERT INTO `departement` VALUES ('4', '18', 'Alpes de haute provence');
INSERT INTO `departement` VALUES ('5', '18', 'Hautes alpes');
INSERT INTO `departement` VALUES ('6', '18', 'Alpes maritimes');
INSERT INTO `departement` VALUES ('7', '22', 'Ardèche');
INSERT INTO `departement` VALUES ('8', '8', 'Ardennes');
INSERT INTO `departement` VALUES ('9', '16', 'Ariège');
INSERT INTO `departement` VALUES ('10', '8', 'Aube');
INSERT INTO `departement` VALUES ('11', '13', 'Aude');
INSERT INTO `departement` VALUES ('12', '16', 'Aveyron');
INSERT INTO `departement` VALUES ('13', '18', 'Bouches du rhône');
INSERT INTO `departement` VALUES ('14', '4', 'Calvados');
INSERT INTO `departement` VALUES ('15', '3', 'Cantal');
INSERT INTO `departement` VALUES ('16', '21', 'Charente');
INSERT INTO `departement` VALUES ('17', '21', 'Charente maritime');
INSERT INTO `departement` VALUES ('18', '7', 'Cher');
INSERT INTO `departement` VALUES ('19', '14', 'Corrèze');
INSERT INTO `departement` VALUES ('21', '5', 'Côte d\'or');
INSERT INTO `departement` VALUES ('22', '6', 'Côtes d\''Armor');
INSERT INTO `departement` VALUES ('23', '14', 'Creuse');
INSERT INTO `departement` VALUES ('24', '2', 'Dordogne');
INSERT INTO `departement` VALUES ('25', '10', 'Doubs');
INSERT INTO `departement` VALUES ('26', '22', 'Drôme');
INSERT INTO `departement` VALUES ('27', '11', 'Eure');
INSERT INTO `departement` VALUES ('28', '7', 'Eure et Loir');
INSERT INTO `departement` VALUES ('29', '6', 'Finistère');
INSERT INTO `departement` VALUES ('30', '13', 'Gard');
INSERT INTO `departement` VALUES ('31', '16', 'Haute garonne');
INSERT INTO `departement` VALUES ('32', '16', 'Gers');
INSERT INTO `departement` VALUES ('33', '2', 'Gironde');
INSERT INTO `departement` VALUES ('34', '13', 'Hérault');
INSERT INTO `departement` VALUES ('35', '6', 'Ile et Vilaine');
INSERT INTO `departement` VALUES ('36', '7', 'Indre');
INSERT INTO `departement` VALUES ('37', '7', 'Indre et Loire');
INSERT INTO `departement` VALUES ('38', '22', 'Isère');
INSERT INTO `departement` VALUES ('39', '10', 'Jura');
INSERT INTO `departement` VALUES ('40', '2', 'Landes');
INSERT INTO `departement` VALUES ('41', '7', 'Loir et Cher');
INSERT INTO `departement` VALUES ('42', '22', 'Loire');
INSERT INTO `departement` VALUES ('43', '3', 'Haute loire');
INSERT INTO `departement` VALUES ('44', '19', 'Loire Atlantique');
INSERT INTO `departement` VALUES ('45', '7', 'Loiret');
INSERT INTO `departement` VALUES ('46', '16', 'Lot');
INSERT INTO `departement` VALUES ('47', '2', 'Lot et Garonne');
INSERT INTO `departement` VALUES ('48', '13', 'Lozère');
INSERT INTO `departement` VALUES ('49', '19', 'Maine et Loire');
INSERT INTO `departement` VALUES ('50', '4', 'Manche');
INSERT INTO `departement` VALUES ('51', '8', 'Marne');
INSERT INTO `departement` VALUES ('52', '8', 'Haute Marne');
INSERT INTO `departement` VALUES ('53', '19', 'Mayenne');
INSERT INTO `departement` VALUES ('54', '15', 'Meurthe et Moselle');
INSERT INTO `departement` VALUES ('55', '15', 'Meuse');
INSERT INTO `departement` VALUES ('56', '6', 'Morbihan');
INSERT INTO `departement` VALUES ('57', '15', 'Moselle');
INSERT INTO `departement` VALUES ('58', '5', 'Nièvre');
INSERT INTO `departement` VALUES ('59', '17', 'Nord');
INSERT INTO `departement` VALUES ('60', '20', 'Oise');
INSERT INTO `departement` VALUES ('61', '4', 'Orne');
INSERT INTO `departement` VALUES ('62', '17', 'Pas de Calais');
INSERT INTO `departement` VALUES ('63', '3', 'Puy de Dôme');
INSERT INTO `departement` VALUES ('64', '2', 'Pyrénées Atlantiques');
INSERT INTO `departement` VALUES ('65', '16', 'Hautes Pyrénées');
INSERT INTO `departement` VALUES ('66', '13', 'Pyrénées Orientales');
INSERT INTO `departement` VALUES ('67', '1', 'Bas Rhin');
INSERT INTO `departement` VALUES ('68', '1', 'Haut Rhin');
INSERT INTO `departement` VALUES ('69', '22', 'Rhône');
INSERT INTO `departement` VALUES ('70', '10', 'Haute Saône');
INSERT INTO `departement` VALUES ('71', '5', 'Saône et Loire');
INSERT INTO `departement` VALUES ('72', '19', 'Sarthe');
INSERT INTO `departement` VALUES ('73', '22', 'Savoie');
INSERT INTO `departement` VALUES ('74', '22', 'Haute Savoie');
INSERT INTO `departement` VALUES ('75', '12', 'Paris');
INSERT INTO `departement` VALUES ('76', '11', 'Seine Maritime');
INSERT INTO `departement` VALUES ('77', '12', 'Seine et Marne');
INSERT INTO `departement` VALUES ('78', '12', 'Yvelines');
INSERT INTO `departement` VALUES ('79', '21', 'Deux Sèvres');
INSERT INTO `departement` VALUES ('80', '20', 'Somme');
INSERT INTO `departement` VALUES ('81', '16', 'Tarn');
INSERT INTO `departement` VALUES ('82', '16', 'Tarn et Garonne');
INSERT INTO `departement` VALUES ('83', '18', 'Var');
INSERT INTO `departement` VALUES ('84', '18', 'Vaucluse');
INSERT INTO `departement` VALUES ('85', '19', 'Vendée');
INSERT INTO `departement` VALUES ('86', '21', 'Vienne');
INSERT INTO `departement` VALUES ('87', '14', 'Haute Vienne');
INSERT INTO `departement` VALUES ('88', '15', 'Vosge');
INSERT INTO `departement` VALUES ('89', '5', 'Yonne');
INSERT INTO `departement` VALUES ('90', '10', 'Territoire de Belfort');
INSERT INTO `departement` VALUES ('91', '12', 'Essonne');
INSERT INTO `departement` VALUES ('92', '12', 'Haut de seine');
INSERT INTO `departement` VALUES ('93', '12', 'Seine Saint Denis');
INSERT INTO `departement` VALUES ('94', '12', 'Val de Marne');
INSERT INTO `departement` VALUES ('95', '12', 'Val d\'Oise');
INSERT INTO `departement` VALUES ('2a', '9', 'Corse du Sud');
INSERT INTO `departement` VALUES ('2b', '9', 'Haute Corse');


:clap: :clap: :clap:

merci hellmaster !!!!! :super:

c’est pile poil ce qu’il me fallait…

@+ :wink: