added db functions for window functionality

`return cursor.fetchall()`