You are on page 1of 18

LAB-2(IT214)

NAME – Lakshya Singh

Roll no. – 201901248

Q11. Find the count of different event names?

SQL:-

select count(distinct "Event_Name")


from "Event"

Tupples - 1

Screenshot:-

Q12. List out the different event’s price in ascending order of its price.

SQL:-
select distinct "Event_Name", "Event_Price"
from "Event"
order by "Event_Price"

Tupples:-
20

Screenshot:-
Q13. List out event names which are happening at area ‘Vesu’.

SQL:-
SELECT distinct "Event_Name"
FROM "Event"
WHERE "Location_ID" IN(
SELECT "Location_ID"
FROM "Event_Location"
WHERE "Area_Name" = 'Vesu'
);

Tupples:-
6

Screenshot:-
Q14. List out the participant names who have participated in ‘Java Bash’
coding event.

SQL:-
SELECT "Participant_Name"
FROM "Participant"
WHERE "Event_ID" IN(
SELECT "Event_ID"
FROM "Event"
WHERE "Event_Name" = 'Java Bash'
);

Tupples:-
12

Screenshot:-
Q15. Find the count of participant who are participating in 'Singing'
event.

SQL:-
SELECT count("Participant_Name") FROM "Participant" WHERE "Event_ID"
IN( SELECT "Event_ID" FROM "Event" WHERE "Event_Name" = 'Singing' );

Tupples:-
6

Screenshot:-
Q16. List out the organizers name for sports event.

SQL:-
select "Participant_Name"
from "Participant"
where "Participation_Type" = 'Organizer' and "Event_ID" in (
select "Event_ID"
from "Event"
where "Event_Type_ID" in (
select "Event_Type_ID"
from "Event_Type"
where "Event_Type_Name" = 'Sports'
)
);

Tupples:-

12

Screenshot:-

Q17. List out the female participants who are participating in ‘'GK Quiz’.

SQL:-
select "Participant_Name"
from "Participant"
where "Participant_Gender" = 'Female' and "Event_ID" in (
select "Event_ID"
from "Event"
where "Event_Name" = 'GK Quiz'
);

Tupples:-
3

Screenshot:-

Q18. Find the count of male participants who have taken part in
‘Business Workshop’.
SQL:-
select count("Participant_Name")
from "Participant"
where "Participant_Gender" = 'Male' and "Event_ID" in (
select "Event_ID"
from "Event"
where "Event_Name" = 'Business Workshop'
);

Tupples:-
1

Screenshot:-
Q19. Find the maximum temperature recorded from all locations.

SQL:-
SELECT "Participant_Name",COUNT("Event_Name")
FROM "Participant"
JOIN "Event"
ON "Event"."Event_ID" = "Participant"."Event_ID"
GROUP BY "Participant_Name"
HAVING COUNT("Event_Name") > 1;

Tupples:-

Screenshot:-
Q20. List out the names of all male participants.

SQL:-
select count("Participant_Name")
from "Participant"
where "Event_ID" in (
select "Event_ID"
from "Event"
where "Event_Price" between 150 and 500
);

Tupples:-
134

Screenshot:-
Q21. Find the count of participant who are participating in gaming event
type.

SQL :-
select count("Participant_Name")
from "Participant"
where "Event_ID" in (
select "Event_ID"
from "Event"
where "Event_Type_ID" in (
select "Event_Type_ID"
from "Event_Type"
where "Event_Type_Name" = 'Gaming'
)
)

Tupples:-
15
Q22. Find the count of the participants according to City Name.

SQL :-

select "City_Name", count("Participant_Name")


from "Event_Location", "Event", "Participant"
where "Event_Location"."Location_ID" = "Event"."Location_ID" and
"Event"."Event_ID" = "Participant"."Event_ID"
group by "City_Name"

Tupples:-
3

Q23. Find the average temperature of cities with city name.


SQL:-
select "City_Name", avg("Temparature")
from "Event_Location", "Weather"
where "Event_Location"."Location_ID" = "Weather"."Location_ID"
group by "City_Name"

Tupples:-
3

Q.24 List the location names where moisture value is greater than 50.

SQL:-

select "Location_Name"
from "Event_Location", "Weather"
where "Event_Location"."Location_ID" = "Weather"."Location_ID" and
"Moisture_Value" > 50
group by "Location_Name"

Tupples:-
33
Q25 Find the count of area names where pollution level is ‘medium’.

SQL:-

select count("Area_Name")
from "Event_Location", "Weather"
where "Event_Location"."Location_ID" = "Weather"."Location_ID" and
"Pollution_Level" = 'medium'

Tupples:-
15
Q26 List the location names where public parking space is greater than 70.

SQL:-
select "Location_Name"
from "Event_Location", "Parking"
where "Event_Location"."Location_ID" = "Parking"."Location_ID" and
"Public_Parking_Space">70

Tupples:-
17

Q27 Update the Rain Possibility to ‘Yes’ for locations where Moisture value is
between 30 and 55.

SQL:-

UPDATE "Event"
SET "Rain_Possibility"='YES'
from "Weather"
WHERE "Event"."Location_ID" IN (SELECT "Location_ID"
FROM "Weather"
where "Moisture_Value">= 30 and "Moisture_Value"<= 55);
Q28 List the locations names where event is starting on
‘2021-08-24 08:00:00’.
SQL:
select "Location_Name"
from "Event_Location"
join "Event"
on "Event_Location"."Location_ID" = "Event"."Location_ID"
where "Event"."Event_Start_Time" = '2021-08-24 08:00:00'
Tuple:
5
Screenshot:

Q29 Find the count of participants who are participating in


costliest event.
SQL:
select count("Participant_Name")
from "Participant", "Event"
where "Participant"."Event_ID" = "Event"."Event_ID" and
"Event"."Event_Price" in (
select max("Event_Price")
from "Event"
)
Tuple:
1
Screenshot:

Q30 List the area names where events starting on ‘2021-08-


26 10:00:00’ and ‘2021-08-27 12:00:00’.
SQL:
select "Area_Name"
from "Event_Location"
where "Location_ID" in (
select "Location_ID"
from "Event"
where "Event_Start_Time" = '2021-08-26 10:00:00' and
"Event_Start_Time" = '2021-08-27 12:00:00'
)
Tuple:
0
Screenshot:

You might also like