Code Monkey home page Code Monkey logo

Comments (5)

simonw avatar simonw commented on June 18, 2024

Find all instances of the lowest-tide-of-the-day that are in daylight hours.

from rockybeaches.

simonw avatar simonw commented on June 18, 2024
with lowest_tide_per_day as (
  select
    station_id,
    date(datetime) as date,
    time(datetime) as lowest_tide_time,
    min(mllw_feet) as lowest_tide
  from
    tide_predictions
  where
    station_id = 9414131
  group by
    date(datetime)
)
select
  lowest_tide_per_day.*,
  sunrise_sunset.*
from
  lowest_tide_per_day
  join sunrise_sunset on sunrise_sunset.place = 'pillar-point'
  and sunrise_sunset.day = lowest_tide_per_day.date
where
  lowest_tide_per_day.lowest_tide_time > sunrise_sunset.sunrise
  and lowest_tide_per_day.lowest_tide_time < sunrise_sunset.sunset
  and date >= date('now')
order by
  date

https://www.rockybeaches.com/data?sql=with+lowest_tide_per_day+as+%28%0D%0A++select%0D%0A++++station_id%2C%0D%0A++++date%28datetime%29+as+date%2C%0D%0A++++time%28datetime%29+as+lowest_tide_time%2C%0D%0A++++min%28mllw_feet%29+as+lowest_tide%0D%0A++from%0D%0A++++tide_predictions%0D%0A++where%0D%0A++++station_id+%3D+9414131%0D%0A++group+by%0D%0A++++date%28datetime%29%0D%0A%29%0D%0Aselect%0D%0A++lowest_tide_per_day.*%2C%0D%0A++sunrise_sunset.*%0D%0Afrom%0D%0A++lowest_tide_per_day%0D%0A++join+sunrise_sunset+on+sunrise_sunset.place+%3D+%27pillar-point%27%0D%0A++and+sunrise_sunset.day+%3D+lowest_tide_per_day.date%0D%0Awhere%0D%0A++lowest_tide_per_day.lowest_tide_time+%3E+sunrise_sunset.sunrise%0D%0A++and+lowest_tide_per_day.lowest_tide_time+%3C+sunrise_sunset.sunset%0D%0A++and+date+%3E%3D+date%28%27now%27%29%0D%0Aorder+by%0D%0A++date

from rockybeaches.

simonw avatar simonw commented on June 18, 2024

Here's what this first version looks like:

Rocky_Beaches__Pillar_Point_Harbor_CA

from rockybeaches.

natbat avatar natbat commented on June 18, 2024

Done but needs some styling

from rockybeaches.

natbat avatar natbat commented on June 18, 2024

styling done

from rockybeaches.

Related Issues (20)

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.