0% found this document useful (0 votes)
9 views

My Test Command

BIEN

Uploaded by

baron.netlab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

My Test Command

BIEN

Uploaded by

baron.netlab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

TYPE 1.

mysql -u root -p

1) create user'Baron'@'localhost' identified by'0844520';

2) grant all on*.* to'Baron'@'localhost';


(exit)= pour acceder à linterface connect

3) mysql -u Baron -p
Enter password: ****

4) create database Bagalwa;


(use Bagalwa)= pour commencer à saisir la table

5) -TAB1 create table employes(id_employe int (30) auto_increment primary key, nom
varchar (30) not null, prenom varchar (12) not null, matricule int (12) unique,
nbre_heure int (12) not null, salaire int (12) not null, salaire_total int (12) not
null, id_departement varchar(12));
-TAB2 create table departement(id_departement varchar (12) primary key,
nom_departement varchar (30) not null);
(desc employes;)= pour verifier la table créer

6) alter table employes add constraint pk_employes foreign key (id_departement)


references departement (id_departement);

7) create trigger calcul_salaire_total


-> before insert
-> on employes
-> for each row
-> set new.salaire_total=new.nmbre_heure*new.salaire;

9) insert into departement(id_departement,nom_departement)


values('GGT','Genie_et_gestion_de_telecom'),('info','Informatique'),
('SAE','Service_economique'),('GCV','Genie_Civile'),('Bio','Biologie');
(selesct*from departemrnt;)= pour voir la table accorder

8) insert into
employes(nom,prenom,matricule,nbre_heure,salaire,id_departement)values('Bagalwa','R
amazani',231012,9,250000,'GGT'),('Isaac','Baron',231016,5,300000,'info'),
('Benedict','Kasereka',231002,2,250000,'SAE'),
('Isaac','Sakoul',23186,8,250000,'GCV'),('Power','Net',231064,9,300000,'Bio');
(selesct*from employes;)= pour voir la table accorder

10) select e.nom,d.nom_departement from employes e join departement d on


e.id_departement =d.id_departement;

11) select e.nom,d.nom_departement from employes e cross join departement d;

TYPE 2

create table etudiant(id_etudiant int (12) auto_increment primary key, nom


varchar (30) not null, prenom varchar (30) not null, matricule int(12) unique,
departement varchar(30), age int (4) not null, nationalite varchar (30) not null);

1) alter table etudiant add chec_age int(4) check (age>18);


2) insert into
etudiant(nom,prenom,matricule,departement,age,nationalite)values('BAGALWA','Ramazan
i',20012,'GGT',30,'Congolaise'),('AUGUSTIN','Mulinda',20102,'GGT',20,'Congolaise'),
('PATIENT','Muhima',20006,'Info',25,'Congolaise'),
('SHANDRACK','Masoro',20022,'Info',22,'Burundaise'),
('HAKIZIMANA','Guershom',20065,'GGT',20,'Burundaise'),
('BASUBI','Igunzi',20201,'SAE',23,'Congolaise'),
('SIKULI','Lidie',20017,'SAE',21,'Tanzanienne'),
('PATO','GREAT',20002,'SAE',20,'Tanzanienne'),
('KASIDIKA','Jordan',20009,'GCV',23,'Tanzanienne'),
('ADELINE','Saleh',20030,'GCV',24,'Tanzanienne');

(select*from etudiant;)= pour voir la table accorder

3) select nom from etudiant where age =(select max(age)from etudiant);

4) select nationalite, count(*) as nombre_etudiant from etudiant group by


nationalite;

5) create trigger ajout_deux_ans


-> before insert
-> on etudiant
-> for each row
-> set new.age=new.age+2;
(insert into etudiant(nom,prenom,matricule,departement,age,nationalite)
values('KAMUHA','Julien',20062,'GCV',26,'Tanzanienne');)= pour verifier le tableau
du trigger creer
(select*from etudiant;)= pour afficher la table et voir le
modification

6) alter table etudiant change column departement faculte varchar(30);


(select*from student;)= pour afficher la table et voir le modification

You might also like