<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Event series joins</title>
    <link>/en/data-analysis/queries/joins/event-series-joins/</link>
    <description>Recent content in Event series joins on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/data-analysis/queries/joins/event-series-joins/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Data-Analysis: Sample schema for event series joins examples</title>
      <link>/en/data-analysis/queries/joins/event-series-joins/sample-schema-event-series-joins-examples/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/data-analysis/queries/joins/event-series-joins/sample-schema-event-series-joins-examples/</guid>
      <description>
        
        
        &lt;p&gt;If you don&#39;t plan to run the queries and just want to look at the examples, you can skip this topic and move straight to &lt;a href=&#34;../../../../../en/data-analysis/queries/joins/event-series-joins/writing-event-series-joins/#&#34;&gt;Writing event series joins&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;schema-of-hticks-and-aticks-tables&#34;&gt;Schema of hTicks and aTicks tables&lt;/h2&gt;
&lt;p&gt;The examples that follow use the following hTicks and aTicks tables schemas:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;














&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE hTicks (
   stock VARCHAR(20),
   time TIME,
   price NUMERIC(8,2)
);
CREATE TABLE aTicks (
   stock VARCHAR(20),
   time TIME,
   price NUMERIC(8,2)
);
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Although TIMESTAMP is more commonly used for the event series column, the examples in this topic use TIME to keep the output simple.

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;













&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;INSERT INTO hTicks VALUES (&amp;#39;HPQ&amp;#39;, &amp;#39;12:00&amp;#39;, 50.00);
INSERT INTO hTicks VALUES (&amp;#39;HPQ&amp;#39;, &amp;#39;12:01&amp;#39;, 51.00);
INSERT INTO hTicks VALUES (&amp;#39;HPQ&amp;#39;, &amp;#39;12:05&amp;#39;, 51.00);
INSERT INTO hTicks VALUES (&amp;#39;HPQ&amp;#39;, &amp;#39;12:06&amp;#39;, 52.00);
INSERT INTO aTicks VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:00&amp;#39;, 340.00);
INSERT INTO aTicks VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:03&amp;#39;, 340.10);
INSERT INTO aTicks VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:05&amp;#39;, 340.20);
INSERT INTO aTicks VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:05&amp;#39;, 333.80);
COMMIT;
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Output of the two tables:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
hTicks&lt;/th&gt; 

&lt;td &gt;
&lt;/td&gt; 

&lt;th &gt;
aTicks&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;















&lt;p&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There are no entry records between 12:02–12:04:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; stock |   time   | price
-------+----------+-------
 HPQ   | 12:00:00 | 50.00
 HPQ   | 12:01:00 | 51.00
 HPQ   | 12:05:00 | 51.00
 HPQ   | 12:06:00 | 52.00
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;/td&gt; 

&lt;td &gt;















&lt;p&gt;&lt;code&gt;=&amp;gt; SELECT * FROM aTicks;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There are no entry records at 12:01, 12:02 and at 12:04:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; stock |   time   | price
-------+----------+--------
 ACME  | 12:00:00 | 340.00
 ACME  | 12:03:00 | 340.10
 ACME  | 12:05:00 | 340.20
 ACME  | 12:05:00 | 333.80
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h2 id=&#34;example-query-showing-gaps&#34;&gt;Example query showing gaps&lt;/h2&gt;
&lt;p&gt;A full outer join shows the gaps in the timestamps:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks h FULL OUTER JOIN aTicks a ON h.time = a.time;
 stock |   time   | price | stock |   time   | price
-------+----------+-------+-------+----------+--------
 HPQ   | 12:00:00 | 50.00 | ACME  | 12:00:00 | 340.00
 HPQ   | 12:01:00 | 51.00 |       |          |
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 333.80
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 340.20
 HPQ   | 12:06:00 | 52.00 |       |          |
       |          |       | ACME  | 12:03:00 | 340.10
(6 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;schema-of-bid-and-asks-tables&#34;&gt;Schema of bid and asks tables&lt;/h2&gt;
&lt;p&gt;The examples that follow use the following hTicks and aTicks tables.

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;td &gt;















&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE TABLE bid(stock VARCHAR(20), time TIME, price NUMERIC(8,2));
CREATE TABLE ask(stock VARCHAR(20), time TIME, price NUMERIC(8,2));
INSERT INTO bid VALUES (&amp;#39;HPQ&amp;#39;, &amp;#39;12:00&amp;#39;, 100.10);
INSERT INTO bid VALUES (&amp;#39;HPQ&amp;#39;, &amp;#39;12:01&amp;#39;, 100.00);
INSERT INTO bid VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:00&amp;#39;, 80.00);
INSERT INTO bid VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:03&amp;#39;, 79.80);
INSERT INTO bid VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:05&amp;#39;, 79.90);
INSERT INTO ask VALUES (&amp;#39;HPQ&amp;#39;, &amp;#39;12:01&amp;#39;, 101.00);
INSERT INTO ask VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:00&amp;#39;, 80.00);
INSERT INTO ask VALUES (&amp;#39;ACME&amp;#39;, &amp;#39;12:02&amp;#39;, 75.00);
COMMIT;
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Output of the two tables:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
bid&lt;/th&gt; 

&lt;td &gt;
&lt;/td&gt; 

&lt;th &gt;
ask&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
















&lt;p&gt;&lt;code&gt;=&amp;gt; SELECT * FROM bid;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There are no entry records for stocks HPQ and ACME at 12:02 and at 12:04:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; stock |   time   | price
-------+----------+--------
 HPQ   | 12:00:00 | 100.10
 HPQ   | 12:01:00 | 100.00
 ACME  | 12:00:00 |  80.00
 ACME  | 12:03:00 |  79.80
 ACME  | 12:05:00 |  79.90
(5 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;/td&gt; 

&lt;td &gt;














&lt;p&gt;&lt;code&gt;=&amp;gt; SELECT * FROM ask;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There are no entry records for stock HPQ at 12:00 and none for ACMEat 12:01:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; stock |   time   | price
-------+----------+--------
 HPQ   | 12:01:00 | 101.00
 ACME  | 12:00:00 |  80.00
 ACME  | 12:02:00 |  75.00
(3 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h2 id=&#34;example-query-showing-gaps-1&#34;&gt;Example query showing gaps&lt;/h2&gt;
&lt;p&gt;A full outer join shows the gaps in the timestamps:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM bid b FULL OUTER JOIN ask a ON b.time = a.time;
 stock |   time   | price  | stock |   time   | price
-------+----------+--------+-------+----------+--------
 HPQ   | 12:00:00 | 100.10 | ACME  | 12:00:00 |  80.00
 HPQ   | 12:01:00 | 100.00 | HPQ   | 12:01:00 | 101.00
 ACME  | 12:00:00 |  80.00 | ACME  | 12:00:00 |  80.00
 ACME  | 12:03:00 |  79.80 |       |          |
 ACME  | 12:05:00 |  79.90 |       |          |
       |          |        | ACME  | 12:02:00 |  75.00
(6 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Data-Analysis: Writing event series joins</title>
      <link>/en/data-analysis/queries/joins/event-series-joins/writing-event-series-joins/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/data-analysis/queries/joins/event-series-joins/writing-event-series-joins/</guid>
      <description>
        
        
        &lt;p&gt;The examples in this topic contains mismatches between timestamps—just as you&#39;d find in real life situations; for example, there could be a period of inactivity on stocks where no trade occurs, which can present challenges when you want to compare two stocks whose timestamps don&#39;t match.&lt;/p&gt;
&lt;h2 id=&#34;the-hticks-and-aticks-tables&#34;&gt;The hTicks and aTicks tables&lt;/h2&gt;
&lt;p&gt;As described in the &lt;a href=&#34;../../../../../en/data-analysis/queries/joins/event-series-joins/sample-schema-event-series-joins-examples/&#34;&gt;example ticks schema&lt;/a&gt;, tables, &lt;code&gt;hTicks&lt;/code&gt; is missing input rows for 12:02, 12:03, and 12:04, and &lt;code&gt;aTicks&lt;/code&gt; is missing inputs at 12:01, 12:02, and 12:04.

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
hTicks&lt;/th&gt; 

&lt;td &gt;
&lt;/td&gt; 

&lt;th &gt;
aTicks&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;












&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks;
 stock |   time   | price
-------+----------+-------
 HPQ   | 12:00:00 | 50.00
 HPQ   | 12:01:00 | 51.00
 HPQ   | 12:05:00 | 51.00
 HPQ   | 12:06:00 | 52.00
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt; 

&lt;td &gt;
&lt;/td&gt; 

&lt;td &gt;












&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM aTicks;
 stock |   time   | price
-------+----------+--------
 ACME  | 12:00:00 | 340.00
 ACME  | 12:03:00 | 340.10
 ACME  | 12:05:00 | 340.20
 ACME  | 12:05:00 | 333.80
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h2 id=&#34;querying-event-series-data-with-full-outer-joins&#34;&gt;Querying event series data with full outer joins&lt;/h2&gt;
&lt;p&gt;Using a traditional full outer join, this query finds a match between tables hTicks and aTicks at 12:00 and 12:05 and pads the missing data points with NULL values.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks h FULL OUTER JOIN aTicks a ON (h.time = a.time);
 stock |   time   | price | stock |   time   | price
-------+----------+-------+-------+----------+--------
 HPQ   | 12:00:00 | 50.00 | ACME  | 12:00:00 | 340.00
 HPQ   | 12:01:00 | 51.00 |       |          |
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 333.80
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 340.20
 HPQ   | 12:06:00 | 52.00 |       |          |
       |          |       | ACME  | 12:03:00 | 340.10
(6 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To replace the gaps with interpolated values for those missing data points, use the &lt;a href=&#34;../../../../../en/sql-reference/language-elements/predicates/interpolate/#&#34;&gt;INTERPOLATE&lt;/a&gt; predicate to create an &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/event-series/&#34; title=&#34;Tables with a time column, most typically a timestamp data type.&#34;&gt;event series&lt;/a&gt; join. The join condition is restricted to the ON clause, which evaluates the equality predicate on the timestamp columns from the two input tables. In other words, for each row in outer table hTicks, the ON clause predicates are evaluated for each combination of each row in the inner table aTicks.&lt;/p&gt;
&lt;p&gt;Simply rewrite the full outer join query to use the INTERPOLATE predicate with either the required PREVIOUS VALUE or NEXT VALUE keywords. Note that a full outer join on event series data is the most common scenario for event series data, where you keep all rows from both tables.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks h FULL OUTER JOIN aTicks a
   ON (h.time &lt;span class=&#34;code-input&#34;&gt;INTERPOLATE PREVIOUS VALUE&lt;/span&gt; a.time);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The database interpolates the missing values (which appear as NULL in the full outer join) using that table&#39;s previous or next value, whichever is specified. This example shows INTERPOLATE PREVIOUS. Notice how in the second row, blank cells have been filled using values interpolated from the previous row:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks h FULL OUTER JOIN aTicks a ON (h.time = a.time);
 stock |   time   | price | stock |   time   | price
-------+----------+-------+-------+----------+--------
 HPQ   | 12:00:00 | 50.00 | ACME  | 12:00:00 | 340.00
 HPQ   | 12:01:00 | 51.00 | ACME  | 12:00:00 | 340.00
 HPQ   | 12:01:00 | 51.00 | ACME  | 12:03:00 | 340.10
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 333.80
 HPQ   | 12:05:00 | 52.00 | ACME  | 12:05:00 | 340.20
 HPQ   | 12:06:00 | 52.00 | ACME  | 12:05:00 | 340.20
 (6 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

The output ordering above is different from the regular full outer join because in the event series join, interpolation occurs independently for each stock (hTicks and aTicks), where the data is partitioned and sorted based on the equality predicate. This means that interpolation occurs within, not across, partitions.

&lt;/div&gt;
&lt;p&gt;If you review the regular full outer join output, you can see that both tables have a match in the time column at 12:00 and 12:05, but at 12:01, there is no entry record for ACME. So the operation interpolates a value for ACME (&lt;code&gt;ACME,12:00,340&lt;/code&gt;) based on the previous value in the aTicks table.&lt;/p&gt;
&lt;h2 id=&#34;querying-event-series-data-with-left-outer-joins&#34;&gt;Querying event series data with left outer joins&lt;/h2&gt;
&lt;p&gt;You can also use left and right outer joins. You might, for example, decide you want to preserve only hTicks values. So you&#39;d write a left outer join:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks h &lt;span class=&#34;code-input&#34;&gt;LEFT OUTER JOIN&lt;/span&gt; aTicks a
   ON (h.time INTERPOLATE PREVIOUS VALUE a.time);
 stock |   time   | price | stock |   time   | price
-------+----------+-------+-------+----------+--------
 HPQ   | 12:00:00 | 50.00 | ACME  | 12:00:00 | 340.00
 HPQ   | 12:01:00 | 51.00 | &lt;span class=&#34;code-input&#34;&gt;ACME&lt;/span&gt;  | &lt;span class=&#34;code-input&#34;&gt;12:00:00&lt;/span&gt; | &lt;span class=&#34;code-input&#34;&gt;340.00&lt;/span&gt;
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 333.80
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 340.20
 HPQ   | 12:06:00 | 52.00 | &lt;span class=&#34;code-input&#34;&gt;ACME&lt;/span&gt;  | &lt;span class=&#34;code-input&#34;&gt;12:05:00&lt;/span&gt; | &lt;span class=&#34;code-input&#34;&gt;340.20&lt;/span&gt;
(5 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here&#39;s what the same data looks like using a traditional left outer join:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks h LEFT OUTER JOIN aTicks a ON h.time = a.time;
 stock |   time   | price | stock |   time   | price
-------+----------+-------+-------+----------+--------
 HPQ   | 12:00:00 | 50.00 | ACME  | 12:00:00 | 340.00
 HPQ   | 12:01:00 | 51.00 |       |          |
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 333.80
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 340.20
 HPQ   | 12:06:00 | 52.00 |       |          |
(5 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note that a right outer join has the same behavior with the preserved table reversed.&lt;/p&gt;
&lt;h2 id=&#34;querying-event-series-data-with-inner-joins&#34;&gt;Querying event series data with inner joins&lt;/h2&gt;
&lt;p&gt;Note that INNER event series joins behave the same way as normal ANSI SQL-99 joins, where all gaps are omitted. Thus, there is nothing to interpolate, and the following two queries are equivalent and return the same result set:&lt;/p&gt;
&lt;p&gt;A regular inner join:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM HTicks h JOIN aTicks a
    ON (h.time &lt;span class=&#34;code-input&#34;&gt;INTERPOLATE PREVIOUS VALUE&lt;/span&gt; a.time);
 stock |   time   | price | stock |   time   | price
-------+----------+-------+-------+----------+--------
 HPQ   | 12:00:00 | 50.00 | ACME  | 12:00:00 | 340.00
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 333.80
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 340.20
(3 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;An event series inner join:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM hTicks h &lt;span class=&#34;code-input&#34;&gt;INNER JOIN&lt;/span&gt; aTicks a ON (h.time = a.time);
 stock |   time   | price | stock |   time   | price
-------+----------+-------+-------+----------+--------
 HPQ   | 12:00:00 | 50.00 | ACME  | 12:00:00 | 340.00
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 333.80
 HPQ   | 12:05:00 | 51.00 | ACME  | 12:05:00 | 340.20
(3 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;the-bid-and-ask-tables&#34;&gt;The bid and ask tables&lt;/h2&gt;
&lt;p&gt;Using the &lt;a href=&#34;../../../../../en/data-analysis/queries/joins/event-series-joins/sample-schema-event-series-joins-examples/&#34;&gt;example schema&lt;/a&gt; for the &lt;code&gt;bid&lt;/code&gt; and &lt;code&gt;ask&lt;/code&gt; tables, write a full outer join to interpolate the missing data points:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM bid b &lt;span class=&#34;code-input&#34;&gt;FULL OUTER JOIN&lt;/span&gt; ask a
    ON (b.stock = a.stock AND b.time &lt;span class=&#34;code-input&#34;&gt;INTERPOLATE PREVIOUS VALUE&lt;/span&gt; a.time);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the below output, the first row for stock HPQ shows nulls because there is no entry record for HPQ before 12:01.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; stock |   time   | price  | stock |   time   | price
-------+----------+--------+-------+----------+--------
 ACME  | 12:00:00 |  80.00 | ACME  | 12:00:00 |  80.00
 ACME  | 12:00:00 |  80.00 | &lt;span class=&#34;code-input&#34;&gt;ACME&lt;/span&gt;  |&lt;span class=&#34;code-input&#34;&gt; 12:02:00&lt;/span&gt; |  &lt;span class=&#34;code-input&#34;&gt;75.00&lt;/span&gt;
 ACME  | 12:03:00 |  79.80 | &lt;span class=&#34;code-input&#34;&gt;ACME&lt;/span&gt;  |&lt;span class=&#34;code-input&#34;&gt; 12:02:00&lt;/span&gt; |  &lt;span class=&#34;code-input&#34;&gt;75.00&lt;/span&gt;
 ACME  | 12:05:00 |  79.90 | &lt;span class=&#34;code-input&#34;&gt;ACME&lt;/span&gt;  |&lt;span class=&#34;code-input&#34;&gt; 12:02:00&lt;/span&gt; |  &lt;span class=&#34;code-input&#34;&gt;75.00&lt;/span&gt;
 HPQ   | 12:00:00 | 100.10 |       |          |
 HPQ   | 12:01:00 | 100.00 | HPQ   | 12:01:00 | 101.00
(6 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note also that the same row (&lt;code&gt;ACME,12:02,75&lt;/code&gt;) from the &lt;code&gt;ask&lt;/code&gt; table appears three times. The first appearance is because no matching rows are present in the &lt;code&gt;bid&lt;/code&gt; table for the row in &lt;code&gt;ask&lt;/code&gt;, so the database interpolates the missing value using the ACME value at 12:02 (75.00). The second appearance occurs because the row in &lt;code&gt;bid&lt;/code&gt; (&lt;code&gt;ACME,12:05,79.9&lt;/code&gt;) has no matches in &lt;code&gt;ask&lt;/code&gt;. The row from &lt;code&gt;ask&lt;/code&gt; that contains (&lt;code&gt;ACME,12:02,75&lt;/code&gt;) is the closest row; thus, it is used to interpolate the values.&lt;/p&gt;
&lt;p&gt;If you write a regular full outer join, you can see where the mismatched timestamps occur:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM bid b FULL OUTER JOIN ask a ON (b.time = a.time);
 stock |   time   | price  | stock |   time   | price
-------+----------+--------+-------+----------+--------
 ACME  | 12:00:00 |  80.00 | ACME  | 12:00:00 |  80.00
 ACME  | 12:03:00 |  79.80 |       |          |
 ACME  | 12:05:00 |  79.90 |       |          |
 HPQ   | 12:00:00 | 100.10 | ACME  | 12:00:00 |  80.00
 HPQ   | 12:01:00 | 100.00 | HPQ   | 12:01:00 | 101.00
       |          |        | ACME  | 12:02:00 |  75.00
(6 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
  </channel>
</rss>
