0
Talk guys, I’m having a little trouble finishing a college job and it would be really helpful if you guys would help me with a little VIEW.
Here are the fields of the parking table:
CREATE TABLE Seg.Estacionamento (
valor_hora decimal(4,2),
numero_vagas integer,
hora_saida datetime,
hora_entrada datetime,
vaga varchar(6)
)
This table records each entry in the parking lot.
The thing is, I’m doing a database project for a shopping mall and I need to make a report of busy parking spaces per day.
Would something like this
Quantidade de Vagas | Data
|
|
|
The Number of Vacancies field is the sum of all vacancies of the date in question and the Date has to be day-to-day. But I have no idea how to write this VIEW, what I’ve tried so far was something like this, but I know it’s completely wrong:
CREATE VIEW v_Vagas
AS
SELECT SUM(E.vaga) as "Quantidade de vagas ocupadas" FROM Estacionamento AS E
WHERE EXISTS(SELECT DAY(E.hora_entrada))
Please help me, it’s very important
Well, there are some things that remain open in your question. For example, a vacancy that has been filled and vacated 3 times during the day counts as 1 or 3?
– Sorack
The report would not be "of maximum number of vacancies occupied per day"? Or what you want to know is which vacancies were occupied each day? // What contains the column
vaga
?– José Diz