You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51-39
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,38 @@
1
1
# mysql_generate_series: generate_series for MySQL
2
2
3
-
mysql_generate_series is a MySQL version of PostgreSQL's [generate_series](http://www.postgresql.org/docs/9.4/static/functions-srf.html) functions.
3
+
mysql_generate_series is a MySQL version of PostgreSQL's [generate_series](http://www.postgresql.org/docs/current/static/functions-srf.html) functions.
4
4
5
-
This version is (heavily) adapted from the original by Gabriel Bordeaux and seeks to simplify the method call and make the MySQL version parameters follow the PostgreSQL version insofar as that is possible.
5
+
This version is (heavily) adapted from the original and seeks to simplify the method call and make the MySQL version parameters follow the PostgreSQL version insofar as that is possible.
6
6
7
-
It offers a single method taking 3 parameters:
8
-
* generate_series(start, stop, step): and delivers a series from "start" to "stop" incrementing by "step".
7
+
It offers a single method `generate_series(start, stop, step)` to deliver a series from `start` to `stop` incrementing by `step`.
9
8
10
9
Calling the method generates no output but instead creates a temporary table called `series_tmp` in the current database which can be used in joins and sub-queries in the current session.
11
10
12
-
All parameters are INTEGER or strings which are representative of INTEGER, DATE, DATETIME and INTERVAL depending on the type of series being generated
11
+
All parameters are `INTEGER` or strings which are representative of `INTEGER`, `DATE`, `DATETIME` and `INTERVAL` depending on the type of series being generated
13
12
14
-
### INTEGER Series
15
-
For integer ranges the three parameters are all INTEGER or string representations of numbers ("strumbers" if you prefer)
13
+
## Installation
16
14
17
-
either
15
+
Install the methods from [sql/generate_series.sql](sql/generate_series.sql).
18
16
19
-
* CALL generate_series(1, 20, 1);
20
-
or
21
-
* CALL generate_series('1', '20', '1');
17
+
## INTEGER Series
18
+
19
+
For integer ranges the three parameters are all INTEGER or string representations of numbers.
20
+
21
+
### Usage
22
+
23
+
```sql
24
+
CALL generate_series(1, 20, 1);
25
+
```
22
26
23
27
Will create and populate `series_tmp` with INTEGER values from 1 to 20, incrementing by 1.
*The temporary table used to store results `series_tmp` is dropped and recreated on each call to generate_series(). As a temporary table, `series_tmp` will only be available within the current session and to the current user. It will also automatically dropped when the connection is closed.
275
+
The temporary table used to store results `series_tmp` is dropped and recreated on each call to generate_series(). As a temporary table, `series_tmp` will only be available within the current session and to the current user. It will also automatically dropped when the connection is closed.
0 commit comments