Personally, I'm having a little problem finishing a college job and would be of great help if you helped me with a small 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.
This is the following, I'm doing a database project for a mall and I need to report a busy spot a day in the shopping center parking lot.
I would get something like this
Quantidade de Vagas | Data
|
|
|
The number of vacancies field is the sum of all vacancies for 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 has been 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