Weather Forecast Log Management System
Weather Forecast Log Management System
Project Report
on
Weather Forecast Log Management System
Developed by
Jaimish Trivedi - Department of IT, DDUniversity
Himanshu Vaghela -Department of IT, DDUniversity
Guided By
Internal Guide:
Prof. Roshni M. Raval
Department of Information Technology
Faculty of Technology
DD University
I. Certificate .................................................................................................................. I
7. BIBLIOGRAPHY .................................................................................................. 20
DHARMSINH DESAI UNIVERSITY
NADIAD-387001, GUJARAT
CERTIFICATE
This is to certify that the project entitled “Weather Forecast Log Management
System” is a bonafied report of the work carried out by
1) Mr. Jaimish Trivedi, Student ID No: 17ITUOS082
2) Mr. Himanshu Vaghela, Student ID No: 16ITUSS148
of Department of Information Technology, semester V, under the guidance and
supervision for the subject Database Management System. They were involved in
Project training during academic year 2019-2020.
i
ACKNOWLEDGEMENT
This Project being the first undertaken by us and it was unforgettable and educative
experience.We take this oppurtunity to thank all those who have generously helped
us to give a proper shape to our project.
ii
Weather Forecast Log Management System System Overview
1. SYSTEM OVERVIEW
2. E-R DIAGRAM
2.1 Entities
Users
City
Country
HourlyForecastLog
DailyForecastLog
Server
WeatherStation
Employee
2.2 Relationships
selects
partof
containshourly
containsdaily
getshourly
getsdaily
getsfrom
holds
workson
worksfor
have
3. DATA DICTIONARY
ion
Number
WeatherStationId 5 VARCHAR2 F.K., Not Weather W100
null Station ID
no.
ManagerId 5 VARCHAR2 F.K., Not Manager M100
null ID no.
EMPLOYEE EmpContact1 10 NUMBER P.K., Not Employee 123456789
EMPCONTA null contact 0
CT no.1
Number
4. SCHEMA DIAGRAM
5.DATABASE IMPLEMENTION
5.1 CREATE SCHEMA
BEGIN.
Insert into Country(CountryId,CountryName)
Values ('CY1','India');
Insert into Country(CountryId,CountryName)
Values ('CY2','China');
Insert into Country(CountryId,CountryName)
Values ('CY3','Thailand');
Insert into Country(CountryId,CountryName)
Values ('CY4','Singapore');
Insert into Country(CountryId,CountryName)
Values ('CY5','Germany');
Insert into Country(CountryId,CountryName)
Values ('CY6','USA');
Insert into Country(CountryId,CountryName)
Values ('CY7','Canada');
Insert into Country(CountryId,CountryName)
Values ('CY8','UK');
END
BEGIN
Insert into Satellite(SatelliteId,SatelliteName)
Values('S1','Aryabhatta');
Insert into Satellite(SatelliteId,SatelliteName)
Values('S2','Bhaskara1');
Insert into Satellite(SatelliteId,SatelliteName)
Values('S3','Bhaskara2');
Insert into Satellite(SatelliteId,SatelliteName)
Values('S4','IRS1A');
Insert into Satellite(SatelliteId,SatelliteName)
Values('S5','INSAT1C')
END
BEGIN
Insert into WeatherStation
Values('WS1','Ahmedabad');
Insert into WeatherStation
Values('WS2','Rajkot');
Insert into WeatherStation
Values('WS3','Bhavnagar');
Insert into WeatherStation
Values('WS4','Porbandar');
Insert into WeatherStation
Values('WS5','Surat');
BEGIN
Insert into Usersucontact(Usersid,UContact)
Values('U1',7623927428);
Insert into Usersucontact(Usersid,UContact)
Values('U2',7227008511);
Insert into Usersucontact(Usersid,UContact)
Values('U3',9284675963);
Insert into Usersucontact(Usersid,UContact)
Values('U4',7849135933);
Insert into Usersucontact(Usersid,UContact)
Values('U5',8645436943);
Insert into Usersucontact(Usersid,UContact)
Values('U6',9876541232);
END
BEGIN
Insert into City(CityName,CityLongitude,CityLatitude,CityPincode,CountryId)
Values('Ahmedabad',85.43,57.76,380027,'CY1');
Insert into City(CityName,CityLongitude,CityLatitude,CityPincode,CountryId)
Values('Nadiad',156.23,57.36,380078,'CY1');
Insert into City(CityName,CityLongitude,CityLatitude,CityPincode,CountryId)
Values('Rajkot',128.23,58.36,380045,'CY1');
Insert into City(CityName,CityLongitude,CityLatitude,CityPincode,CountryId)
Values('Surat',138.23,51.36,380745,'CY1');
Insert into City(CityName,CityLongitude,CityLatitude,CityPincode,CountryId)
Values('Bhavnagar',198.23,23.46,380063,'CY1');
Insert into City(CityName,CityLongitude,CityLatitude,CityPincode,CountryId)
Values('Mumbai',185.23,90.26,380041,'CY1');
Insert into City(CityName,CityLongitude,CityLatitude,CityPincode,CountryId)
Values('Hyderabad',170.23,35.86,380086,'CY1');
END
BEGIN
Insert into Server(ServerId,ServerLocation,SatelliteId,WeatherStationId)
Values('SE3','BhavnagariArea','S3','WS3');
Insert into Server(ServerId,ServerLocation,SatelliteId,WeatherStationId)
Values('SE2','RajkotRotary','S2','WS2');
Insert into Server(ServerId,ServerLocation,SatelliteId,WeatherStationId)
Values('SE1','RTOCIRCLE','S1','WS1');
END
BEGIN
Insert into Selects
Values('U1',380027);
Insert into Selects
Values('U1',380078);
Insert into Selects
Values('U1',380041);
Insert into Selects
Values('U2',380027);
Insert into Selects
Values('U3',380063);
Insert into Selects
Values('U4',380063);
Insert into Selects
Values('U5',380027);
Insert into Selects
Values('U6',380027);
END
BEGIN
INSERT INTO
HourlyForecastLog(StartDateTime,Humidity,Visibility,Pressure,WindSpeed,WindDir
ection,Temperature,FeelsLikeTemperature,WeatherStatus,CityPincode,ServerId)
VALUES(timestamp '2019-08-01
06:14:00.74',10,'High',10,10,'NE',10,8,'Sunny',380027,'SE1');
INSERT INTO
HourlyForecastLog(StartDateTime,Humidity,Visibility,Pressure,WindSpeed,WindDir
ection,Temperature,FeelsLikeTemperature,WeatherStatus,CityPincode,ServerId)
VALUES(timestamp '2019-08-01
07:14:00',7,'High',7,7,'NE',7,7,'Sunny',380027,'SE1');
INSERT INTO
HourlyForecastLog(StartDateTime,Humidity,Visibility,Pressure,WindSpeed,WindDir
ection,Temperature,FeelsLikeTemperature,WeatherStatus,CityPincode,ServerId)
VALUES(timestamp '2019-08-01
05:14:00.74',10,'High',5,5,'NE',5,5,'Sunny',380027,'SE1');
INSERT INTO
HourlyForecastLog(StartDateTime,Humidity,Visibility,Pressure,WindSpeed,WindDir
ection,Temperature,FeelsLikeTemperature,WeatherStatus,CityPincode,ServerId)
VALUES(timestamp '2019-08-01
04:14:00.74',4,'High',4,4,'NE',4,4,'Sunny',380027,'SE1');
INSERT INTO
HourlyForecastLog(StartDateTime,Humidity,Visibility,Pressure,WindSpeed,WindDir
ection,Temperature,FeelsLikeTemperature,WeatherStatus,CityPincode,ServerId)
VALUES(timestamp '2019-08-01
03:14:00.74',10,'High',3,3,'NE',3,3,'Sunny',380027,'SE1');
INSERT INTO
HourlyForecastLog(StartDateTime,Humidity,Visibility,Pressure,WindSpeed,WindDir
ection,Temperature,FeelsLikeTemperature,WeatherStatus,CityPincode,ServerId)
VALUES(timestamp '2019-08-01
02:14:00.74',10,'High',2,2,'NE',2,2,'Sunny',380027,'SE1');
INSERT INTO
HourlyForecastLog(StartDateTime,Humidity,Visibility,Pressure,WindSpeed,WindDir
ection,Temperature,FeelsLikeTemperature,WeatherStatus,CityPincode,ServerId)
VALUES(timestamp '2019-08-01
01:14:00.74',1,'High',1,1,'NE',1,1,'Sunny',380027,'SE1');
INSERT INTO
HourlyForecastLog(StartDateTime,Humidity,Visibility,Pressure,WindSpeed,WindDir
ection,Temperature,FeelsLikeTemperature,WeatherStatus,CityPincode,ServerId)
VALUES(timestamp '2019-08-01
00:14:00.74',10,'High',0,0,'NE',0,0,'Sunny',380027,'SE1');
END
BEGIN
insert into
DailyForecastLog(CalendarDate,ServerId,Weatherstatus,CityPincode,SunriseTime,Su
nsetTime,AverageHumidity,MinTemperature,MaxTemperature)
values(to_date ('27/AUGUST/2019'),'SE1','Sunny',380027, timestamp '2019-08-27
06:00:08.74', timestamp '2019-08-27 19:14:00.74',27,20,30);
insert into DailyForecastLog(CalendarDate,ServerId,Weatherstatus,CityPincode)
values(to_date ('28/AUGUST/2019'),'SE1','Rainy',380027, timestamp '2019-08-28
06:00:08.74', timestamp '2019-08-28 19:15:00.74',28,20,30);
insert into DailyForecastLog(CalendarDate,ServerId,Weatherstatus,CityPincode)
values(to_date ('29/AUGUST/2019'),'SE1','Cloudy',380027, timestamp '2019-08-29
06:00:08.74', timestamp '2019-08-29 19:16:00.74',29,20,30);
insert into DailyForecastLog(CalendarDate,ServerId,Weatherstatus,CityPincode)
values(to_date ('30/AUGUST/2019'),'SE1','Sunny',380027, timestamp '2019-08-30
06:00:08.74', timestamp '2019-08-30 19:17:00.74',30,20,30);
insert into DailyForecastLog(CalendarDate,ServerId,Weatherstatus,CityPincode)
values(to_date ('31/AUGUST/2019'),'SE1','Sunny',380027, timestamp '2019-08-31
06:00:08.74', timestamp '2019-08-31 19:18:00.74',31,20,30);
END
BEGIN
Insert into
Employee(EmployeeId,EmpFirstName,EmpLastName,Designation,EmpDOB,ServerI
d,WeatherStationId,ManagerId)
values(
'E1','King','Puri','CEO','25/AUGUST/1997','SE1','WS1',NULL);
Insert into
Employee(EmployeeId,EmpFirstName,EmpLastName,Designation,EmpDOB,ServerI
d,WeatherStationId,ManagerId)
values(
'E2','Suresh','Puri','HRManager','05/AUGUST/1997','SE1','WS1','E1');
Insert into
Employee(EmployeeId,EmpFirstName,EmpLastName,Designation,EmpDOB,ServerI
d,WeatherStationId,ManagerId)
values(
'E3','Mahesh','Puri','Electrician','25/MAY/1997','SE1','WS1','E2');
Insert into
Employee(EmployeeId,EmpFirstName,EmpLastName,Designation,EmpDOB,ServerI
d,WeatherStationId,ManagerId)
values(
'E4','Jayesh','Puri','Programmer','15/JULY/1997','SE1','WS1','E2');
END
BEGIN
Insert into EmployeeEmpContact(EmployeeId,EmpContact1)
Values('E1',456123890);
Insert into EmployeeEmpContact(EmployeeId,EmpContact1)
Values('E2',326123890);
Insert into EmployeeEmpContact(EmployeeId,EmpContact1)
Values('E3',126123890);
Insert into EmployeeEmpContact(EmployeeId,EmpContact1)
Values('E4',456743890);
END
BEGIN
Insert into getshourly(ServerId,StartDateTime,CityPincode)
BEGIN
Insert into getsdaily(ServerId,CalendarDate,CityPincode)
Values('SE1','27-AUG-19 ',380027);
Insert into getsdaily(ServerId,CalendarDate,CityPincode)
Values('SE1','28-AUG-19 ',380027);
Insert into getsdaily(ServerId,CalendarDate,CityPincode)
Values('SE1','29-AUG-19 ',380027);
Insert into getsdaily(ServerId,CalendarDate,CityPincode)
Values('SE1','30-AUG-19 ',380027);
Insert into getsdaily(ServerId,CalendarDate,CityPincode)
Values('SE1','31-AUG-19 ',380027);
END
BEGIN
Insert into getsfrom(ServerId,SatelliteId)
Values('SE1','S1');
Insert into getsfrom(ServerId,SatelliteId)
Values('SE2','S1');
Insert into getsfrom(ServerId,SatelliteId)
Values('SE3','S2');
END
Select d.calendardate,c.cityname,d.mintemperature,d.maxtemperature
From City c full outer join DailyForecastLog d on c.CityPincode = d.CityPincode
Where d.CityPincode= 380027 and d.calendardate='29-aug-19';
2.Display Weather Status of a City having pincode '380027' on the date '27-aug-19':
Select d.calendardate,c.cityname,d.weatherstatus
From City c full outer join DailyForecastLog d on c.CityPincode = d.CityPincode
Where d.CityPincode= 380027 and d.calendardate='27-aug-19';
Select se.serverid,sa.satelliteid,sa.satellitename
From Server se right outer join getsfrom g on se.Serverid=g.serverid
right outer join satellite sa on g.satelliteid=sa.satelliteid
where se.serverid='SE1';
select s.weatherstationid,count(s.serverid)
from server s full outer join weatherstation w
on s.weatherstationid=w.weatherstationid
group by (s.weatherstationid) ;
5.Windspeed of a city having pincode '380027' on the 3rd hour of the day:
Select se.serverid,sa.satelliteid,sa.satellitename
From Server se right outer join getsfrom g on se.Serverid=g.serverid
right outer join satellite sa on g.satelliteid=sa.satelliteid
where sa.satelliteid='S1';
7.Sunrise time and sunset time of the cities having latitude greater than 57:
select c.cityname,c.citylatitude,d.sunrisetime,d.sunsettime
from city c full outer join dailyforecastlog d
on c.citypincode=d.citypincode
where c.citylatitude
in
(select citylatitude from city
where citylatitude > 57.00
);
select empfirstname,employeeid,managerid
from employee
where managerid is not null;
1.Print the appropriate message if user tries to search for the details of a city whose
DECLARE
cpin city.citypincode%type;
clong city.citylongitude%type;
clat city.citylatitude%type;
BEGIN
cname,cpin,clong,clat
FROM city
WHERE city.cityname=cname;
DBMS_OUTPUT.PUT_LINE('City: '||cname );
DBMS_OUTPUT.PUT_LINE('Pincode: '||cpin );
DBMS_OUTPUT.PUT_LINE('Longitude: '||clong );
DBMS_OUTPUT.PUT_LINE('Latitude: '||clat );
EXCEPTION
cname);
END
OUTPUT 1:
OUTPUT 2:
BEGIN
UPDATE Server
IF SQL%FOUND THEN
Station');
END IF;
IF SQL%NOTFOUND THEN
END IF;
END
OUTPUT 1:
OUTPUT 2:
3.Keep a record table for cities whose temperature is greater than 50 degrees, to put
cname VARCHAR2(10),
cpin NUMBER(6),
maxt NUMBER(5,2),
cdate DATE
);
DECLARE
CURSOR Red_alert
IS
SELECT c.cityname,c.citypincode,d.maxtemperature,d.calendardate
ON c.citypincode=d.citypincode
WHERE d.maxtemperature>50;
BEGIN
FOR I IN Red_alert
LOOP
I.maxtemperature,I.calendardate);
END LOOP;
COMMIT;
END
4.Keep a record of users,who have searched for a particular city(here city having
u_id varchar2(5),
u_con number(10),
u_mail varchar2(30)
);
DECLARE
CURSOR send_update
IS
SELECT u.Usersid,uc.Ucontact1,u.Usersemail,s.citypincode
WHERE s.citypincode=380027;
BEGIN
FOR I IN send_update
LOOP
I.usersemail);
END LOOP;
COMMIT;
END
5.If any daily weather record of some city is deleted or updated,store its old value in
some table.(Trigger)
);
DECLARE
BEGIN
DBMS_OUTPUT.PUT_LINE('TRIGGER FIRED');
:OLD.AverageHumidity, :OLD.MaxTemperature,:OLD.MinTemperature,
:OLD.WeatherStatus,:OLD.CityPincode);
END;
->UPDATE dailyforecastlog
SET maxtemperature=20
WHERE averagehumidity=30;
6.If a user search for a temperature info of a particular city then display temperature in
RETURN NUMBER
IS
TF Number;
BEGIN
TF:=(9*(Temp/5)+32);
return TF;
END;
RETURN NUMBER
IS
TK Number;
BEGIN
TK:=(Temp+273);
return TK;
END;
DECLARE
CURSOR display_t
IS
SELECT citypincode,temperature,startdatetime
FROM hourlyforecastlog
WHERE citypincode=cpincode;
tempf hourlyforecastlog.temperature%type;
tempk hourlyforecastlog.temperature%type;
BEGIN
FOR I IN display_t
LOOP
tempf:=Temp_Format_F(I.temperature);
tempk:=Temp_Format_K(I.temperature);
DBMS_OUTPUT.PUT_LINE(' ');
END LOOP;
END;
7. Create A procedure that will take an input as server ID and weather station ID and
wstation IN server.weatherstationid%type)
IS
CURSOR emp_details
IS
SELECT
e.EmployeeId,e.EmpFirstName,e.EmpLastName,e.Designation,e.weatherstationid,e.s
erverid
BEGIN
FOR I IN emp_details
LOOP
IF I.serverid=serv THEN
IF I.weatherstationid=wstation THEN
DBMS_OUTPUT.PUT_LINE('Employee id:
'||I.EmployeeId);
DBMS_OUTPUT.PUT_LINE('Employee
Name:'||I.EmpFirstName||' '||I.EmpLastName);
DBMS_OUTPUT.PUT_LINE('Designation:
'||I.Designation);
END IF;
END IF;
END LOOP;
END;
DECLARE
sid server.serverid%type;
wsid server.weatherstationid%type;
BEGIN
sid:=:Server_Id;
wsid:=:Weather_station_Id;
get_details(sid,wsid);
END;
8.Create a table for weather station ID WS1 containing the serverID of the servers at
that station,if any new server is added or removed it will trigger an event that will tell
serid VARCHAR2(5),
serloc VARCHAR2(10)
);
DECLARE
CURSOR add_serv
IS
weatherstationid='WS1';
BEGIN
FOR I IN add_serv
LOOP
VALUES(I.serverid,I.serverlocation);
END LOOP;
END;
server
DECLARE
BEGIN
IF :new.weatherstationid='WS1' THEN
IF INSERTING THEN
DBMS_OUTPUT.PUT_LINE('TRIGGER FIRED');
VALUES(:new.serverid,:new.serverlocation);
END IF;
END IF;
IF :old.weatherstationid='WS1' THEN
IF DELETING THEN
DBMS_OUTPUT.PUT_LINE('TRIGGER FIRED');
WHERE serid=:old.serverid;
END IF;
END IF;
END;
VALUES('ABC','SE4','WS1');
WHERE serverid='SE4';