Giter Site home page Giter Site logo

mgmweatherapp's Introduction

mgmweatherapp's People

Contributors

etuncercom avatar mertmtn avatar oividioscaeremos avatar

Watchers

 avatar

mgmweatherapp's Issues

Added view for Station Detail List

Görülen lüzum üzerinde il ilçe ve istasyon tablolarını joinleyerek bir view oluşturdum.

Adı vwGetStationListDTO

Sql scriptine erişebilirsiniz.

CREATE OR REPLACE VIEW public.vwgetstationlistdto AS SELECT s."Id", s."Name" AS "StationName", s."StationNo", s."CityDistrictId", s."ICAO", s."GoogleMapLink", fordistrict."PlaceId" AS "DistrictId", fordistrict."Name" AS "DistrictName", forcity."PlaceId" AS "CityId", forcity."Name" AS "CityName" FROM "Station" s, "CityDistricts" forcity, "CityDistricts" fordistrict WHERE s."CityDistrictId" = fordistrict."PlaceId" AND fordistrict."CityId" = forcity."PlaceId";

Trigger oluşturulması - Saat ve Nem değeri için

Stadyum Sıcaklık ölçümü için kullanılan bu tabloya insert/update yapılırsa;

SELECT "Id", "StadiumId", "MeasureDate", "Temperature", "Humidity", "ExpectedWeatherTypeId", "Hour" FROM public."StadiumMeasuring";

image

Hour alanına 8-24 değerleri dışında bir değer girilmemeli.
Humidity alanı 0-100 arasında olmalı, yüzdelik bir değerdir. Aralık dışında bir değer girilmemelidir.

Uygun uyarı mesajlarıyla 2 adet trigger çıkarıldı.

İlgili MGM sayfası: https://www.mgm.gov.tr/tahmin/stadyum.aspx

image

Veritabanı backup dosyası repositoryde mevcuttur.

1+1 adet fonksiyon

Aşağıdaki şekilde 1 fonksiyon yazdım, zaten en az 1 adet istenilmiş, alternatif olarak 1 tane daha yazdım.

  1. Seçilen stadyum'un ölçümlerini tablo olarak listeliyor. aşağıdaki şekilde kullanılır.
    SELECT * FROM stadyum_olcumleri(1); -- 1, seçilen stadyumun kimliği

CREATE OR REPLACE FUNCTION stadyum_olcumleri(stadium_id integer) RETURNS TABLE ( "Id" integer, "StadiumId" integer, "MeasureDate" date, "Temperature" double precision, "Humidity" double precision, "ExpectedWeatherTypeId" integer, "Hour" integer ) AS $$ BEGIN RETURN QUERY SELECT "Id", "StadiumId", "MeasureDate", "Temperature", "Humidity", "ExpectedWeatherTypeId", "Hour" FROM public."StadiumMeasuring" WHERE "StadiumId" = stadium_id; END; $$ LANGUAGE plpgsql;

  1. seçilen il ve ilçelerin hava durumu
    SELECT * FROM il_ilce_havadurumu(1, 1); -- 1, seçilen ilin kimliği; 1, seçilen ilçenin kimliği

CREATE OR REPLACE FUNCTION il_ilce_havadurumu(city_id integer, district_id integer) RETURNS TABLE ( "Id" integer, "Tarih" timestamp without time zone, "IstasyonId" integer, "ParametreId" integer, "Deger" double precision ) AS $$ BEGIN RETURN QUERY SELECT "Id", "Tarih", "IstasyonId", "ParametreId", "Deger" FROM public.olcumler JOIN public.istasyonlar ON public.olcumler."IstasyonId" = public.istasyonlar."Id" WHERE public.istasyonlar."SehirId" = city_id AND public.istasyonlar."IlceId" = district_id; END; $$ LANGUAGE plpgsql;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.