--- title: Manage your database using InfluxQL description: > Use InfluxQL to administer your InfluxDB server and work with InfluxDB databases, retention policies, series, measurements, and shards. menu: enterprise_influxdb_v1: name: Manage your database weight: 40 parent: InfluxQL aliases: - /enterprise_influxdb/v1/query_language/database_management/ --- InfluxQL offers a full suite of administrative commands.
Data Management: Retention Policy Management:
CREATE DATABASE CREATE RETENTION POLICY
DROP DATABASE ALTER RETENTION POLICY
DROP SERIES DROP RETENTION POLICY
DELETE
DROP MEASUREMENT
DROP SHARD
If you're looking for `SHOW` queries (for example, `SHOW DATABASES` or `SHOW RETENTION POLICIES`), see [Schema Exploration](/enterprise_influxdb/v1/query_language/explore-schema). The examples in the sections below use the InfluxDB [Command Line Interface (CLI)](/enterprise_influxdb/v1/introduction/getting-started/). You can also execute the commands using the InfluxDB API; simply send a `GET` request to the `/query` endpoint and include the command in the URL parameter `q`. For more on using the InfluxDB API, see [Querying data](/enterprise_influxdb/v1/guides/querying_data/). > **Note:** When authentication is enabled, only admin users can execute most of the commands listed on this page. > See the documentation on [authentication and authorization](/enterprise_influxdb/v1/administration/authentication_and_authorization/) for more information. ## Data management ### CREATE DATABASE Creates a new database. #### Syntax ```sql CREATE DATABASE [WITH [DURATION ] [REPLICATION ] [SHARD DURATION ] [NAME ]] ``` #### Description of syntax `CREATE DATABASE` requires a database [name](/enterprise_influxdb/v1/troubleshooting/frequently-asked-questions/#what-words-and-characters-should-i-avoid-when-writing-data-to-influxdb). The `WITH`, `DURATION`, `REPLICATION`, `SHARD DURATION`, and `NAME` clauses are optional and create a single [retention policy](/enterprise_influxdb/v1/concepts/glossary/#retention-policy-rp) associated with the created database. If you do not specify one of the clauses after `WITH`, the relevant behavior defaults to the `autogen` retention policy settings. The created retention policy automatically serves as the database's default retention policy. For more information about those clauses, see [Retention Policy Management](/enterprise_influxdb/v1/query_language/manage-database/#retention-policy-management). A successful `CREATE DATABASE` query returns an empty result. If you attempt to create a database that already exists, InfluxDB does nothing and does not return an error. #### Examples ##### Create a database ``` > CREATE DATABASE "NOAA_water_database" > ``` The query creates a database called `NOAA_water_database`. [By default](/enterprise_influxdb/v1/administration/configure/config-data-nodes/#retention-autocreate), InfluxDB also creates the `autogen` retention policy and associates it with the `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" > ``` The query creates a database called `NOAA_water_database`. It also creates a default retention policy for `NOAA_water_database` with a `DURATION` of three days, a [replication factor](/enterprise_influxdb/v1/concepts/glossary/#replication-factor) of one, a [shard group](/enterprise_influxdb/v1/concepts/glossary/#shard-group) duration of one hour, and with the name `liquid`. ### Delete a database with DROP DATABASE The `DROP DATABASE` query deletes all of the data, measurements, series, continuous queries, and retention policies from the specified database. The query takes the following form: ```sql DROP DATABASE ``` Drop the database NOAA_water_database: ```bash > DROP DATABASE "NOAA_water_database" > ``` A successful `DROP DATABASE` query returns an empty result. If you attempt to drop a database that does not exist, InfluxDB does not return an error. ### Drop series from the index with DROP SERIES The `DROP SERIES` query deletes all points from a [series](/enterprise_influxdb/v1/concepts/glossary/#series) in a database, and it drops the series from the index. The query takes the following form, where you must specify either the `FROM` clause or the `WHERE` clause: ```sql DROP SERIES FROM WHERE ='' ``` Drop all series from a single measurement: ```sql > 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 all points in the series that have a specific tag pair from all measurements in the database: ```sql > DROP SERIES WHERE "location" = 'santa_monica' ``` A successful `DROP SERIES` query returns an empty result. ### Delete series with DELETE The `DELETE` query deletes all points from a [series](/enterprise_influxdb/v1/concepts/glossary/#series) in a database. Unlike [`DROP SERIES`](/enterprise_influxdb/v1/query_language/manage-database/#drop-series-from-the-index-with-drop-series), `DELETE` does not drop the series from the index. You must include either the `FROM` clause, the `WHERE` clause, or both: ``` DELETE FROM WHERE [=''] | [