Citation
Vieux59
Ce serais tellement plus simple de pouvoir copier une table avec son PRIMARY KEY (`a_id`) comme ici
-- =========================== -- Création de la base `Essai` -- =========================== DROP DATABASE IF EXISTS `essai`; CREATE DATABASE IF NOT EXISTS `essai` DEFAULT CHARACTER SET `utf8` DEFAULT COLLATE `utf8_general_ci`; USE `essai`; -- ============================== -- Création de la table `exemple` -- ============================== CREATE TABLE `exemple` ( clef1 int DEFAULT 0 NOT NULL, clef2 int DEFAULT 0 NOT NULL, info CHAR(10) DEFAULT ' ' NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=`utf8` COLLATE=`utf8_general_ci`; -- ============================ -- Création de l'index `index1` -- ============================ CREATE INDEX `index1` USING btree ON `exemple` (clef1 asc, clef2 asc); -- ================================= -- Insertion dans la table `exemple` -- ================================= insert into `exemple` (clef1,clef2,info) value (1, 1, 'un'), (1, 1, 'deux'), (1, 1, 'trois'), (1, 2, 'quatre'), (1, 2, 'cinq'), (2, 1, 'six'); -- ============================ -- Création de la vue `details` -- ============================ create view `details` (clef1,clef2,info) as select clef1, clef2, info from `exemple` where clef1 = 1 and clef2 = 1; -- ============================ -- Vidage de la table `details` -- ============================ select * from `details`; -- ============================ -- Vidage de la table `exemple` -- ============================ select * from `exemple`;
@echo off chcp 1252 > nul set PATH=%WAMPSERVER%\bin\mysql\mysql5.6.23\bin\;%PATH% @echo "+---------------------------+" @echo "| Création DataBase 'Essai' |" @echo "+---------------------------+" @echo. mysql --user=root --password=root --host=localhost mysql < sample.sql @echo. pause exit