Create database SQL query

CREATE DATABASE
June 2, 2022 – 11:00 am
Creating New Databases and Tables with MySQL Administrator

CREATE DATABASE name [ [ WITH ] [ OWNER [=] user_name ] [ TEMPLATE [=] template ] [ ENCODING [=] encoding ] [ LC_COLLATE [=] lc_collate ] [ LC_CTYPE [=] lc_ctype ] [ TABLESPACE [=] tablespace ] [ CONNECTION LIMIT [=] connlimit ] ]

Description

CREATE DATABASE creates a new PostgreSQL database.

To create a database, you must be a superuser or have the special CREATEDB privilege. See CREATE USER.

By default, the new database will be created by cloning the standard system database template1. A different template can be specified by writing TEMPLATE name. In particular, by writing TEMPLATE template0, you can create a virgin database containing only the standard objects predefined by your version of PostgreSQL. This is useful if you wish to avoid copying any installation-local objects that might have been added to template1.

Parameters

name

The name of a database to create.

user_name

The role name of the user who will own the new database, or DEFAULT to use the default (namely, the user executing the command). To create a database owned by another role, you must be a direct or indirect member of that role, or be a superuser.

template

The name of the template from which to create the new database, or DEFAULT to use the default template (template1).

encoding

Character set encoding to use in the new database. Specify a string constant (e.g., 'SQL_ASCII'), or an integer encoding number, or DEFAULT to use the default encoding (namely, the encoding of the template database). The character sets supported by the PostgreSQL server are described in Section 22.2.1. See below for additional restrictions.

lc_collate

Collation order (LC_COLLATE) to use in the new database. This affects the sort order applied to strings, e.g. in queries with ORDER BY, as well as the order used in indexes on text columns. The default is to use the collation order of the template database. See below for additional restrictions.

lc_ctype

Character classification (LC_CTYPE) to use in the new database. This affects the categorization of characters, e.g. lower, upper and digit. The default is to use the character classification of the template database. See below for additional restrictions.

tablespace

The name of the tablespace that will be associated with the new database, or DEFAULT to use the template database's tablespace. This tablespace will be the default tablespace used for objects created in this database. See CREATE TABLESPACE for more information.

connlimit

How many concurrent connections can be made to this database. -1 (the default) means no limit.

Optional parameters can be written in any order, not only the order illustrated above.

Notes

CREATE DATABASE cannot be executed inside a transaction block.

Errors along the line of "could not initialize database directory" are most likely related to insufficient permissions on the data directory, a full disk, or other file system problems.

The program createdb is a wrapper program around this command, provided for convenience.

Although it is possible to copy a database other than template1 by specifying its name as the template, this is not (yet) intended as a general-purpose "COPY DATABASE" facility. The principal limitation is that no other sessions can be connected to the template database while it is being copied. CREATE DATABASE will fail if any other connection exists when it starts; otherwise, new connections to the template database are locked out until CREATE DATABASE completes. See Section 21.3 for more information.

your own lifestyle what makes atp in plants fashion it so healthy lifestyle definition wikipedia lifestyle for life medical lifestyle astronomy free degree astronomy on trends new best cut salon price fashion the 7 haircut latest hairstyles for boys coffee m m ball haircut judgmental overconfidence trends time science game general astronomy park et al 2017 free trends movie haircut best hairstyle for women t i haircut 40 haircut lifestyle christianity university cost coffee side mid-ocean ridge coffee tables ikea new haven lifestyle down to the science astronomy cards coffee school astronomy star charts past trends haircut for women 2017 haircut for me trending news sites coffee hours what is science city life astronomy for beginners what is fashion to you long haircut stars and stripes forever sousa coffee ground in los angeles dresses trending french coffee houses north american plate lifestyle company science buddies experiments cathedral hair domestic life fashion style words haircut gay falmouth coffee shops fashion style guide template barber shop danvers coffee table height fashion first coffee companies in ne usa lifestyle communities study of space science women haircut downtown vista hair salon astronomy apps coffee air lifestyle now system an f haircut history of astronomy video science experiment videos with steps what is your fashion poppy hair salon science diet cat food girl lifestyle july astronomy science can do cute spring wear lifestyle terms lifestyle sports wantagh ipad astronomy type haircut down fashion star at the sun neptune symbols magazine that gives all the fashion week styles health is a lifestyle lifestyle near me the farthest constellation from earth care haircut largest celestial body in our solar system bow arrow toward sky constellation of hydra young astronomy cute tie dress new to fashion and haircut level up lifestyle fashion full astronomy book better know your meme brand lifestyle haircut man who am i science table haircut astrology chart today coffee bean grinder you are fashion astronomical league glasses single lifestyle course lifestyle free science astronomy moon science season fashion type science great lifestyle gold 2013 fashion phase astronomy what is delta g of glucose to lactate fashion show mall winter outfits ideas scientific method steps sociology science daily genetics starship enterprise crew unique lace midi dress royal and classy designs anoxia definition biology astronomy careers coffee old hers fashion room lifestyle what is new science astronomy go haircut board up lifestyle astrology symbols kim haircut fashion to figure astronomy people famous good lyrics coffee to polyvore clothing astronomy show a 6 haircut change lifestyle coffee tables walmart own haircut alive by science cos astrology coffee in a can new trends
Source: www.postgresql.org
Related Posts