Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

BaseDeDonnees Insertion&Suppression MN

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 10

Microsoft Windows [version 10.0.22000.

739]
(c) Microsoft Corporation. Tous droits réservés.

C:\Users\utilisateur>mysql -h localhost -u MN -p
Enter password: ************
ERROR 1045 (28000): Access denied for user 'MN'@'localhost' (using password: YES)

C:\Users\utilisateur>mysql -h localhost -u MN -p
Enter password: ************
ERROR 1045 (28000): Access denied for user 'MN'@'localhost' (using password: YES)

C:\Users\utilisateur>mysql -h localhost -u MN -p
Enter password: ************
ERROR 1045 (28000): Access denied for user 'MN'@'localhost' (using password: YES)

C:\Users\utilisateur>mysql -h localhost -u MN -p
Enter password: ************
ERROR 1045 (28000): Access denied for user 'MN'@'localhost' (using password: YES)

C:\Users\utilisateur>select user from mysql.user;


'select' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

C:\Users\utilisateur>mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.4.24-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select user from mysql.user;


+------+
| User |
+------+
| MN |
| root |
| root |
| MN |
| MN |
| pma |
| root |
+------+
7 rows in set (0.004 sec)

MariaDB [(none)]> exit


Bye

C:\Users\utilisateur>mysql -h localhost -u MN -p
Enter password: ************
ERROR 1045 (28000): Access denied for user 'MN'@'localhost' (using password: YES)

C:\Users\utilisateur>mysql -h localhost -u MN -p
Enter password: ************
ERROR 1045 (28000): Access denied for user 'MN'@'localhost' (using password: YES)

C:\Users\utilisateur>mysql -h localhost -u MN -p
Enter password: *************
ERROR 1045 (28000): Access denied for user 'MN'@'localhost' (using password: YES)

C:\Users\utilisateur>mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.4.24-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> drop user 'MN'@'localhost';


Query OK, 0 rows affected (0.022 sec)

MariaDB [(none)]> select user from mysql.user;


+------+
| User |
+------+
| MN |
| root |
| root |
| MN |
| pma |
| root |
+------+
6 rows in set (0.002 sec)

MariaDB [(none)]> drop user 'MN'@'localhost';


ERROR 1396 (HY000): Operation DROP USER failed for 'MN'@'localhost'
MariaDB [(none)]> drop user 'MN'@'host';
ERROR 1396 (HY000): Operation DROP USER failed for 'MN'@'host'
MariaDB [(none)]> id MN;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'id MN'
at line 1
MariaDB [(none)]> id user;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'id
user' at line 1
MariaDB [(none)]> cd user;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'cd
user' at line 1
MariaDB [(none)]>
MariaDB [(none)]> user
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'user'
at line 1
MariaDB [(none)]> user MN id;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'user
MN id' at line 1
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
| uambdd |
+--------------------+
6 rows in set (0.001 sec)

MariaDB [(none)]> use uambdd;


Database changed
MariaDB [uambdd]> show tables;
+------------------+
| Tables_in_uambdd |
+------------------+
| classe |
| ecole |
| etudiant |
| evaluation |
| filiere |
| matiere |
| note |
| personne |
| prof |
+------------------+
9 rows in set (0.004 sec)

MariaDB [uambdd]> select* from prof;


Empty set (0.019 sec)

MariaDB [uambdd]> desc prof;


+----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| idprof | varchar(50) | NO | PRI | NULL | |
| grade | varchar(150) | YES | | NULL | |
| specialite | varchar(200) | YES | | NULL | |
| dernierdiplome | varchar(50) | NO | | NULL | |
| typecontrat | varchar(200) | YES | | NULL | |
| idpersonne | varchar(50) | YES | | NULL | |
+----------------+--------------+------+-----+---------+-------+
6 rows in set (0.012 sec)

MariaDB [uambdd]> insert into prof values(1,"Docteur","Informatique","Docteur en


Ingénieurie Conception","CDI",4);
Query OK, 1 row affected (0.013 sec)

MariaDB [uambdd]> insert into prof values(2,"Docteur","Informatique","Docteur en


Sciences de donnees","CDI",5);
Query OK, 1 row affected (0.004 sec)

MariaDB [uambdd]> insert into prof values(3,"Docteur","Informatique","Docteur en


Conception Algorithmique","CDD",6);
Query OK, 1 row affected (0.006 sec)

MariaDB [uambdd]> select * from prof;


+--------+---------+--------------+-------------------------------------
+-------------+------------+
| idprof | grade | specialite | dernierdiplome |
typecontrat | idpersonne |
+--------+---------+--------------+-------------------------------------
+-------------+------------+
| 1 | Docteur | Informatique | Docteur en Ingénieurie Conception | CDI
| 4 |
| 2 | Docteur | Informatique | Docteur en Sciences de donnees | CDI
| 5 |
| 3 | Docteur | Informatique | Docteur en Conception Algorithmique | CDD
| 6 |
+--------+---------+--------------+-------------------------------------
+-------------+------------+
3 rows in set (0.001 sec)

MariaDB [uambdd]> desc ecole;


+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| idecole | varchar(100) | NO | PRI | NULL | |
| nomecole | varchar(150) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
2 rows in set (0.029 sec)

MariaDB [uambdd]> insert into ecole values(1,"Ecole Supérieure des Sciences et


Techniques de l'Ingénieur");
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
MariaDB [uambdd]> select * from ecole;
+---------+----------+
| idecole | nomecole |
+---------+----------+
| 1 | UAM |
+---------+----------+
1 row in set (0.000 sec)

MariaDB [uambdd]> desc filiere;


+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| idfiliere | varchar(100) | NO | PRI | NULL | |
| nomfiliere | varchar(150) | YES | | NULL | |
| idecole | varchar(100) | YES | MUL | NULL | |
+------------+--------------+------+-----+---------+-------+
3 rows in set (0.028 sec)

MariaDB [uambdd]> insert into ecole values(2,"Ecole Supérieure des Sciences et


Techniques de l'Ingénieur");
Query OK, 1 row affected (0.006 sec)

MariaDB [uambdd]> insert into filiere values(1,"Ingénieurie Informatique",2);


Query OK, 1 row affected (0.009 sec)

MariaDB [uambdd]> desc classe;


+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| idclasse | varchar(100) | NO | PRI | NULL | |
| nomclasse | varchar(150) | YES | UNI | NULL | |
| niveau | varchar(50) | YES | | NULL | |
| nmbreetudiant | int(11) | YES | | NULL | |
| promotion | varchar(100) | YES | | NULL | |
| idpersonne | varchar(50) | YES | | NULL | |
| idfiliere | varchar(100) | YES | MUL | NULL | |
+---------------+--------------+------+-----+---------+-------+
7 rows in set (0.037 sec)

MariaDB [uambdd]> insert into classe values(1,"Esti Autonome","L2",17,"P2",1,1);


Query OK, 1 row affected (0.009 sec)

MariaDB [uambdd]> insert into classe values(1,"Esti Autonome","L2",17,"P2",2,1);


ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
MariaDB [uambdd]> select * from classe;
+----------+---------------+--------+---------------+-----------+------------
+-----------+
| idclasse | nomclasse | niveau | nmbreetudiant | promotion | idpersonne |
idfiliere |
+----------+---------------+--------+---------------+-----------+------------
+-----------+
| 1 | Esti Autonome | L2 | 17 | P2 | 1 | 1
|
+----------+---------------+--------+---------------+-----------+------------
+-----------+
1 row in set (0.003 sec)

MariaDB [uambdd]> insert into classe values(2,"Esti Autonome","L2",17,"P2",2,1);


ERROR 1062 (23000): Duplicate entry 'Esti Autonome' for key 'nomclasse'
MariaDB [uambdd]> desc etudiant;
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| idetudiant | varchar(100) | NO | PRI | NULL | |
| nometudiant | varchar(150) | YES | | NULL | |
| codepermanent | varchar(100) | YES | UNI | NULL | |
| sexe | char(10) | YES | | NULL | |
| lyceeorigine | varchar(100) | YES | | NULL | |
| datenaissance | datetime | NO | | NULL | |
| idpersonne | varchar(50) | YES | | NULL | |
| idclasse | varchar(100) | YES | MUL | NULL | |
+---------------+--------------+------+-----+---------+-------+
8 rows in set (0.081 sec)

MariaDB [uambdd]> insert into etudiant values(1,"NDIAYE",200309,");


">
"> M"
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near '' at
line 1
MariaDB [uambdd]> insert into etudiant values(1,"NDIAYE",200309,"M","CCHT",15-02-
2002,1,1);
Query OK, 1 row affected, 1 warning (0.008 sec)

MariaDB [uambdd]> select* from etudiant;


+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| idetudiant | nometudiant | codepermanent | sexe | lyceeorigine | datenaissance
| idpersonne | idclasse |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| 1 | NDIAYE | 200309 | M | CCHT | 0000-00-00
00:00:00 | 1 | 1 |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
1 row in set (0.003 sec)

MariaDB [uambdd]> insert into etudiant values(2,"Mendy",200308,"M","Yalla


Souren",2002-14-12 17:30:00,1,1);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near
'17:30:00,1,1)' at line 1
MariaDB [uambdd]> insert into etudiant values(2,"Mendy",200308,"M","Yalla
Souren",2002-14-12 17:30:10,1,1);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near
'17:30:10,1,1)' at line 1
MariaDB [uambdd]> insert into etudiant values(2,"Mendy",200308,"M","Yalla
Souren",2002-14-12,1,1);
Query OK, 1 row affected, 1 warning (0.005 sec)

MariaDB [uambdd]> insert into etudiant values(3,"GUEYE",200307,"M","CCHT",2002-07-


09,1,1);
Query OK, 1 row affected, 1 warning (0.006 sec)

MariaDB [uambdd]> select* from etudiant;


+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| idetudiant | nometudiant | codepermanent | sexe | lyceeorigine | datenaissance
| idpersonne | idclasse |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| 1 | NDIAYE | 200309 | M | CCHT | 0000-00-00
00:00:00 | 1 | 1 |
| 2 | Mendy | 200308 | M | Yalla Souren | 0000-00-00
00:00:00 | 1 | 1 |
| 3 | GUEYE | 200307 | M | CCHT | 0000-00-00
00:00:00 | 1 | 1 |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
3 rows in set (0.001 sec)

MariaDB [uambdd]> delete from etudiant where id=3;


ERROR 1054 (42S22): Unknown column 'id' in 'where clause'
MariaDB [uambdd]> delete from etudiant where idetudiant=3;
Query OK, 1 row affected (0.012 sec)

MariaDB [uambdd]> select* from etudiant;


+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| idetudiant | nometudiant | codepermanent | sexe | lyceeorigine | datenaissance
| idpersonne | idclasse |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| 1 | NDIAYE | 200309 | M | CCHT | 0000-00-00
00:00:00 | 1 | 1 |
| 2 | Mendy | 200308 | M | Yalla Souren | 0000-00-00
00:00:00 | 1 | 1 |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
2 rows in set (0.001 sec)
MariaDB [uambdd]> delete from etudiant where idetudiant=2;
Query OK, 1 row affected (0.006 sec)

MariaDB [uambdd]> select* from etudiant;


+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| idetudiant | nometudiant | codepermanent | sexe | lyceeorigine | datenaissance
| idpersonne | idclasse |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| 1 | NDIAYE | 200309 | M | CCHT | 0000-00-00
00:00:00 | 1 | 1 |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
1 row in set (0.001 sec)

MariaDB [uambdd]> insert into etudiant values(2,"Mendy",200308,"M","Yalla


Souren",2002-14-12,2,1);
Query OK, 1 row affected, 1 warning (0.006 sec)

MariaDB [uambdd]> insert into etudiant values(3,"GUEYE",200307,"M","CCHT",2002-07-


09,3,1);
Query OK, 1 row affected, 1 warning (0.007 sec)

MariaDB [uambdd]> select* from etudiant;


+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| idetudiant | nometudiant | codepermanent | sexe | lyceeorigine | datenaissance
| idpersonne | idclasse |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| 1 | NDIAYE | 200309 | M | CCHT | 0000-00-00
00:00:00 | 1 | 1 |
| 2 | Mendy | 200308 | M | Yalla Souren | 0000-00-00
00:00:00 | 2 | 1 |
| 3 | GUEYE | 200307 | M | CCHT | 0000-00-00
00:00:00 | 3 | 1 |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
3 rows in set (0.001 sec)

MariaDB [uambdd]> delete from ecole where idecole=1;


Query OK, 1 row affected (0.006 sec)

MariaDB [uambdd]> desc ecole;


+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| idecole | varchar(100) | NO | PRI | NULL | |
| nomecole | varchar(150) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
2 rows in set (0.031 sec)

MariaDB [uambdd]> select* from ecole;


+---------+------------------------------------------------------------+
| idecole | nomecole |
+---------+------------------------------------------------------------+
| 2 | Ecole Supérieure des Sciences et Techniques de l'Ingénieur |
+---------+------------------------------------------------------------+
1 row in set (0.000 sec)

MariaDB [uambdd]> delete from ecole where idecole=2;


ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint
fails (`uambdd`.`filiere`, CONSTRAINT `fk_idecole` FOREIGN KEY (`idecole`)
REFERENCES `ecole` (`idecole`))
MariaDB [uambdd]> insert into ecole values(1,"Ecole Supérieure des Sciences et
Techniques de l'Ingénieur");
Query OK, 1 row affected (0.006 sec)

MariaDB [uambdd]> select* from ecole;


+---------+------------------------------------------------------------+
| idecole | nomecole |
+---------+------------------------------------------------------------+
| 1 | Ecole Supérieure des Sciences et Techniques de l'Ingénieur |
| 2 | Ecole Supérieure des Sciences et Techniques de l'Ingénieur |
+---------+------------------------------------------------------------+
2 rows in set (0.001 sec)

MariaDB [uambdd]> delete from ecole where idecole=2;


ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint
fails (`uambdd`.`filiere`, CONSTRAINT `fk_idecole` FOREIGN KEY (`idecole`)
REFERENCES `ecole` (`idecole`))
MariaDB [uambdd]> desc filiere;;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| idfiliere | varchar(100) | NO | PRI | NULL | |
| nomfiliere | varchar(150) | YES | | NULL | |
| idecole | varchar(100) | YES | MUL | NULL | |
+------------+--------------+------+-----+---------+-------+
3 rows in set (0.027 sec)

ERROR: No query specified

MariaDB [uambdd]> select * from filiere;


+-----------+--------------------------+---------+
| idfiliere | nomfiliere | idecole |
+-----------+--------------------------+---------+
| 1 | Ingénieurie Informatique | 2 |
+-----------+--------------------------+---------+
1 row in set (0.001 sec)

MariaDB [uambdd]> delete from filiere where idfiliere=1;


ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint
fails (`uambdd`.`classe`, CONSTRAINT `fk_idfiliere` FOREIGN KEY (`idfiliere`)
REFERENCES `filiere` (`idfiliere`))
MariaDB [uambdd]> delete from etudiant where idetudiant=1;
Query OK, 1 row affected (0.006 sec)

MariaDB [uambdd]> delete from etudiant where idetudiant=2;


Query OK, 1 row affected (0.016 sec)

MariaDB [uambdd]> delete from etudiant where idetudiant=3;


Query OK, 1 row affected (0.003 sec)

MariaDB [uambdd]> delete from classe where idclasse=1;


Query OK, 1 row affected (0.006 sec)
MariaDB [uambdd]> delete from filiere where idfiliere=1;
Query OK, 1 row affected (0.006 sec)

MariaDB [uambdd]> delete from ecole where idecole=2;


Query OK, 1 row affected (0.003 sec)

MariaDB [uambdd]> select* from ecole;


+---------+------------------------------------------------------------+
| idecole | nomecole |
+---------+------------------------------------------------------------+
| 1 | Ecole Supérieure des Sciences et Techniques de l'Ingénieur |
+---------+------------------------------------------------------------+
1 row in set (0.000 sec)

MariaDB [uambdd]> insert into filiere values(1,"Ingénieurie Informatique",1);


Query OK, 1 row affected (0.020 sec)

MariaDB [uambdd]> insert into classe values(1,"Esti Autonome","L2",17,"P2",1,1);


Query OK, 1 row affected (0.005 sec)

MariaDB [uambdd]> insert into etudiant


values(1,"NDIAYE",200309,"M","CCHT",15/02/2002,1,1);
Query OK, 1 row affected, 1 warning (0.006 sec)

MariaDB [uambdd]> select* from etudiant;


+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| idetudiant | nometudiant | codepermanent | sexe | lyceeorigine | datenaissance
| idpersonne | idclasse |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| 1 | NDIAYE | 200309 | M | CCHT | 0000-00-00
00:00:00 | 1 | 1 |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
1 row in set (0.001 sec)

MariaDB [uambdd]> insert into etudiant values(2,"Mendy",200308,"M","Yalla


Souren",2002-14-12,2,1);
Query OK, 1 row affected, 1 warning (0.003 sec)

MariaDB [uambdd]> insert into etudiant values(3,"GUEYE",200307,"M","CCHT",2002-07-


09,3,1);
Query OK, 1 row affected, 1 warning (0.005 sec)

MariaDB [uambdd]> select* from etudiant;


+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| idetudiant | nometudiant | codepermanent | sexe | lyceeorigine | datenaissance
| idpersonne | idclasse |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
| 1 | NDIAYE | 200309 | M | CCHT | 0000-00-00
00:00:00 | 1 | 1 |
| 2 | Mendy | 200308 | M | Yalla Souren | 0000-00-00
00:00:00 | 2 | 1 |
| 3 | GUEYE | 200307 | M | CCHT | 0000-00-00
00:00:00 | 3 | 1 |
+------------+-------------+---------------+------+--------------
+---------------------+------------+----------+
3 rows in set (0.001 sec)

MariaDB [uambdd]> select* from classe;


+----------+---------------+--------+---------------+-----------+------------
+-----------+
| idclasse | nomclasse | niveau | nmbreetudiant | promotion | idpersonne |
idfiliere |
+----------+---------------+--------+---------------+-----------+------------
+-----------+
| 1 | Esti Autonome | L2 | 17 | P2 | 1 | 1
|
+----------+---------------+--------+---------------+-----------+------------
+-----------+
1 row in set (0.000 sec)

MariaDB [uambdd]>

You might also like