CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

problème base de donné

manga750
manga750
Niveau 1
28 mars 2012 à 22:36:02

BOnjour,

Voici ma base de donné :

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET
@OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS
*/;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Base de données: `hybabdd`
--

--
--------------------------------------------------
------

--
-- Structure de la table `client`
--

CREATE TABLE IF NOT EXISTS `client` (
`id_client` int(11) NOT NULL AUTO_INCREMENT,
`nom_client` varchar(20) NOT NULL,
`prenom_client` varchar(20) NOT NULL,
`num_client` int(12) DEFAULT NULL,
`adresse_client` varchar(30) NOT NULL,
KEY `id_client` (`id_client`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Contenu de la table `client`
--

INSERT INTO `client` (`id_client`, `nom_client`, `prenom_client`, `num_client`, `adresse_client`) VALUES
(2, 'paris1', 'tolbiac', NULL, 'rue de tolbiac'),
(3, 'dominos', 'pizza', NULL, '11e');

--
--------------------------------------------------
------

--
-- Structure de la table `contrat`
--

CREATE TABLE IF NOT EXISTS `contrat` (
`id_contrat` int(11) NOT NULL AUTO_INCREMENT,
`type_contrat` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id_contrat`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Contenu de la table `contrat`
--

INSERT INTO `contrat` (`id_contrat`, `type_contrat`) VALUES
(3, 'site internet'),
(4, 'une pizza acheter deux pizza offerte');

--
--------------------------------------------------
------

--
-- Structure de la table `employe`
--

CREATE TABLE IF NOT EXISTS `employe` (
`id_employe` int(11) NOT NULL AUTO_INCREMENT,
`nom` varchar(45) DEFAULT NULL,
`prenom` varchar(45) DEFAULT NULL,
`statut` varchar(45) DEFAULT NULL,
`num_tel` varchar(45) DEFAULT NULL,
`password` varchar(45) DEFAULT NULL,
`username` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id_employe`),
KEY `cles primaire` (`id_employe`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

--
-- Contenu de la table `employe`
--

INSERT INTO `employe` (`id_employe`, `nom`, `prenom`, `statut`, `num_tel`, `password`, `username`) VALUES
(1, 'Ait si amer', 'Madjid', 'chef de projet', NULL, 'sisi', 'madjid'),
(2, 'Balestan', 'Vincent', 'chef de projet', NULL, 'sisi', 'vincent'),
(6, 'Aissat', 'Alexandre', 'chef de projet', NULL, 'sisi', 'alexandre'),
(7, 'Peju', 'Marie', 'ouvrier', NULL, 'saclas', 'marie'),
(8, 'Minas', 'Annie', 'ouvrier', NULL, 'yelevan', 'Annie'),
(9, 'Abam', 'Said', 'Idiot du village', NULL, 'alkapote', 'said');

--
--------------------------------------------------
------

--
-- Structure de la table `planning`
--

CREATE TABLE IF NOT EXISTS `planning` (
`date_travail` date NOT NULL,
`presence` bit(1) NOT NULL,
`id_projet` int(20) NOT NULL,
`id_emp` int(200) NOT NULL,
PRIMARY KEY (`date_travail`,`id_projet`,`id_emp`),
KEY `id_emp` (`id_emp`),
KEY `id_projet` (`id_projet`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Contenu de la table `planning`
--

INSERT INTO `planning` (`date_travail`, `presence`, `id_projet`, `id_emp`) VALUES
('0000-00-00', b'1', 3, 6),
('2012-03-07', b'1', 3, 2);

--
--------------------------------------------------
------

--
-- Structure de la table `projet`
--

CREATE TABLE IF NOT EXISTS `projet` (
`id_projet` int(11) NOT NULL AUTO_INCREMENT,
`nom_projet` varchar(50) NOT NULL,
`id_client` int(11) NOT NULL,
`id_contrat` int(11) NOT NULL,
PRIMARY KEY (`id_projet`),
KEY `id_contrat` (`id_contrat`),
KEY `id_client` (`id_client`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Contenu de la table `projet`
--

INSERT INTO `projet` (`id_projet`, `nom_projet`, `id_client`, `id_contrat`) VALUES
(3, 'manger les coloriages', 2, 3),
(4, 'faire le site internet', 3, 4);

--
-- Contraintes pour les tables exportées
--

--
-- Contraintes pour la table `planning`
--
ALTER TABLE `planning`
ADD CONSTRAINT `planning_ibfk_1` FOREIGN KEY (`id_emp`) REFERENCES `employe` (`id_employe`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `planning_ibfk_2` FOREIGN KEY (`id_projet`) REFERENCES `projet` (`id_projet`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `projet`
--
ALTER TABLE `projet`
ADD CONSTRAINT `projet_ibfk_1` FOREIGN KEY (`id_projet`) REFERENCES `contrat` (`id_contrat`),
ADD CONSTRAINT `projet_ibfk_6` FOREIGN KEY (`id_client`) REFERENCES `client` (`id_client`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `projet_ibfk_7` FOREIGN KEY (`id_contrat`) REFERENCES `contrat` (`id_contrat`) ON DELETE CASCADE ON UPDATE CASCADE;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Lorsque je souhaite l'importer cela m'affiche :

Erreur
requête SQL:

--
-- Base de données: `hybabdd`
--
--
--------------------------------------------------
------
--
-- Structure de la table `client`
--
CREATE TABLE IF NOT EXISTS `client` (

`id_client` int( 11 ) NOT NULL AUTO_INCREMENT ,
`nom_client` varchar( 20 ) NOT NULL ,
`prenom_client` varchar( 20 ) NOT NULL ,
`num_client` int( 12 ) DEFAULT NULL ,
`adresse_client` varchar( 30 ) NOT NULL ,
KEY `id_client` ( `id_client` ) ) ENGINE = InnoDB DEFAULT CHARSET = latin1 AUTO_INCREMENT =6;

MySQL a répondu:

  1. 1046 - No database selected

Pourtant j'arrive a l'importer sur mon autre ordinateur. portable ...

Si quelqu'un pouvait m'indiquer le problème
Merci

sd460
sd460
Niveau 10
28 mars 2012 à 22:39:03

il faut que tu crées une base de données où tu stockera ces tables.

Comment fais-tu ta création de base tables ? En ligne de commandes, ou via une interface web ?
Dans les deux cas, tu dois soit créer la base de données (database) ou spécifier l'utilisation d'une base de données existante (si elle existe, rajouter un "use NomDeLaBaseDeDonnees ;" )

manga750
manga750
Niveau 1
28 mars 2012 à 22:53:27

Merci de ta réponse,

j'ai crée ma base de donnée avec le serveur phpmyadmin.
Celle-ci possède deja u nom.
Comment lui spécifié l'utilisation d'une base de donné existante ?
merci

Sous forums
  • Aide à l'achat Mac
  • Création de sites web
  • Création de Jeux
  • Linux
  • Programmation
  • Internet
  • Steam Deck
  • Macintosh
  • Hardware
La vidéo du moment