1
Can someone give me some guidance in this consultation? How to find out how many possible shows watched?
For viewers of the day "24/07/2020" who passed the turnstile before the opening time of the show, list the ticket number, the time of entry, the name of the viewer and number of possible shows watched (considering only the entrance time).
SELECT i.numero, i.horaentrada, p.nome
FROM pessoa P
INNER JOIN espectador E ON e.cpfpessoa = p.cpf
INNER JOIN ingresso I ON e.cpfpessoa = i.cpfespectador
INNER JOIN show S ON s.datalineup = i.datalineupentrada
WHERE i.pertencedatalineup = '24/07/2020' and i.horaentrada < s.horainicio;
Tables
Person {Cpf, name}
Spectator {cpfpessoa, code}
Ticket {number, value, outgoing date, incoming time, incoming time, belonging to datalineup}
Lineup {datalineup}
Show {local name, schedule, datalineup}
Band {name, ordemapresentation, nomelocalshow, datalineupshow, scheduleshow}
Exit
HOURLY NUMBER NAME
3 21:00 Corina Brandan
3 21:00 Corina Brandan
8 22:00 Cristovao Aranha
I need you to show the amount of shows watched based on the time of entry.
From what you posted there is no field
pertencedatalineup
on the tableingresso
. Perhaps if you informed an example of the result obtained and the desired result someone could guide you. I believe the aggregation functioncount
together with the clauseGROUP BY
can help you.– anonimo
What is the difference between columns
pertencedatalineup
anddatalineupentrada
?– José Diz
Add what contains each column of the tables, especially those that will be used in the sql code.
– José Diz
really, 'belossedatalineup' and 'datalineupentrate' are the same
– StreetSpirit