0% found this document useful (0 votes)
23 views4 pages

TP6

Uploaded by

hassnisara4
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)
23 views4 pages

TP6

Uploaded by

hassnisara4
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

Microsoft Windows [Version 10.0.19045.

4046]
(c) Microsoft Corporation. All rights reserved.

C:\Users\hp>mysql --version
mysql Ver 8.0.19 for Win64 on x86_64 (MySQL Community Server - GPL)

C:\Users\hp>mysql -u root -p
Enter password: ***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 8.0.19 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective
owners.

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

mysql> create database centre_de_formation ;


Query OK, 1 row affected (0.04 sec)

mysql> use centre_de_formation ;


Database changed
mysql> create table inscription (
codeSess int ,
numCINEtu varchar(8),
TypeCours varchar(20),
FOREIGN KEY (numCINEtu) REFERENCES etudiant(numCINEtu));
Query OK, 0 rows affected (0.10 sec)

mysql> desc inscription ;


+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| codeSess | int | YES | | NULL | |
| numCINEtu | varchar(8) | YES | | NULL | |
| TypeCours | varchar(10) | YES | | NULL | |
+-----------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)

mysql> INSERT INTO inscription (codeSess, numCINEtu, TypeCours) VALUES


-> (1101, 'AB234567', 'Distanciel'),
-> (1101, 'G5346789', 'Distanciel'),
-> (1101, 'C0987265', 'Distanciel'),
-> (1101, 'D2356903', 'Distanciel'),
-> (1101, 'Y1234987', 'Distanciel'),
-> (1101, 'J3578902', 'Distanciel'),
-> (1101, 'F9827363', 'Distanciel'),
-> (1201, 'AB234567', 'Présentiel'),
-> (1201, 'G5346789', 'Présentiel'),
-> (1201, 'C0987265', 'Présentiel'),
-> (1201, 'D2356903', 'Présentiel'),
-> (1201, 'Y1234987', 'Présentiel'),
-> (1201, 'J3578902', 'Présentiel'),
-> (1302, 'AB234567', 'Présentiel'),
-> (1302, 'G5346789', 'Distanciel'),
-> (1302, 'C0987265', 'Présentiel'),
-> (1302, 'D2356903', 'Présentiel'),
-> (1302, 'Y1234987', 'Présentiel'),
-> (1401, 'G5346789', 'Distanciel'),
-> (1401, 'C0987265', 'Distanciel'),
-> (1401, 'D2356903', 'Distanciel'),
-> (1401, 'Y1234987', 'Distanciel'),
-> (1401, 'J3578902', 'Distanciel'),
-> (1401, 'F9827363', 'Distanciel'),
-> (1501, 'AB234567', 'Distanciel'),
-> (1501, 'G5346789', 'Présentiel'),
-> (1501, 'C0987265', 'Distanciel'),
-> (1501, 'D2356903', 'Présentiel'),
-> (1501, 'Y1234987', 'Présentiel'),
-> (1501, 'J3578902', 'Présentiel'),
-> (1501, 'F9827363', 'Présentiel');
Query OK, 31 rows affected (0.02 sec)
Records: 31 Duplicates: 0 Warnings: 0

mysql> CREATE TABLE session (


codeSess INT PRIMARY KEY,
nomSess VARCHAR(50),
Datedebut DATE,
Datefin DATE,
codeform INT
-> );
Query OK, 0 rows affected (0.07 sec)

mysql> INSERT INTO session (codeSess, nomSess, Datedebut, Datefin, codeform) VALUES
-> (1101, 'Session1101', '2022-01-02', '2022-01-14', 11),
-> (1102, 'Session 1102', '2022-02-03', '2022-02-15', 11),
-> (1201, 'Session 1201', '2022-03-04', '2022-03-18', 12),
-> (1202, 'Session 1202', '2022-04-05', '2022-04-19', 12),
-> (1301, 'Session 1301', '2022-01-06', '2022-01-21', 13),
-> (1302, 'Session 1302', '2022-05-07', '2022-05-22', 13),
-> (1303, 'Session 1303', '2022-06-08', '2022-06-23', 13),
-> (1401, 'Session 1401', '2022-09-01', '2022-09-11', 14),
-> (1402, 'Session 1402', '2022-08-08', '2022-08-18', 14),
-> (1501, 'Session 1501', '2022-11-11', '2022-12-01', 15),
-> (1502, 'Session 1502', '2022-09-12', '2022-10-02', 15),
-> (1601, 'Session 1601', '2022-09-13', '2022-09-25', 16),
-> (1602, 'Session 1602', '2022-10-14', '2022-10-26', 16),
-> (1104, 'Session 1104', '2022-10-15', '2022-10-27', 11),
-> (1203, 'Session 1203', '2022-11-16', '2022-11-30', 12),
-> (1204, 'Session 1204', '2022-12-17', '2022-12-31', 12);
Query OK, 16 rows affected (0.01 sec)
Records: 16 Duplicates: 0 Warnings: 0

mysql> CREATE TABLE etudiant (


numCINEtu VARCHAR(10) PRIMARY KEY,
nomEtu VARCHAR(50),
prenomEtu VARCHAR(50),
dateNaissance DATE,
adressEtu VARCHAR(100),
villeEtu VARCHAR(50),
niveauEtu VARCHAR(20)
-> );
Query OK, 0 rows affected (0.04 sec)

mysql> INSERT INTO etudiant (numCINEtu, nomEtu, prenomEtu, dateNaissance,


adressEtu, villeEtu, niveauEtu) VALUES
-> ('AB234567', 'Alami', 'Ahmad', '1986-01-01', 'Rue du port, 13', 'Tanger',
'bac'),
-> ('G5346789', 'Toumi', 'Aicha', '2000-03-12', 'N12 immeuble Jaouhara',
'Casablanca', 'Master'),
-> ('C0987265', 'Souni', 'Sanaa', '1998-04-30', 'Place du peuple n 2',
'Tanger', 'Niveau bac'),
-> ('D2356903', 'Idrissi Alami', 'Mohammed', '1996-05-05', 'Lotissement najah,
rue n 12 immeuble 3', 'Rabat', 'Bac+ 4'),
-> ('Y1234987', 'Ouled thami', 'Ali', '1979-12-04', 'La ville haute, rue
chouhada n 6', 'Tanger', 'Bachelor'),
-> ('J3578902', 'Ben Omar', 'Abd Allah', '1990-06-25', 'Villa Amina n12 bir
rami', 'Kenitra', 'Phd'),
-> ('F9827363', 'Boudiaf', 'Fatima Zohra', '1997-01-10', 'Immeuble iftikhar, n
13 ettakaddoum', 'Rabat', 'Bac + 2');
Query OK, 7 rows affected (0.01 sec)
Records: 7 Duplicates: 0 Warnings: 0

mysql> CREATE TABLE Formation (


codeForm INT PRIMARY KEY,
titreForm VARCHAR(50),
dureeForm INT,
prixForm INT
-> );
Query OK, 0 rows affected (0.05 sec)

mysql> INSERT INTO Formation (codeForm, titreForm, dureeForm, prixForm) VALUES


-> (11, 'Programming Java', 12, 3600),
-> (12, 'web developpment', 14, 4200),
-> (13, 'Anglais technique', 15, 3750),
-> (14, 'Communication', 10, 2500),
-> (15, 'Base de données Oracle', 20, 6000),
-> (16, 'Soft skills', 12, 3000);
Query OK, 6 rows affected (0.01 sec)
Records: 6 Duplicates: 0 Warnings: 0

mysql> CREATE TABLE specialite (


codeSpec INT PRIMARY KEY,
nomSpec VARCHAR(50),
descSpec VARCHAR(100),
Active INT
-> );
Query OK, 0 rows affected (0.05 sec)

mysql> INSERT INTO specialite (codeSpec, nomSpec, descSpec, Active) VALUES


-> (101, 'GL', 'Genie logiciel et developpement', 1),
-> (102, 'Data', 'Data engineering', 1),
-> (103, 'Langues', 'Anglais, Français', 1),
-> (104, 'Communication', 'Communication', 1),
-> (105, 'Securite', 'Reseaux et securite', 0);
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0

mysql> CREATE TABLE catalogue (


CodeSpec INT,
codeForm INT,
FOREIGN KEY (CodeSpec) REFERENCES specialite(codeSpec),
FOREIGN KEY (codeForm) REFERENCES Formation(codeForm)
-> );
Query OK, 0 rows affected (0.14 sec)

mysql> INSERT INTO catalogue (CodeSpec, codeForm) VALUES


-> (101, 11),
-> (101, 12),
-> (102, 15),
-> (101, 15),
-> (103, 13),
-> (104, 13),
-> (104, 14),
-> (104, 16);
Query OK, 8 rows affected (0.01 sec)
Records: 8 Duplicates: 0 Warnings: 0

mysql> show tables ;


+-------------------------------+
| Tables_in_centre_de_formation |
+-------------------------------+
| catalogue |
| etudiant |
| formation |
| inscription |
| session |
| specialite |
+-------------------------------+
6 rows in set (0.01 sec)

mysql>

You might also like