Custom SQL queries in Dashboard

There are not many examples on how we can write custom queries.

For instance how can I write a custom query to show only past 72 hrs data