Erreur de SQL quand j'essaie d'importer ma base sur phpmyadmin !
jakbauer222
Messages postés
15
Date d'inscription
Statut
Membre
Dernière intervention
-
jordane45 Messages postés 30651 Date d'inscription Statut Modérateur Dernière intervention -
jordane45 Messages postés 30651 Date d'inscription Statut Modérateur Dernière intervention -
Voici l'erreur :
Erreur
Requête SQL :
DELIMITER ;
--
-- Contenu de la table `emprunt`
--
INSERT INTO `emprunt` (`n_emp`, `nliv`, `ncin`, `dateemp`, `dateres`) VALUES
('100', 'L002', 'JA 13292', '2013-03-01', '2013-03-01'),
('E001', 'L001', 'JA 13292', '2013-02-23', '2013-02-27'),
('E0012', 'l0078', 'JA106220', '2013-02-26', '2013-02-28'),
('E0023', 'l0078', 'JA 13292', '2013-02-26', '2013-02-26'),
('E0123', 'L001', 'JA 13292', '2013-03-26', '2013-03-26');
MySQL a répondu: Documentation
#1146 - Table 'biblio.livre' doesn't exist
Et Voici le code SQL : Il est unpeu long :/
-- phpMyAdmin SQL Dump
-- version 3.1.1
-- https://www.phpmyadmin.net/
-- Serveur: localhost
-- Généré le : Dim 26 Mai 2013 à 06:41
-- Version du serveur: 5.1.30
-- Version de PHP: 5.2.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!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 */;
<span class='signature'>-- Base de données: `biblio`
--
-- --------------------------------------------------------
--
-- Structure de la table `auteur`
--
DROP TABLE IF EXISTS `auteur`;
CREATE TABLE IF NOT EXISTS `auteur` (
`CD_AUT` int(11) NOT NULL DEFAULT '0',
`NOMAUT` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`CD_AUT`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Contenu de la table `auteur`
--
INSERT INTO `auteur` (`CD_AUT`, `NOMAUT`) VALUES
(1, 'بدر شاكر سياب'),
(2, 'sthendal'),
(3, 'احمد شوقي'),
(33, 'victore Hugo');
-- --------------------------------------------------------
--
-- Structure de la table `authorities`
--
DROP TABLE IF EXISTS `authorities`;
CREATE TABLE IF NOT EXISTS `authorities` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`authority` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_authorities_users` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Contenu de la table `authorities`
--
INSERT INTO `authorities` (`id`, `username`, `authority`) VALUES
(1, 'dany', 'ROLE_ADMIN'),
(2, 'user', 'ROLE_USER');
-- --------------------------------------------------------
--
-- Structure de la table `cathegorie`
--
DROP TABLE IF EXISTS `cathegorie`;
CREATE TABLE IF NOT EXISTS `cathegorie` (
`ncatego` int(11) NOT NULL,
`lebelle` varchar(100) NOT NULL,
PRIMARY KEY (`ncatego`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `cathegorie`
--
INSERT INTO `cathegorie` (`ncatego`, `lebelle`) VALUES
(1, 'Francais'),
(3, 'Math');
-- --------------------------------------------------------
--
-- Structure de la table `collection`
--
DROP TABLE IF EXISTS `collection`;
CREATE TABLE IF NOT EXISTS `collection` (
`ncol` varchar(200) CHARACTER SET latin1 NOT NULL,
`titre` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`nbrlivre` int(11) NOT NULL,
`nbrlivre_ini` int(11) NOT NULL,
`cd_aut` int(11) NOT NULL,
`emplacement` varchar(1000) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`ncol`),
KEY `cd_aut` (`cd_aut`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT;
--
-- Contenu de la table `collection`
--
INSERT INTO `collection` (`ncol`, `titre`, `nbrlivre`, `nbrlivre_ini`, `cd_aut`, `emplacement`) VALUES
('1', 'الشوقيات', 4, 5, 3, 'placard de Lettre'),
('787', 'les Misirables', 5, 5, 33, 'placard de letterature');
-- --------------------------------------------------------
--
-- Structure de la table `emprunt`
--
DROP TABLE IF EXISTS `emprunt`;
CREATE TABLE IF NOT EXISTS `emprunt` (
`n_emp` varchar(20) NOT NULL,
`nliv` varchar(20) NOT NULL,
`ncin` varchar(20) NOT NULL,
`dateemp` date NOT NULL,
`dateres` date NOT NULL,
PRIMARY KEY (`n_emp`),
KEY `nliv` (`nliv`,`ncin`),
KEY `ncin` (`ncin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déclencheurs `emprunt`
--
DROP TRIGGER IF EXISTS `biblio`.`Empt`;
DELIMITER //
CREATE TRIGGER `biblio`.`Empt` AFTER INSERT ON `biblio`.`emprunt`
FOR EACH ROW BEGIN
UPDATE livre SET nstaus = '2' WHERE nlivre = NEW.nliv;
UPDATE collection set nbrlivre =nbrlivre -1
where ncol =(select ncole from livre where
nlivre=NEW.nliv);
END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `biblio`.`Empt2`;
DELIMITER //
CREATE TRIGGER `biblio`.`Empt2` AFTER UPDATE ON `biblio`.`emprunt`
FOR EACH ROW BEGIN
UPDATE livre SET nstaus = '1' WHERE nlivre = NEW.nliv;
UPDATE collection set nbrlivre =nbrlivre +1
where ncol =(select ncole from livre where
nlivre=NEW.nliv);
END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `biblio`.`Empt20`;
DELIMITER //
CREATE TRIGGER `biblio`.`Empt20` AFTER DELETE ON `biblio`.`emprunt`
FOR EACH ROW BEGIN
UPDATE livre SET nstaus = '1' WHERE nlivre = old.nliv;
UPDATE collection set nbrlivre =nbrlivre +1
where ncol =(select ncole from livre where
nlivre=old.nliv);
END
//
DELIMITER ;
--
-- Contenu de la table `emprunt`
--
INSERT INTO `emprunt` (`n_emp`, `nliv`, `ncin`, `dateemp`, `dateres`) VALUES
('100', 'L002', 'JA 13292', '2013-03-01', '2013-03-01'),
('E001', 'L001', 'JA 13292', '2013-02-23', '2013-02-27'),
('E0012', 'l0078', 'JA106220', '2013-02-26', '2013-02-28'),
('E0023', 'l0078', 'JA 13292', '2013-02-26', '2013-02-26'),
('E0123', 'L001', 'JA 13292', '2013-03-26', '2013-03-26');
-- --------------------------------------------------------
--
-- Structure de la table `emprunteur`
--
DROP TABLE IF EXISTS `emprunteur`;
CREATE TABLE IF NOT EXISTS `emprunteur` (
`cin` varchar(20) NOT NULL,
`nom` varchar(100) NOT NULL,
`prenom` varchar(100) NOT NULL,
`adresse` varchar(500) NOT NULL,
`tel` varchar(30) NOT NULL,
`email` varchar(100) NOT NULL,
PRIMARY KEY (`cin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `emprunteur`
--
INSERT INTO `emprunteur` (`cin`, `nom`, `prenom`, `adresse`, `tel`, `email`) VALUES
('JA 13292', 'DANYAL', 'Hicham', 'rue du far N° 217 Guelmim', '0676839388', '[email protected]'),
('JA106220', 'MALAININE', 'Farhane', 'rue lgramaz num 219', '0673763402', '[email protected]');
-- --------------------------------------------------------
--
-- Structure de la table `livre`
--
DROP TABLE IF EXISTS `livre`;
CREATE TABLE IF NOT EXISTS `livre` (
`nlivre` varchar(50) NOT NULL,
`ncole` varchar(500) NOT NULL,
`ncat` int(11) NOT NULL,
`nstaus` int(11) NOT NULL,
PRIMARY KEY (`nlivre`),
KEY `nlivre` (`nlivre`),
KEY `ncat` (`ncat`),
KEY `nstaus` (`nstaus`),
KEY `ncole` (`ncole`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déclencheurs `livre`
--
DROP TRIGGER IF EXISTS `biblio`.`Emptlivre`;
DELIMITER //
CREATE TRIGGER `biblio`.`Emptlivre` BEFORE INSERT ON `biblio`.`livre`
FOR EACH ROW BEGIN
DECLARE ts INTEGER;
DECLARE ts1 INTEGER;
SELECT COUNT(*) INTO ts FROM `livre` WHERE ncole= NEW.ncole;
SELECt nbrlivre_ini INTO ts1 FROM `collection` where ncol= NEW.ncole;
IF (ts >= ts1) THEN
CALL RAISEERROR('MYCUSTOMDBERROR', 16, 1);
END IF;
END
//
DELIMITER ;
--
-- Contenu de la table `livre`
--
INSERT INTO `livre` (`nlivre`, `ncole`, `ncat`, `nstaus`) VALUES
('111', '787', 3, 1),
('L001', '787', 1, 1),
('L002', '1', 1, 2),
('l0078', '787', 1, 1);
-- --------------------------------------------------------
--
-- Structure de la table `status`
--
DROP TABLE IF EXISTS `status`;
CREATE TABLE IF NOT EXISTS `status` (
`Nstatus` int(11) NOT NULL,
`lebelle` varchar(100) NOT NULL,
PRIMARY KEY (`Nstatus`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `status`
--
INSERT INTO `status` (`Nstatus`, `lebelle`) VALUES
(1, 'Disponible'),
(2, 'non disponible');
-- --------------------------------------------------------
--
-- Structure de la table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`enabled` tinyint(1) NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `users`
--
INSERT INTO `users` (`username`, `password`, `enabled`) VALUES
('dany', 'dany', 1),
('user', 'user', 1);
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `authorities`
--
ALTER TABLE `authorities`
ADD CONSTRAINT `authorities_ibfk_1` FOREIGN KEY (`username`) REFERENCES `users` (`username`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `collection`
--
ALTER TABLE `collection`
ADD CONSTRAINT `collection_ibfk_1` FOREIGN KEY (`cd_aut`) REFERENCES `auteur` (`CD_AUT`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `emprunt`
--
ALTER TABLE `emprunt`
ADD CONSTRAINT `emprunt_ibfk_1` FOREIGN KEY (`nliv`) REFERENCES `livre` (`nlivre`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `emprunt_ibfk_2` FOREIGN KEY (`ncin`) REFERENCES `emprunteur` (`cin`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `livre`
--
ALTER TABLE `livre`
ADD CONSTRAINT `livre_ibfk_2` FOREIGN KEY (`ncat`) REFERENCES `cathegorie` (`ncatego`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `livre_ibfk_3` FOREIGN KEY (`nstaus`) REFERENCES `status` (`Nstatus`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `livre_ibfk_4` FOREIGN KEY (`ncole`) REFERENCES `collection` (`ncol`) ON DELETE CASCADE ON UPDATE CASCADE;
</span>
Erreur
Requête SQL :
DELIMITER ;
--
-- Contenu de la table `emprunt`
--
INSERT INTO `emprunt` (`n_emp`, `nliv`, `ncin`, `dateemp`, `dateres`) VALUES
('100', 'L002', 'JA 13292', '2013-03-01', '2013-03-01'),
('E001', 'L001', 'JA 13292', '2013-02-23', '2013-02-27'),
('E0012', 'l0078', 'JA106220', '2013-02-26', '2013-02-28'),
('E0023', 'l0078', 'JA 13292', '2013-02-26', '2013-02-26'),
('E0123', 'L001', 'JA 13292', '2013-03-26', '2013-03-26');
MySQL a répondu: Documentation
#1146 - Table 'biblio.livre' doesn't exist
Et Voici le code SQL : Il est unpeu long :/
-- phpMyAdmin SQL Dump
-- version 3.1.1
-- https://www.phpmyadmin.net/
-- Serveur: localhost
-- Généré le : Dim 26 Mai 2013 à 06:41
-- Version du serveur: 5.1.30
-- Version de PHP: 5.2.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!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 */;
<span class='signature'>-- Base de données: `biblio`
--
-- --------------------------------------------------------
--
-- Structure de la table `auteur`
--
DROP TABLE IF EXISTS `auteur`;
CREATE TABLE IF NOT EXISTS `auteur` (
`CD_AUT` int(11) NOT NULL DEFAULT '0',
`NOMAUT` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`CD_AUT`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
--
-- Contenu de la table `auteur`
--
INSERT INTO `auteur` (`CD_AUT`, `NOMAUT`) VALUES
(1, 'بدر شاكر سياب'),
(2, 'sthendal'),
(3, 'احمد شوقي'),
(33, 'victore Hugo');
-- --------------------------------------------------------
--
-- Structure de la table `authorities`
--
DROP TABLE IF EXISTS `authorities`;
CREATE TABLE IF NOT EXISTS `authorities` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`authority` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_authorities_users` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Contenu de la table `authorities`
--
INSERT INTO `authorities` (`id`, `username`, `authority`) VALUES
(1, 'dany', 'ROLE_ADMIN'),
(2, 'user', 'ROLE_USER');
-- --------------------------------------------------------
--
-- Structure de la table `cathegorie`
--
DROP TABLE IF EXISTS `cathegorie`;
CREATE TABLE IF NOT EXISTS `cathegorie` (
`ncatego` int(11) NOT NULL,
`lebelle` varchar(100) NOT NULL,
PRIMARY KEY (`ncatego`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `cathegorie`
--
INSERT INTO `cathegorie` (`ncatego`, `lebelle`) VALUES
(1, 'Francais'),
(3, 'Math');
-- --------------------------------------------------------
--
-- Structure de la table `collection`
--
DROP TABLE IF EXISTS `collection`;
CREATE TABLE IF NOT EXISTS `collection` (
`ncol` varchar(200) CHARACTER SET latin1 NOT NULL,
`titre` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`nbrlivre` int(11) NOT NULL,
`nbrlivre_ini` int(11) NOT NULL,
`cd_aut` int(11) NOT NULL,
`emplacement` varchar(1000) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`ncol`),
KEY `cd_aut` (`cd_aut`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT;
--
-- Contenu de la table `collection`
--
INSERT INTO `collection` (`ncol`, `titre`, `nbrlivre`, `nbrlivre_ini`, `cd_aut`, `emplacement`) VALUES
('1', 'الشوقيات', 4, 5, 3, 'placard de Lettre'),
('787', 'les Misirables', 5, 5, 33, 'placard de letterature');
-- --------------------------------------------------------
--
-- Structure de la table `emprunt`
--
DROP TABLE IF EXISTS `emprunt`;
CREATE TABLE IF NOT EXISTS `emprunt` (
`n_emp` varchar(20) NOT NULL,
`nliv` varchar(20) NOT NULL,
`ncin` varchar(20) NOT NULL,
`dateemp` date NOT NULL,
`dateres` date NOT NULL,
PRIMARY KEY (`n_emp`),
KEY `nliv` (`nliv`,`ncin`),
KEY `ncin` (`ncin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déclencheurs `emprunt`
--
DROP TRIGGER IF EXISTS `biblio`.`Empt`;
DELIMITER //
CREATE TRIGGER `biblio`.`Empt` AFTER INSERT ON `biblio`.`emprunt`
FOR EACH ROW BEGIN
UPDATE livre SET nstaus = '2' WHERE nlivre = NEW.nliv;
UPDATE collection set nbrlivre =nbrlivre -1
where ncol =(select ncole from livre where
nlivre=NEW.nliv);
END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `biblio`.`Empt2`;
DELIMITER //
CREATE TRIGGER `biblio`.`Empt2` AFTER UPDATE ON `biblio`.`emprunt`
FOR EACH ROW BEGIN
UPDATE livre SET nstaus = '1' WHERE nlivre = NEW.nliv;
UPDATE collection set nbrlivre =nbrlivre +1
where ncol =(select ncole from livre where
nlivre=NEW.nliv);
END
//
DELIMITER ;
DROP TRIGGER IF EXISTS `biblio`.`Empt20`;
DELIMITER //
CREATE TRIGGER `biblio`.`Empt20` AFTER DELETE ON `biblio`.`emprunt`
FOR EACH ROW BEGIN
UPDATE livre SET nstaus = '1' WHERE nlivre = old.nliv;
UPDATE collection set nbrlivre =nbrlivre +1
where ncol =(select ncole from livre where
nlivre=old.nliv);
END
//
DELIMITER ;
--
-- Contenu de la table `emprunt`
--
INSERT INTO `emprunt` (`n_emp`, `nliv`, `ncin`, `dateemp`, `dateres`) VALUES
('100', 'L002', 'JA 13292', '2013-03-01', '2013-03-01'),
('E001', 'L001', 'JA 13292', '2013-02-23', '2013-02-27'),
('E0012', 'l0078', 'JA106220', '2013-02-26', '2013-02-28'),
('E0023', 'l0078', 'JA 13292', '2013-02-26', '2013-02-26'),
('E0123', 'L001', 'JA 13292', '2013-03-26', '2013-03-26');
-- --------------------------------------------------------
--
-- Structure de la table `emprunteur`
--
DROP TABLE IF EXISTS `emprunteur`;
CREATE TABLE IF NOT EXISTS `emprunteur` (
`cin` varchar(20) NOT NULL,
`nom` varchar(100) NOT NULL,
`prenom` varchar(100) NOT NULL,
`adresse` varchar(500) NOT NULL,
`tel` varchar(30) NOT NULL,
`email` varchar(100) NOT NULL,
PRIMARY KEY (`cin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `emprunteur`
--
INSERT INTO `emprunteur` (`cin`, `nom`, `prenom`, `adresse`, `tel`, `email`) VALUES
('JA 13292', 'DANYAL', 'Hicham', 'rue du far N° 217 Guelmim', '0676839388', '[email protected]'),
('JA106220', 'MALAININE', 'Farhane', 'rue lgramaz num 219', '0673763402', '[email protected]');
-- --------------------------------------------------------
--
-- Structure de la table `livre`
--
DROP TABLE IF EXISTS `livre`;
CREATE TABLE IF NOT EXISTS `livre` (
`nlivre` varchar(50) NOT NULL,
`ncole` varchar(500) NOT NULL,
`ncat` int(11) NOT NULL,
`nstaus` int(11) NOT NULL,
PRIMARY KEY (`nlivre`),
KEY `nlivre` (`nlivre`),
KEY `ncat` (`ncat`),
KEY `nstaus` (`nstaus`),
KEY `ncole` (`ncole`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Déclencheurs `livre`
--
DROP TRIGGER IF EXISTS `biblio`.`Emptlivre`;
DELIMITER //
CREATE TRIGGER `biblio`.`Emptlivre` BEFORE INSERT ON `biblio`.`livre`
FOR EACH ROW BEGIN
DECLARE ts INTEGER;
DECLARE ts1 INTEGER;
SELECT COUNT(*) INTO ts FROM `livre` WHERE ncole= NEW.ncole;
SELECt nbrlivre_ini INTO ts1 FROM `collection` where ncol= NEW.ncole;
IF (ts >= ts1) THEN
CALL RAISEERROR('MYCUSTOMDBERROR', 16, 1);
END IF;
END
//
DELIMITER ;
--
-- Contenu de la table `livre`
--
INSERT INTO `livre` (`nlivre`, `ncole`, `ncat`, `nstaus`) VALUES
('111', '787', 3, 1),
('L001', '787', 1, 1),
('L002', '1', 1, 2),
('l0078', '787', 1, 1);
-- --------------------------------------------------------
--
-- Structure de la table `status`
--
DROP TABLE IF EXISTS `status`;
CREATE TABLE IF NOT EXISTS `status` (
`Nstatus` int(11) NOT NULL,
`lebelle` varchar(100) NOT NULL,
PRIMARY KEY (`Nstatus`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `status`
--
INSERT INTO `status` (`Nstatus`, `lebelle`) VALUES
(1, 'Disponible'),
(2, 'non disponible');
-- --------------------------------------------------------
--
-- Structure de la table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`enabled` tinyint(1) NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Contenu de la table `users`
--
INSERT INTO `users` (`username`, `password`, `enabled`) VALUES
('dany', 'dany', 1),
('user', 'user', 1);
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `authorities`
--
ALTER TABLE `authorities`
ADD CONSTRAINT `authorities_ibfk_1` FOREIGN KEY (`username`) REFERENCES `users` (`username`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `collection`
--
ALTER TABLE `collection`
ADD CONSTRAINT `collection_ibfk_1` FOREIGN KEY (`cd_aut`) REFERENCES `auteur` (`CD_AUT`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `emprunt`
--
ALTER TABLE `emprunt`
ADD CONSTRAINT `emprunt_ibfk_1` FOREIGN KEY (`nliv`) REFERENCES `livre` (`nlivre`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `emprunt_ibfk_2` FOREIGN KEY (`ncin`) REFERENCES `emprunteur` (`cin`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `livre`
--
ALTER TABLE `livre`
ADD CONSTRAINT `livre_ibfk_2` FOREIGN KEY (`ncat`) REFERENCES `cathegorie` (`ncatego`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `livre_ibfk_3` FOREIGN KEY (`nstaus`) REFERENCES `status` (`Nstatus`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `livre_ibfk_4` FOREIGN KEY (`ncole`) REFERENCES `collection` (`ncol`) ON DELETE CASCADE ON UPDATE CASCADE;
</span>
A voir également:
- Erreur de SQL quand j'essaie d'importer ma base sur phpmyadmin !
- Votre appareil ne dispose pas des correctifs de qualité et de sécurité importants - Guide
- Base de registre windows - Guide
- Importer favoris chrome - Guide
- Importer marque page firefox - Guide
- Importer contact carte sim - Guide
1 réponse
Bonjour,
1 -- A l'avenir.. merci d'utiliser les BALISES DE CODE pour poster du code sur le forum.
Voir ici les explications : https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code
2 - Le message d'erreur est clair ... il te dit :
... et vu que dans ton fichier SQL, en effet, la création de la table livre se trouve APRES celle de "emprunt" ... elle n'existe pas encore... et donc les TRIGERS ne peuvent pas marcher !
Il faut que tu changes l'ordre de création de tes tables dans le fichier.
3 - ce n'est pas important... mais..... cathegorie... ça ne s'écrie pas comme ça... mais : catégorie (sans "h" )
Cordialement,
Jordane
1 -- A l'avenir.. merci d'utiliser les BALISES DE CODE pour poster du code sur le forum.
Voir ici les explications : https://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code
2 - Le message d'erreur est clair ... il te dit :
MySQL a répondu: Documentation
#1146 - Table 'biblio.livre' doesn't exist
... et vu que dans ton fichier SQL, en effet, la création de la table livre se trouve APRES celle de "emprunt" ... elle n'existe pas encore... et donc les TRIGERS ne peuvent pas marcher !
Il faut que tu changes l'ordre de création de tes tables dans le fichier.
3 - ce n'est pas important... mais..... cathegorie... ça ne s'écrie pas comme ça... mais : catégorie (sans "h" )
Cordialement,
Jordane