Relationnel sous MySQL

From Tuxunix
Revision as of 15:14, 14 December 2010 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#
#Create database GESGES
#

if exist DROP database gesges;

CREATE DATABASE gesges;

use gesges

CREATE TABLE customerGesges (
 codeCustomer INT auto_increment,
 nomCustomer VARCHAR(50) NOT NULL,
 prenomCustomer VARCHAR(50) NULL,
 adressCustomer VARCHAR(100) NULL,
 telCustomer VARCHAR(13) NULL,
 mailCustomer VARCHAR(25) NULL,
 INDEX idxNomCustomer(nomCustomer),
 PRIMARY KEY (codeCustomer)) ENGINE = InnoDB;


CREATE TABLE siteGesges (
 idSite INT auto_increment,
 nomSite VARCHAR(50) NOT NULL,
 nomBdd VARCHAR(50) NULL,
 userFtp VARCHAR(50) NULL,
 fk_codeCustomer INT NOT NULL,
 PRIMARY KEY (idSite),
 INDEX idxFkCodeCustomer (fk_codeCustomer),
 FOREIGN KEY (fk_codeCustomer) REFERENCES customerGesges(codeCustomer) ON DELETE CASCADE ON UPDATE CASCADE,
 INDEX idxSite (nomSite)) ENGINE = InnoDB;