-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueries.txt
71 lines (55 loc) · 2.02 KB
/
queries.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
radio button for car and bikes
vehical = selected type.
_______________________________________________________________
Queries:
--x1-records of a vehical (time, date .. tuples) by reg-number
create or alter procedure record_Vehicle
@regno nvarchar(20)
as
Begin
select * from VOZILO_DB.dbo.VEHICLE as V,VOZILO_DB.dbo.FREQUENCY as F where (V.REGNO = F.REG_NO) and (V.REGNO = @regno);
end;
______________________________________________________________
--x2-most visited vehical in desc order
create procedure GetList
@TOV nvarchar (4)
AS
BEGIN
select Reg_no,count(reg_no) FROM Vozilo.dbo.frequency,Vozilo.dbo.Vehicle WHERE Vozilo.dbo.frequency.Exit_Time is NULL and Vozilo.dbo.frequency.REG_NO=Vozilo.dbo.VEHICLE.REGNO and Vozilo.dbo.VEHICLE.TOV=@TOV group by (reg_no) order by (reg_no) desc;
END;
exec Getlist 1;
____________________________________________________________________
--x3-cplc uncleared vehical
Create or Alter procedure C_Unclear
AS
BEGIN
select * from VOZILO_DB.dbo.CPLC_UNCLEAR;
END;
_______________________________________________________________________
--x4-present vehicals in parking lot
create procedure GetInVehicles
@TOV nvarchar(4)
AS
BEGIN
select * FROM Vozilo.dbo.frequency,Vozilo.dbo.VEHICLE WHERE Vozilo.dbo.frequency.REG_NO=Vozilo.dbo.VEHICLE.REGNO and
Vozilo.dbo.frequency.Exit_Time is NULL and Vozilo.dbo.VEHICLE.TOV=@TOV;
END;
EXEC GetInVehicles 1;
_______________________________________________________________________
--x5-records by date
create procedure GetDates
@date date,@TOV nvarchar(4)
as
BEGIN
SELECT * FROM Vozilo.dbo.frequency,Vozilo.dbo.VEHICLE WHERE Vozilo.dbo.frequency.REG_NO=Vozilo.dbo.VEHICLE.REGNO and
Vozilo.dbo.frequency.Current_Date_ = @date and Vozilo.dbo.VEHICLE.TOV=@TOV;
END;
exec GetDates @date='2018-12-04',@TOV=1;
______________________________________________________________________
--x6-AFR Vehicles
create procedure GetAFR
as
BEGIN
select * from Vozilo.dbo.AFR;
END;
exec GetAFR;