0% found this document useful (0 votes)
15 views9 pages

TP SQL

This document contains the report from a student named Salma Tiguini on a science of information internship. It includes 14 SQL queries that were worked on as part of a training on SQL and two tables of employees and departments. The queries select, count, group and join data from the tables to retrieve employee IDs, names, departments, salaries and ages involved in different projects. Some queries also update, insert into and delete from the tables.

Uploaded by

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

TP SQL

This document contains the report from a student named Salma Tiguini on a science of information internship. It includes 14 SQL queries that were worked on as part of a training on SQL and two tables of employees and departments. The queries select, count, group and join data from the tables to retrieve employee IDs, names, departments, salaries and ages involved in different projects. Some queries also update, insert into and delete from the tables.

Uploaded by

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

FILIERE :Génie Aéronautique et Technologie de l’Espace

RAPPORT
SCIENCE
D'INFORMATION :

Travaillé par : Tiguini Salma

Encadré par : MR Echchadi


FILIERE :Génie Aéronautique et Technologie de l’Espace

TP1:
Les requêtes SQL :

1.

selectResNo from reservations


join hotels using (Hotel) where
Name ="Hard Days Inn";

2.

select ResNo fr
om reservations

where DateNow
between'2006-
11-
01' and '2006-
11-30'

3..

selectResNo

from reservations where


DateOut='2006-11-11';
FILIERE :Génie Aéronautique et Technologie de l’Espace

4. select ResNo,DateOut-dateln as
duree from reservation group by
ResNo;

5 . select ResNo from reservations where DateIn in (

select DateIn from reservations where LastName="Peterson" and FirstName="Lena");

6. select ResNo from reservations join paymenttypes using (Payment) where Description="Visa"
FILIERE :Génie Aéronautique et Technologie de l’Espace

7. select ResNo ,avg(Price) as moyenne from rooms join reservations using (Room) where DateNow='2006-
11-01';

8. SELECT COUNT(Hotel),Name FROM Hotels NATURAL JOIN Reservations WHERE DateIn BETWEEN
'2006-11-01'AND'2006-11-30' GROUP BY Hotel;

9. select count(ResNo),Hotel from reservations group by Hotel;


FILIERE :Génie Aéronautique et Technologie de l’Espace

10.select count(ResNo),Name from reservations join hotels using (Hotel) group by stars;

11. select count(ResNo) as total_reservation, hotel from reservations join hotels using (Hotel) group by
Hotel order by total_reservation DESC limit 1;

12. SELECT * FROM hotels join rooms using (Hotel) group by Hotel order by Price DESC LIMIT 1;
FILIERE :Génie Aéronautique et Technologie de l’Espace

13.
SELECT DISTINCT(Hotel),Name FROM hotels join Rooms using (Hotel) where Price in (
SELECT Price from rooms join hotels using (Hotel) where Name="Grand View Hotel")
and Name<>"Grand View Hotel";

14.
SELECT DISTINCT Name FROM hotels JOIN rooms WHERE Price > ALL (SELECT Price FROM hotels
NATURAL JOIN rooms WHERE Name ='Grand View Hotel')
FILIERE :Génie Aéronautique et Technologie de l’Espace

TP 2 :
1. SELECT Id from employes INNER JOIN participer on employes.Id =participer.Emp INNER JOIN projet
on participer.Proj=projet.Id_p WHERE Titre="SI Vente" or Titre="Blog RH"

2. SELECT DISTINCT(Nom_Dep) FROM departement INNER JOIN employes on


departement.Id_dep=employes.Dep where Id in (select Emp from participer);

3. SELECT * FROM employes where Id not in (select Emp from participer)


FILIERE :Génie Aéronautique et Technologie de l’Espace

4. SELECT * FROM `employes_sauvegarde` WHERE (Dep,Salaire)in(select Dep ,Max(Salaire)FROM


employes_sauvegarde group by Dep )

5. CREATE TABLE Employes_SAUVEGARDE ASSELECT *FROM Employes;


INSERT INTO Employes_SAUVEGARDESELECT *FROM Employes;

6. Update employes set Salaire=Salaire *1.25 where Age>=30;


FILIERE :Génie Aéronautique et Technologie de l’Espace

7. Delete from employes where Age <=29;

You might also like