From the course: Advanced SQL for Data Scientists

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Generating time series data

Generating time series data

From the course: Advanced SQL for Data Scientists

Start my 1-month free trial

Generating time series data

- [Instructor] Now I'm starting off from where I left off in the previous video. And here we have a select statement that uses generate series to create some timestamps for us. Now, what I'd like to do at this point is actually use this and another generate series to generate a series of sensor IDs, and then a set of timestamps. But what I want is I want each sensor ID to have all of the timestamps. So let's see how we can do that. So first of all I'm going to be turning this select statement into a subquery. And just to make it a little less spread out I'll just do a little bit of formatting here, okay. Now I also want to be able to generate the sensor ID. So I'm going to put in a select star from generate series and let's go from one to 100 and this is going to be a subquery. So I'm going to say, let's call that as T1 and here this will be a sub query as well. And that'll be as T2. So by saying a subquery I mean a…

Contents