TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A Cool SQL Problem (and Why It Is Also a Bullshit SQL Problem)

3 点作者 mjirv将近 6 年前

1 comment

chupa-chups将近 6 年前
<p><pre><code> with allTimes as ( with startTimes as ( select distinct start_time from meetings ), endTimes as ( select distinct end_time from meetings ) select start_time as pointInTime from startTimes union select end_time as pointInTime from endTimes ) select tt.pointInTime, count(*) from meetings mm inner join allTimes tt on ( mm.start_time &lt;= tt.pointInTime and mm.end_time &gt; tt.pointInTime) group by tt.pointInTime order by tt.pointInTime </code></pre> (no idea if this is totally correct, just hacked together in a few minutes (postgresql))