Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ Run the query on any data node for each retention policy and database.
Here, we use InfluxDB's [CLI](/enterprise_influxdb/v1/tools/influx-cli/use-influx/) to execute the query:

```
> ALTER RETENTION POLICY "<retention_policy_name>" ON "<database_name>" REPLICATION 3
>
ALTER RETENTION POLICY "<retention_policy_name>" ON "<database_name>" REPLICATION 3

```

A successful `ALTER RETENTION POLICY` query returns no results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ CREATE USER <username> WITH PASSWORD '<password>'

###### CLI example
```js
> CREATE USER todd WITH PASSWORD 'influxdb41yf3'
> CREATE USER alice WITH PASSWORD 'wonder\'land'
> CREATE USER "rachel_smith" WITH PASSWORD 'asdf1234!'
> CREATE USER "monitoring-robot" WITH PASSWORD 'XXXXX'
> CREATE USER "$savyadmin" WITH PASSWORD 'm3tr1cL0v3r'
CREATE USER todd WITH PASSWORD 'influxdb41yf3'
CREATE USER alice WITH PASSWORD 'wonder\'land'
CREATE USER "rachel_smith" WITH PASSWORD 'asdf1234!'
CREATE USER "monitoring-robot" WITH PASSWORD 'XXXXX'
CREATE USER "$savyadmin" WITH PASSWORD 'm3tr1cL0v3r'
```

{{% note %}}
Expand Down Expand Up @@ -169,13 +169,13 @@ CLI examples:
`GRANT` `READ` access to `todd` on the `NOAA_water_database` database:

```sql
> GRANT READ ON "NOAA_water_database" TO "todd"
GRANT READ ON "NOAA_water_database" TO "todd"
```

`GRANT` `ALL` access to `todd` on the `NOAA_water_database` database:

```sql
> GRANT ALL ON "NOAA_water_database" TO "todd"
GRANT ALL ON "NOAA_water_database" TO "todd"
```

##### `REVOKE` `READ`, `WRITE`, or `ALL` database privileges from an existing user
Expand All @@ -189,13 +189,13 @@ CLI examples:
`REVOKE` `ALL` privileges from `todd` on the `NOAA_water_database` database:

```sql
> REVOKE ALL ON "NOAA_water_database" FROM "todd"
REVOKE ALL ON "NOAA_water_database" FROM "todd"
```

`REVOKE` `WRITE` privileges from `todd` on the `NOAA_water_database` database:

```sql
> REVOKE WRITE ON "NOAA_water_database" FROM "todd"
REVOKE WRITE ON "NOAA_water_database" FROM "todd"
```

{{% note %}}
Expand Down Expand Up @@ -230,7 +230,7 @@ SET PASSWORD FOR <username> = '<password>'
CLI example:

```sql
> SET PASSWORD FOR "todd" = 'password4todd'
SET PASSWORD FOR "todd" = 'password4todd'
```

{{% note %}}
Expand All @@ -250,6 +250,6 @@ DROP USER <username>
CLI example:

```sql
> DROP USER "todd"
DROP USER "todd"
```

Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ For example, simple addition:
Assign an expression to a variable using the assignment operator, `=`.

```js
> s = "this is a string"
> i = 1 // an integer
> f = 2.0 // a floating point number
s = "this is a string"
i = 1 // an integer
f = 2.0 // a floating point number
```

Type the name of a variable to print its value:
Expand All @@ -48,7 +48,7 @@ this is a string
Flux also supports records. Each value in a record can be a different data type.

```js
> o = {name:"Jim", age: 42, "favorite color": "red"}
o = {name:"Jim", age: 42, "favorite color": "red"}
```

Use **dot notation** to access a properties of a record:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ the CQ has no `FOR` clause.
#### 1. Create the database

```sql
> CREATE DATABASE "food_data"
CREATE DATABASE "food_data"
```

#### 2. Create a two-hour `DEFAULT` retention policy
Expand All @@ -85,7 +85,7 @@ Use the
statement to create a `DEFAULT` RP:

```sql
> CREATE RETENTION POLICY "two_hours" ON "food_data" DURATION 2h REPLICATION 1 DEFAULT
CREATE RETENTION POLICY "two_hours" ON "food_data" DURATION 2h REPLICATION 1 DEFAULT
```

That query creates an RP called `two_hours` that exists in the database
Expand Down Expand Up @@ -116,7 +116,7 @@ Use the
statement to create a non-`DEFAULT` retention policy:

```sql
> CREATE RETENTION POLICY "a_year" ON "food_data" DURATION 52w REPLICATION 1
CREATE RETENTION POLICY "a_year" ON "food_data" DURATION 52w REPLICATION 1
```

That query creates a retention policy (RP) called `a_year` that exists in the database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,7 @@ DROP CONTINUOUS QUERY <cq_name> ON <database_name>
Drop the `idle_hands` CQ from the `telegraf` database:

```sql
> DROP CONTINUOUS QUERY "idle_hands" ON "telegraf"`
>
DROP CONTINUOUS QUERY "idle_hands" ON "telegraf"
```

### Altering continuous queries
Expand Down
25 changes: 12 additions & 13 deletions content/enterprise_influxdb/v1/query_language/explore-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ The following query returns no data because it specifies a single tag key (`loca
the `SELECT` clause:

```sql
> SELECT "location" FROM "h2o_feet"
>
SELECT "location" FROM "h2o_feet"
```

To return any data associated with the `location` tag key, the query's `SELECT`
Expand Down Expand Up @@ -597,7 +596,7 @@ separating logic with parentheses.
#### Select data that have specific timestamps

```sql
> SELECT * FROM "h2o_feet" WHERE time > now() - 7d
SELECT * FROM "h2o_feet" WHERE time > now() - 7d
```

The query returns data from the `h2o_feet` measurement that have [timestamps](/enterprise_influxdb/v1/concepts/glossary/#timestamp)
Expand Down Expand Up @@ -1592,8 +1591,8 @@ the query's time range.
Note that `fill(800)` has no effect on the query results.

```sql
> SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location" = 'coyote_creek' AND time >= '2015-09-18T22:00:00Z' AND time <= '2015-09-18T22:18:00Z' GROUP BY time(12m) fill(800)
>
SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location" = 'coyote_creek' AND time >= '2015-09-18T22:00:00Z' AND time <= '2015-09-18T22:18:00Z' GROUP BY time(12m) fill(800)

```

##### Queries with `fill(previous)` when the previous result falls outside the query's time range
Expand Down Expand Up @@ -2639,7 +2638,7 @@ The whitespace between `-` or `+` and the [duration literal](/enterprise_influxd
#### Specify a time range with relative time

```sql
> SELECT "water_level" FROM "h2o_feet" WHERE time > now() - 1h
SELECT "water_level" FROM "h2o_feet" WHERE time > now() - 1h
```

The query returns data with timestamps that occur within the past hour.
Expand Down Expand Up @@ -2686,7 +2685,7 @@ a `GROUP BY time()` clause must provide an alternative upper bound in the
Use the [CLI](/enterprise_influxdb/v1/tools/influx-cli/use-influx/) to write a point to the `NOAA_water_database` that occurs after `now()`:

```sql
> INSERT h2o_feet,location=santa_monica water_level=3.1 1587074400000000000
INSERT h2o_feet,location=santa_monica water_level=3.1 1587074400000000000
```

Run a `GROUP BY time()` query that covers data with timestamps between
Expand Down Expand Up @@ -2722,8 +2721,8 @@ the lower bound to `now()` such that the query's time range is between
`now()` and `now()`:

```sql
> SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location"='santa_monica' AND time >= now() GROUP BY time(12m) fill(none)
>
SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location"='santa_monica' AND time >= now() GROUP BY time(12m) fill(none)

```

### Configuring the returned timestamps
Expand Down Expand Up @@ -2831,8 +2830,8 @@ includes an `m` and `water_level` is greater than three.
#### Use a regular expression to specify a tag with no value in the WHERE clause

```sql
> SELECT * FROM "h2o_feet" WHERE "location" !~ /./
>
SELECT * FROM "h2o_feet" WHERE "location" !~ /./

```

The query selects all data from the `h2o_feet` measurement where the `location`
Expand Down Expand Up @@ -2989,8 +2988,8 @@ The query returns the integer form of `water_level`'s float [field values](/ente
#### Cast float field values to strings (this functionality is not supported)

```sql
> SELECT "water_level"::string FROM "h2o_feet" LIMIT 4
>
SELECT "water_level"::string FROM "h2o_feet" LIMIT 4

```

The query returns no data as casting a float field value to a string is not
Expand Down
58 changes: 29 additions & 29 deletions content/enterprise_influxdb/v1/query_language/manage-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ If you attempt to create a database that already exists, InfluxDB does nothing a
##### Create a database

```
> CREATE DATABASE "NOAA_water_database"
>
CREATE DATABASE "NOAA_water_database"

```

The query creates a database called `NOAA_water_database`.
Expand All @@ -97,8 +97,8 @@ The query creates a database called `NOAA_water_database`.
##### Create a database with a specific retention policy

```
> CREATE DATABASE "NOAA_water_database" WITH DURATION 3d REPLICATION 1 SHARD DURATION 1h NAME "liquid"
>
CREATE DATABASE "NOAA_water_database" WITH DURATION 3d REPLICATION 1 SHARD DURATION 1h NAME "liquid"

```

The query creates a database called `NOAA_water_database`.
Expand All @@ -114,8 +114,8 @@ DROP DATABASE <database_name>

Drop the database NOAA_water_database:
```bash
> DROP DATABASE "NOAA_water_database"
>
DROP DATABASE "NOAA_water_database"

```

A successful `DROP DATABASE` query returns an empty result.
Expand All @@ -135,19 +135,19 @@ DROP SERIES FROM <measurement_name[,measurement_name]> WHERE <tag_key>='<tag_val
Drop all series from a single measurement:

```sql
> DROP SERIES FROM "h2o_feet"
DROP SERIES FROM "h2o_feet"
```

Drop series with a specific tag pair from a single measurement:

```sql
> DROP SERIES FROM "h2o_feet" WHERE "location" = 'santa_monica'
DROP SERIES FROM "h2o_feet" WHERE "location" = 'santa_monica'
```

Drop all points in the series that have a specific tag pair from all measurements in the database:

```sql
> DROP SERIES WHERE "location" = 'santa_monica'
DROP SERIES WHERE "location" = 'santa_monica'
```

A successful `DROP SERIES` query returns an empty result.
Expand All @@ -168,25 +168,25 @@ DELETE FROM <measurement_name> WHERE [<tag_key>='<tag_value>'] | [<time interval
Delete all data associated with the measurement `h2o_feet`:

```sql
> DELETE FROM "h2o_feet"
DELETE FROM "h2o_feet"
```

Delete all data associated with the measurement `h2o_quality` and where the tag `randtag` equals `3`:

```sql
> DELETE FROM "h2o_quality" WHERE "randtag" = '3'
DELETE FROM "h2o_quality" WHERE "randtag" = '3'
```

Delete all data in the database that occur before January 01, 2020:

```sql
> DELETE WHERE time < '2020-01-01'
DELETE WHERE time < '2020-01-01'
```

Delete all data associated with the measurement `h2o_feet` in retention policy `one_day`:

```sql
> DELETE FROM "one_day"."h2o_feet"
DELETE FROM "one_day"."h2o_feet"
```

A successful `DELETE` query returns an empty result.
Expand Down Expand Up @@ -216,7 +216,7 @@ DROP MEASUREMENT <measurement_name>

Delete the measurement `h2o_feet`:
```sql
> DROP MEASUREMENT "h2o_feet"
DROP MEASUREMENT "h2o_feet"
```

> **Note:** `DROP MEASUREMENT` drops all data and series in the measurement.
Expand All @@ -238,9 +238,9 @@ DROP SHARD <shard_id_number>
```

Delete the shard with the id `1`:
```
> DROP SHARD 1
>
```sql
DROP SHARD 1

```

A successful `DROP SHARD` query returns an empty result.
Expand Down Expand Up @@ -345,18 +345,18 @@ This setting is optional.

##### Create a retention policy

```
> CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 1d REPLICATION 1
>
```sql
CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 1d REPLICATION 1

```
The query creates a retention policy called `one_day_only` for the database
`NOAA_water_database` with a one day duration and a replication factor of one.

##### Create a DEFAULT retention policy

```sql
> CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 23h60m REPLICATION 1 DEFAULT
>
CREATE RETENTION POLICY "one_day_only" ON "NOAA_water_database" DURATION 23h60m REPLICATION 1 DEFAULT

```

The query creates the same retention policy as the one in the example above, but
Expand All @@ -381,14 +381,14 @@ ALTER RETENTION POLICY <retention_policy_name> ON <database_name> [DURATION <dur

First, create the retention policy `what_is_time` with a `DURATION` of two days:
```sql
> CREATE RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 2d REPLICATION 1
>
CREATE RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 2d REPLICATION 1

```

Modify `what_is_time` to have a three week `DURATION`, a two hour shard group duration, and make it the `DEFAULT` retention policy for `NOAA_water_database`.
```sql
> ALTER RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 3w SHARD DURATION 2h DEFAULT
>
ALTER RETENTION POLICY "what_is_time" ON "NOAA_water_database" DURATION 3w SHARD DURATION 2h DEFAULT

```
In the last example, `what_is_time` retains its original replication factor of 1.

Expand All @@ -407,9 +407,9 @@ DROP RETENTION POLICY <retention_policy_name> ON <database_name>
```

Delete the retention policy `what_is_time` in the `NOAA_water_database` database:
```bash
> DROP RETENTION POLICY "what_is_time" ON "NOAA_water_database"
>
```sql
DROP RETENTION POLICY "what_is_time" ON "NOAA_water_database"

```

A successful `DROP RETENTION POLICY` query returns an empty result.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ digits, or underscores and do not begin with a digit.

Throughout the query language exploration, we'll use the database name `NOAA_water_database`:

```
> CREATE DATABASE NOAA_water_database
> exit
```sql
CREATE DATABASE NOAA_water_database
exit
```

### Download and write the data to InfluxDB
Expand Down
Loading
Loading