0% found this document useful (0 votes)
6 views20 pages

TP 1

Uploaded by

niangfall73
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)
6 views20 pages

TP 1

Uploaded by

niangfall73
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/ 20

mysql> show databases;

+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> creat database boutique;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'creat
database boutique' at line 1
mysql> create database boutique;
Query OK, 1 row affected (0.08 sec)

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> drop databases


-> drop databases
-> show databases;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'databases
drop databases
show databases' at line 1
mysql> create database boutique;
ERROR 1007 (HY000): Can't create database 'boutique'; database exists
mysql> drop databases boutique;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'databases boutique' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> drop database boutique;


Query OK, 0 rows affected (0.39 sec)

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> #mointrer les bases de donn�es


mysql> show datebases;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'datebases' at line 1
mysql> #creation de la bdd
mysql> create database boutique;
Query OK, 1 row affected (0.00 sec)

mysql> #utilisation base de donn�e boutique


mysql> use boutique;
Database changed
mysql> create table client(
-> contact int not null,
-> nom varchar(50) not null,
-> prenom varchar(100) not null,
-> adress varchar(100),
-> primary key(contact)
-> );
Query OK, 0 rows affected (0.27 sec)

mysql> describe client;


+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| contact | int(11) | NO | PRI | NULL | |
| nom | varchar(50) | NO | | NULL | |
| prenom | varchar(100) | NO | | NULL | |
| adress | varchar(100) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.13 sec)

mysql> create table produit(


-> idproduit int not null auto_increment,
-> nomproduit varchar(50) not null
-> prix produit int not null,
-> fabriquant varchar(100)
-> fabriquant varchar(100),
-> primary key (idproduit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'prix
produit int not null,
fabriquant varchar(100)
fabriquant varchar(100),
prim' at line 4
mysql> fabriquant varchar(100),
-> primary key (produit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant varchar(100),
primary key (produit)
)' at line 1
mysql> fabriquant varchar(100),
-> idproduit int not null AUTO-INCREMENT,
-> nomproduit varchar(50) not null,
-> prix produit int not null,
-> fabriquant varchar(100),
-> primary key (produit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant varchar(100),
idproduit int not null AUTO-INCREMENT,
nomproduit varch' at line 1
mysql>
mysql> create table produit(
-> idproduit int not null AUTO_INCREMENT,
-> nomproduit varchar(50) not null,
-> prix produit int not null,
-> fabriquant varchar(100),
-> primary key (produit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'produit
int not null,
fabriquant varchar(100),
primary key (produit)
)' at line 4
mysql> create table produit(
-> idproduit int not null AUTO-INCREMENT,
-> nomproduit varchar(50) not null,
-> prix produit int not null,
-> fabriquant varchar(100),
-> primary key (produit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'AUTO-
INCREMENT,
nomproduit varchar(50) not null,
prix produit int not null,
fabr' at line 2
mysql> create table produit(
-> idproduit int not null AUTO-INCREMENT,
-> nomproduit varchar(50) not null,
-> prixPRODUIT INT NOT NULL,
-> fabriquant varchar(100),
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'AUTO-
INCREMENT,
nomproduit varchar(50) not null,
prixPRODUIT INT NOT NULL,
fabri' at line 2
mysql> create table produit(
-> idproduit int not null AUTO-INCREMENT,
-> prixPRODUIT INT NOT NULL,
-> nomproduit varchar(50) not null,
->
-> nomproduit varchar(50) not null,
-> fabriquant varchar(100),
-> prix produit int not null,
-> prix produit int not null,
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'AUTO-
INCREMENT,
prixPRODUIT INT NOT NULL,
nomproduit varchar(50) not null,

nomp' at line 2
mysql> create table produit(
-> idproduit int not null AUTO-INCREMENT,
-> nomproduit varchar(50) not null,
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key (idproduit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'AUTO-
INCREMENT,
nomproduit varchar(50) not null,
prixproduit int not null,
fabri' at line 2
mysql> create table produit(
-> idproduit int not null AUTO_INCREMENT,
-> nomproduit varchar(50) not null,
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key (idproduit)
-> );
Query OK, 0 rows affected (0.22 sec)

mysql> describe produit;


+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| idproduit | int(11) | NO | PRI | NULL | auto_increment |
| nomproduit | varchar(50) | NO | | NULL | |
| prixproduit | int(11) | NO | | NULL | |
| fabriquant | varchar(100) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
4 rows in set (0.04 sec)

mysql> create table commande(


-> idcommande int not null auto_incremment,
-> date_commande date not null,
-> idproduit int,
-> contact int,
-> foreign key (idproduit) reference produit(idproduit),
-> primary key (incommande)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'auto_incremment,
date_commande date not null,
idproduit int,
contact int,
foreig' at line 2
mysql> foreign key (idproduit) reference produit(idproduit),;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'foreign
key (idproduit) reference produit(idproduit),' at line 1
mysql> create table commande(
-> idcommande int not null auto_increment,
->
-> idproduit int,
-> contact int,
-> foreign key (idproduit) reference produit(idproduit),
-> primary key (incommande)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'reference produit(idproduit),
primary key (incommande)
)' at line 6
mysql> create table commande(
-> idcommande int not null auto_increment,
-> idproduit int,
-> contact int,
-> foreign key (idproduit) reference produit(idproduit),
-> primary key (idcommande)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'reference produit(idproduit),
primary key (idcommande)
)' at line 5
mysql> create table commande(
-> idcommande int not null auto_increment,
-> idproduit int,
-> contact int,
-> foreign key (idproduit) references produit(idproduit),
-> primary key (idcommande)
-> );
Query OK, 0 rows affected (0.13 sec)

mysql> describe commande;


+------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------+------+-----+---------+----------------+
| idcommande | int(11) | NO | PRI | NULL | auto_increment |
| idproduit | int(11) | YES | MUL | NULL | |
| contact | int(11) | YES | | NULL | |
+------------+---------+------+-----+---------+----------------+
3 rows in set (0.02 sec)

mysql> notee
mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> use boutique
Database changed
mysql> show tables;
+--------------------+
| Tables_in_boutique |
+--------------------+
| client |
| commande |
| produit |
+--------------------+
3 rows in set (0.20 sec)

mysql> discribe client;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'discribe
client' at line 1
mysql> describe client;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| contact | int(11) | NO | PRI | NULL | |
| nom | varchar(50) | NO | | NULL | |
| prenom | varchar(100) | NO | | NULL | |
| adress | varchar(100) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.24 sec)

mysql>
mysql>
mysql> #inser insert into client(781763770, "mamadou", "diouf", "mbour")
mysql> values
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'values'
at line 1
mysql> insert into client(781763770, "mamadou", "diouf", "mbour");
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'781763770, "mamadou", "diouf", "mbour")' at line 1
mysql> insert into client(781763770, 'mamadou', 'diouf', 'mbour');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'781763770, 'mamadou', 'diouf', 'mbour')' at line 1
mysql> insert into client values (781763770, 'mamadou', 'diouf', 'mbour');
Query OK, 1 row affected (0.18 sec)

mysql> delete from client where id=1


-> ;
ERROR 1054 (42S22): Unknown column 'id' in 'where clause'
mysql> delete from client where contact=781763770;
Query OK, 1 row affected (0.09 sec)

mysql> insert into client values (781763770, 'diouf','mamadou', 'mbour');


Query OK, 1 row affected (0.08 sec)

mysql> insert into client values(781763770,'mamadou','diouf', mbour;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 1
mysql> insert into client values(781763770, 'mamadou', 'diouf', 'mbour');
ERROR 1062 (23000): Duplicate entry '781763770' for key 'PRIMARY'
mysql> insert into client values(771234567,'seck','ramatoulaye','somone');
Query OK, 1 row affected (0.07 sec)

mysql> #afficher toutes les donn�es de la table client


mysql> select * from client;
+-----------+-------+-------------+--------+
| contact | nom | prenom | adress |
+-----------+-------+-------------+--------+
| 771234567 | seck | ramatoulaye | somone |
| 781763770 | diouf | mamadou | mbour |
+-----------+-------+-------------+--------+
2 rows in set (0.00 sec)

mysql> insert into client values(772347643,'tall','abdoul


'> insert into client values(772347643,'tall','abdoul',
'> insert into client values(772347643,'tall','abdoul',
'> tee tp1.txt
'>
'>
'> ;
'> mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.20 sec)

mysql> create databases boutique;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'databases boutique' at line 1
mysql> drop databases
-> drop databases
-> drop databases;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'databases
drop databases
drop databases' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> drop databeses boutique;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'databeses boutique' at line 1
mysql> drop databes boutique;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'databes
boutique' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> creat database boutique;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'creat
database boutique' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> drop databaseboutique;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'databaseboutique' at line 1
mysql> drop database boutique;
Query OK, 3 rows affected (0.66 sec)

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> #mointrer les dases de doon�es


mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> #utilisation base de donn�e boutique


mysql> use boutique;
ERROR 1049 (42000): Unknown database 'boutique'
mysql> use boutique;
ERROR 1049 (42000): Unknown database 'boutique'
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql>
mysql> show databases boutique
-> help
-> use boutique;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'boutique
help
use boutique' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> creat database boutique;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'creat
database boutique' at line 1
mysql> show database boutique
-> creat database boutique;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'database
boutique
creat database boutique' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> creat database boutique;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'creat
database boutique' at line 1
mysql> drop database
-> drop databases boutique;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'drop
databases boutique' at line 2
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)

mysql> creat databases boutique


-> creat databases boutique;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'creat
databases boutique
creat databases boutique' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> use boutique


Database changed
mysql> create table client(
-> contact int not null,
-> nom varchar(50) not null,
-> prenom varchar(100) not null,
-> adress varchar(100),
-> primary key(contact)
-> );
ERROR 1050 (42S01): Table 'client' already exists
mysql> create table client(
-> contact int not null,
-> nom varcar(50) not null,
-> prenom varchar(100) not null,
-> adress varchar(100),
-> primary
-> primary key(contact)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'varcar(50) not null,
prenom varchar(100) not null,
adress varchar(100),
primary
' at line 3
mysql> create table client(
-> nom varchar(50) not null,
-> prenom varchar(100) not null,
-> adress varchar(100),
-> primary key(contact)
-> );
ERROR 1072 (42000): Key column 'contact' doesn't exist in table
mysql> create table client(
-> contact int not null,
-> nom varchar(50) not null,
-> prenom varchar(100) not null,
-> adress varchar(100),
-> primary key(contact)
-> );
ERROR 1050 (42S01): Table 'client' already exists
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> use boutique;


Database changed
mysql> create table client(
-> contact int not null,
-> nom varchar(50) not null,
-> prenom varchar(100) not null,
-> adress varchar(100),
-> primary key(contact)
-> );
ERROR 1050 (42S01): Table 'client' already exists
mysql> describe client;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| contact | int(11) | NO | PRI | NULL | |
| nom | varchar(50) | NO | | NULL | |
| prenom | varchar(100) | NO | | NULL | |
| adress | varchar(100) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql> create table produit(


-> idproduit int not null auto-increment
-> nomproduit varchar(50)
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(idproduit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'auto-
increment
nomproduit varchar(50)
prixproduit int not null,
fabriquant varch' at line 2
mysql> create table produit(
-> idproduit int not null auto-increment
-> nomproduit varchar(50)
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(idproduit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'auto-
increment
nomproduit varchar(50)
prixproduit int not null,
fabriquant varch' at line 2
mysql> create table client(
-> idproduit int not null auto_invrement,
-> nomproduit varchar(50),
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(idproduit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'auto_invrement,
nomproduit varchar(50),
prixproduit int not null,
fabriquant var' at line 2
mysql> create table produit(
-> idproduit int not null auto_incement
-> nomproduit varchar(50)
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(idproduit),
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'auto_incement
nomproduit varchar(50)
prixproduit int not null,
fabriquant varcha' at line 2
mysql> describe produit;
ERROR 1146 (42S02): Table 'boutique.produit' doesn't exist
mysql> idproduit int not null auto-increment
-> nomproduit varchar(50),
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(contact)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'idproduit int not null auto-increment
nomproduit varchar(50),
prixproduit int no' at line 1
mysql> describe produit;
ERROR 1146 (42S02): Table 'boutique.produit' doesn't exist
mysql> create table produit(
-> idproduit int not null auto-incement,
-> nomproduit varchar(50),
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(contact),
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'auto-
incement,
nomproduit varchar(50),
prixproduit int not null,
fabriquant varc' at line 2
mysql> idproduit int not null auto-increment
-> nomproduit varchar(50)
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(idproduit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'idproduit int not null auto-increment
nomproduit varchar(50)
prixproduit int not' at line 1
mysql> create table produit(
-> idproduit int not null auto-increment
-> nomproduit varchar(50)
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(idproduit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'auto-
increment
nomproduit varchar(50)
prixproduit int not null,
fabriquant varch' at line 2
mysql> create table produit(
-> idproduit int not null auto_incement
-> nomproduit varchar(50)
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(idproduit),
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'auto_incement
nomproduit varchar(50)
prixproduit int not null,
fabriquant varcha' at line 2
mysql> describe produit;
ERROR 1146 (42S02): Table 'boutique.produit' doesn't exist
mysql> create table produit(
-> idproduit int not null auto-increment
-> nomproduit varchar(50)
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key(idproduit)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'auto-
increment
nomproduit varchar(50)
prixproduit int not null,
fabriquant varch' at line 2
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| boutique |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> use boutique;


Database changed
mysql> create table client(
-> contact int not null,
-> nom varchar(50) not null,
-> prenom varchar(100) not null,
-> adress varchar(100),
-> primary key(contact)
-> );
ERROR 1050 (42S01): Table 'client' already exists
mysql> describe client;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| contact | int(11) | NO | PRI | NULL | |
| nom | varchar(50) | NO | | NULL | |
| prenom | varchar(100) | NO | | NULL | |
| adress | varchar(100) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.07 sec)

mysql> create table produit(


-> idproduit int not null auto_increment,
-> nomproduit varchar(50),
-> prixproduit int not null,
-> fabriquant varchar(100),
-> primary key (idproduit)
-> );
Query OK, 0 rows affected (0.15 sec)

mysql> describe produit;


+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| idproduit | int(11) | NO | PRI | NULL | auto_increment |
| nomproduit | varchar(50) | YES | | NULL | |
| prixproduit | int(11) | NO | | NULL | |
| fabriquant | varchar(100) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
4 rows in set (0.07 sec)

mysql> create table commande(


-> idcommande date not null,
-> idcommande date not null auto_increment,
-> date_commande date not null,
-> idproduit int,
-> contact int,
-> foreign key (idproduit) references produit(idproduit),
-> foreign key (contact) references client(contact),
-> primary key (idcommande)
-> );
ERROR 1063 (42000): Incorrect column specifier for column 'idcommande'
mysql> describe commande;
ERROR 1146 (42S02): Table 'boutique.commande' doesn't exist
mysql> create table commande(
-> idcommande date not null auto_increment,
-> date_commande date not null,
-> idproduit int,
-> contact int,
-> foreign key (idproduit) references produit(idproduit),
-> foreign key (contact) references client(contact),
-> primary key (idcommande)
-> );
ERROR 1063 (42000): Incorrect column specifier for column 'idcommande'
mysql> create table commande(
-> idcommande int not null auto_increment,
-> date_commande date not null,
-> idproduit int ,
-> foreign key (idproduit) references produit(idproduit),
-> foreign key (contact) references client(contact),
-> primary key (idcommande)
-> );
ERROR 1072 (42000): Key column 'contact' doesn't exist in table
mysql> create table commande(
-> idcommande int not null auto_increment,
-> date_commande date not null,
-> idproduit int ,
-> idproduit int,
-> foreign key (idproduit) references produit(idproduit),
-> foreign key (contact) references client(contact),
-> primary key (idcommande)
-> );
ERROR 1060 (42S21): Duplicate column name 'idproduit'
mysql> create table commande(
-> idcommande date not null auto_increment,
-> date_commande date not null,
-> idproduit int,
-> contact int,
-> foreign key (idproduit) references produit(idproduit),
-> foreign key (contact) references client(contact),
-> primary key (idcommande)
-> );
ERROR 1063 (42000): Incorrect column specifier for column 'idcommande'
mysql> create table commande(
-> idcommande int not null auto_increment,
-> date_commande date not null,
-> idproduit int,
-> contact int,
-> foreign key (idproduit) references produit(idproduit),
-> foreign key (contact) references client(contact),
-> primary key (idcommande)
-> );
Query OK, 0 rows affected (0.19 sec)

mysql> describe commande;


+---------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------+------+-----+---------+----------------+
| idcommande | int(11) | NO | PRI | NULL | auto_increment |
| date_commande | date | NO | | NULL | |
| idproduit | int(11) | YES | MUL | NULL | |
| contact | int(11) | YES | MUL | NULL | |
+---------------+---------+------+-----+---------+----------------+
4 rows in set (0.01 sec)

mysql> #inserer des donnes dans clients


mysql> insert into client(nom,adresse,contact,prenom)
-> values('tall','Mbour',772347643,'Abdoulaye');
ERROR 1054 (42S22): Unknown column 'adresse' in 'field list'
mysql> #inserer des donnes dans clients
mysql> insert into client(nom,adress,contact,prenom)
-> values('tall','Mbour',772347643,'Abdoulaye');
Query OK, 1 row affected (0.10 sec)

mysql> insert into client values(771234567,'seck','Ramatoulaye','somone');


Query OK, 1 row affected (0.07 sec)

mysql> insert into client values(775643212,'Ndiaye','Bassirou','saly');


Query OK, 1 row affected (0.07 sec)

mysql> describe client;


+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| contact | int(11) | NO | PRI | NULL | |
| nom | varchar(50) | NO | | NULL | |
| prenom | varchar(100) | NO | | NULL | |
| adress | varchar(100) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
4 rows in set (0.16 sec)

mysql> select* from client;


+-----------+--------+-------------+--------+
| contact | nom | prenom | adress |
+-----------+--------+-------------+--------+
| 771234567 | seck | Ramatoulaye | somone |
| 772347643 | tall | Abdoulaye | Mbour |
| 775643212 | Ndiaye | Bassirou | saly |
+-----------+--------+-------------+--------+
3 rows in set (0.04 sec)

mysql> insert into client values(763452678,'Goudiaby','Pierre','somone');


Query OK, 1 row affected (0.07 sec)

mysql> insert into client values(708964532,'Dieng','Fama','saly');


Query OK, 1 row affected (0.06 sec)

mysql> insert into client values(769843212,'Manga','Ibrahima','sOMONE');


Query OK, 1 row affected (0.07 sec)

mysql> insert into client values(768882345,'Niane','Fary','saly');


Query OK, 1 row affected (0.07 sec)

mysql> insert into client values(709812308,'Ndiaye','Marie','Mbour');


Query OK, 1 row affected (0.06 sec)

mysql> select* from client;


+-----------+----------+-------------+--------+
| contact | nom | prenom | adress |
+-----------+----------+-------------+--------+
| 708964532 | Dieng | Fama | saly |
| 709812308 | Ndiaye | Marie | Mbour |
| 763452678 | Goudiaby | Pierre | somone |
| 768882345 | Niane | Fary | saly |
| 769843212 | Manga | Ibrahima | sOMONE |
| 771234567 | seck | Ramatoulaye | somone |
| 772347643 | tall | Abdoulaye | Mbour |
| 775643212 | Ndiaye | Bassirou | saly |
+-----------+----------+-------------+--------+
8 rows in set (0.00 sec)

mysql> #insertion donnes dans la table produit


mysql> describe produit;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| idproduit | int(11) | NO | PRI | NULL | auto_increment |
| nomproduit | varchar(50) | YES | | NULL | |
| prixproduit | int(11) | NO | | NULL | |
| fabriquant | varchar(100) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
4 rows in set (0.02 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('macbook


air',500000,'appel');
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('iphone


12',450000,'appel');
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('TV 55


POUCES',910000,'LG');
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('CAMON


15',48900,'TECNO');
Query OK, 1 row affected (0.12 sec)

mysql> insert into produit(nomproduit,prixproduit) values ('RING LIGHT','20000');


Query OK, 1 row affected (0.08 sec)

mysql> insert into produit(nomproduit,prixproduit) values ('changeur


macbook',15000,'appel');
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> insert into produit(nomproduit,prixproduit) values ('RING LIGHT',20000);
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit) values ('changeur


macbook',15000,'appel');
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> insert into produit(nomproduit,prixproduit) values ('chargeur
macbook',15000,'appel');
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> insert into produit(nomproduit,prixproduit fabriquant) values ('chargeur
macbook',15000,'appel');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant) values ('chargeur macbook',15000,'appel')' at line 1
mysql> insert into produit(nomproduit,prixproduit fabriquant) values ('probook
15',200000,'hp');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant) values ('probook 15',200000,'hp')' at line 1
mysql> insert into produit(nomproduit,prixproduit fabriquant) values ('iphone
xr',255000,'appel');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant) values ('iphone xr',255000,'appel')' at line 1
mysql> insert into produit(nomproduit,prixproduit fabriquant) values ('notebook 255
G7',200000,'hp');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant) values ('notebook 255 G7',200000,'hp')' at line 1
mysql> insert into produit(nomproduit,prixproduit fabriquant) values ('spark
4',60000,'tecno');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant) values ('spark 4',60000,'tecno')' at line 1
mysql> select* from produit;
+-----------+--------------+-------------+------------+
| idproduit | nomproduit | prixproduit | fabriquant |
+-----------+--------------+-------------+------------+
| 1 | macbook air | 500000 | appel |
| 2 | iphone 12 | 450000 | appel |
| 3 | TV 55 POUCES | 910000 | LG |
| 4 | CAMON 15 | 48900 | TECNO |
| 5 | RING LIGHT | 20000 | NULL |
| 6 | RING LIGHT | 20000 | NULL |
+-----------+--------------+-------------+------------+
6 rows in set (0.00 sec)

mysql> select* from produit;


+-----------+--------------+-------------+------------+
| idproduit | nomproduit | prixproduit | fabriquant |
+-----------+--------------+-------------+------------+
| 1 | macbook air | 500000 | appel |
| 2 | iphone 12 | 450000 | appel |
| 3 | TV 55 POUCES | 910000 | LG |
| 4 | CAMON 15 | 48900 | TECNO |
| 5 | RING LIGHT | 20000 | NULL |
| 6 | RING LIGHT | 20000 | NULL |
+-----------+--------------+-------------+------------+
6 rows in set (0.00 sec)

mysql> insert into produit(nomproduit,prixproduit fabriquant) values ('chargeur


macbook',15000,'appel');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant) values ('chargeur macbook',15000,'appel')' at line 1
mysql> select* from client;
+-----------+----------+-------------+--------+
| contact | nom | prenom | adress |
+-----------+----------+-------------+--------+
| 708964532 | Dieng | Fama | saly |
| 709812308 | Ndiaye | Marie | Mbour |
| 763452678 | Goudiaby | Pierre | somone |
| 768882345 | Niane | Fary | saly |
| 769843212 | Manga | Ibrahima | sOMONE |
| 771234567 | seck | Ramatoulaye | somone |
| 772347643 | tall | Abdoulaye | Mbour |
| 775643212 | Ndiaye | Bassirou | saly |
+-----------+----------+-------------+--------+
8 rows in set (0.00 sec)

mysql> #insertion donnes dans la table produit


mysql> describe produit
-> describe produit;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'describe
produit' at line 2
mysql> #insertion donnes dans la table produit
mysql> describe produit;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| idproduit | int(11) | NO | PRI | NULL | auto_increment |
| nomproduit | varchar(50) | YES | | NULL | |
| prixproduit | int(11) | NO | | NULL | |
| fabriquant | varchar(100) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
4 rows in set (0.02 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('macbook


air',500000,'appel');
Query OK, 1 row affected (0.10 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('iphone


12',450000,'appel');
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('TV 55


POUCES',910000,'LG');
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('CAMON


15',48900,'TECNO');
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit) values ('ring light',20000);


Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit) values ('chargeur


macbook',15000,'appel');
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> insert into produit(nomproduit,prixproduit fabriquant) values ('chargeur
macbook',15000,'appel');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'fabriquant) values ('chargeur macbook',15000,'appel')' at line 1
mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('chargeur
macbook',15000,'appel');
Query OK, 1 row affected (0.06 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('probook


15',200000,'hp');
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('iphone


xr',255000,'appel');
Query OK, 1 row affected (0.07 sec)
mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('notebook 255
G7',200000,'hp');
Query OK, 1 row affected (0.07 sec)

mysql> insert into produit(nomproduit,prixproduit,fabriquant) values ('SPARK


4',60000,'TECNO');
Query OK, 1 row affected (0.06 sec)

mysql> SELECT* from produit;


+-----------+------------------+-------------+------------+
| idproduit | nomproduit | prixproduit | fabriquant |
+-----------+------------------+-------------+------------+
| 1 | macbook air | 500000 | appel |
| 2 | iphone 12 | 450000 | appel |
| 3 | TV 55 POUCES | 910000 | LG |
| 4 | CAMON 15 | 48900 | TECNO |
| 5 | RING LIGHT | 20000 | NULL |
| 6 | RING LIGHT | 20000 | NULL |
| 7 | macbook air | 500000 | appel |
| 8 | iphone 12 | 450000 | appel |
| 9 | TV 55 POUCES | 910000 | LG |
| 10 | CAMON 15 | 48900 | TECNO |
| 11 | ring light | 20000 | NULL |
| 12 | chargeur macbook | 15000 | appel |
| 13 | probook 15 | 200000 | hp |
| 14 | iphone xr | 255000 | appel |
| 15 | notebook 255 G7 | 200000 | hp |
| 16 | SPARK 4 | 60000 | TECNO |
+-----------+------------------+-------------+------------+
16 rows in set (0.00 sec)

You might also like