解决此问题需要什么sql查询?

t98cgbkg  于 2021-08-13  发布在  Java
关注(0)|答案(2)|浏览(249)

what sql query needed to solve this question“you have a table with the columns‘reservation\u id’、‘check-in-date’和‘check-out-date’列。编写一个sql查询,为您提供平均停留时间。”

t3psigkw

t3psigkw1#

对于postgres,您可以使用以下选项:

select avg(check_out_date - check_in_date)
from the_table;
wmomyfyw

wmomyfyw2#

你可以使用下面的脚本。如果我明白的话。
从中选择avg(datediff(day,checkin,checkout))

相关问题