githubEdit

I. SQL 指令

本部分包含 PostgreSQL 支援的 SQL 指令的參考訊息。一般而言,「SQL」是指語言;內容包含了有關各標準的一致性和相容性。

連結將會連結至 PostgreSQL 官方使用手冊,本手冊連結請使用左側目錄。

Table of Contents

ABORTarrow-up-right — abort the current transaction

ALTER AGGREGATEarrow-up-right — change the definition of an aggregate function

ALTER COLLATIONarrow-up-right — change the definition of a collation

ALTER CONVERSIONarrow-up-right — change the definition of a conversion

ALTER DATABASEarrow-up-right — change a database

ALTER DEFAULT PRIVILEGESarrow-up-right — define default access privileges

ALTER DOMAINarrow-up-right — change the definition of a domain

ALTER EVENT TRIGGERarrow-up-right — change the definition of an event trigger

ALTER EXTENSIONarrow-up-right — change the definition of an extension

ALTER FOREIGN DATA WRAPPERarrow-up-right — change the definition of a foreign-data wrapper

ALTER FOREIGN TABLEarrow-up-right — change the definition of a foreign table

ALTER FUNCTIONarrow-up-right — change the definition of a function

ALTER GROUParrow-up-right — change role name or membership

ALTER INDEXarrow-up-right — change the definition of an index

ALTER LANGUAGEarrow-up-right — change the definition of a procedural language

ALTER LARGE OBJECTarrow-up-right — change the definition of a large object

ALTER MATERIALIZED VIEWarrow-up-right — change the definition of a materialized view

ALTER OPERATORarrow-up-right — change the definition of an operator

ALTER OPERATOR CLASSarrow-up-right — change the definition of an operator class

ALTER OPERATOR FAMILYarrow-up-right — change the definition of an operator family

ALTER POLICYarrow-up-right — change the definition of a row-level security policy

ALTER PROCEDUREarrow-up-right — change the definition of a procedure

ALTER PUBLICATIONarrow-up-right — change the definition of a publication

ALTER ROLEarrow-up-right — change a database role

ALTER ROUTINEarrow-up-right — change the definition of a routine

ALTER RULEarrow-up-right — change the definition of a rule

ALTER SCHEMAarrow-up-right — change the definition of a schema

ALTER SEQUENCEarrow-up-right — change the definition of a sequence generator

ALTER SERVERarrow-up-right — change the definition of a foreign server

ALTER STATISTICSarrow-up-right — change the definition of an extended statistics object

ALTER SUBSCRIPTIONarrow-up-right — change the definition of a subscription

ALTER SYSTEMarrow-up-right — change a server configuration parameter

ALTER TABLEarrow-up-right — change the definition of a table

ALTER TABLESPACEarrow-up-right — change the definition of a tablespace

ALTER TEXT SEARCH CONFIGURATIONarrow-up-right — change the definition of a text search configuration

ALTER TEXT SEARCH DICTIONARYarrow-up-right — change the definition of a text search dictionary

ALTER TEXT SEARCH PARSERarrow-up-right — change the definition of a text search parser

ALTER TEXT SEARCH TEMPLATEarrow-up-right — change the definition of a text search template

ALTER TRIGGERarrow-up-right — change the definition of a trigger

ALTER TYPEarrow-up-right — change the definition of a type

ALTER USERarrow-up-right — change a database role

ALTER USER MAPPINGarrow-up-right — change the definition of a user mapping

ALTER VIEWarrow-up-right — change the definition of a view

ANALYZEarrow-up-right — collect statistics about a database

BEGINarrow-up-right — start a transaction block

CALLarrow-up-right — invoke a procedure

CHECKPOINTarrow-up-right — force a write-ahead log checkpoint

CLOSEarrow-up-right — close a cursor

CLUSTERarrow-up-right — cluster a table according to an index

COMMENTarrow-up-right — define or change the comment of an object

COMMITarrow-up-right — commit the current transaction

COMMIT PREPAREDarrow-up-right — commit a transaction that was earlier prepared for two-phase commit

COPYarrow-up-right — copy data between a file and a table

CREATE ACCESS METHODarrow-up-right — define a new access method

CREATE AGGREGATEarrow-up-right — define a new aggregate function

CREATE CASTarrow-up-right — define a new cast

CREATE COLLATIONarrow-up-right — define a new collation

CREATE CONVERSIONarrow-up-right — define a new encoding conversion

CREATE DATABASEarrow-up-right — create a new database

CREATE DOMAINarrow-up-right — define a new domain

CREATE EVENT TRIGGERarrow-up-right — define a new event trigger

CREATE EXTENSIONarrow-up-right — install an extension

CREATE FOREIGN DATA WRAPPERarrow-up-right — define a new foreign-data wrapper

CREATE FOREIGN TABLEarrow-up-right — define a new foreign table

CREATE FUNCTIONarrow-up-right — define a new function

CREATE GROUParrow-up-right — define a new database role

CREATE INDEXarrow-up-right — define a new index

CREATE LANGUAGEarrow-up-right — define a new procedural language

CREATE MATERIALIZED VIEWarrow-up-right — define a new materialized view

CREATE OPERATORarrow-up-right — define a new operator

CREATE OPERATOR CLASSarrow-up-right — define a new operator class

CREATE OPERATOR FAMILYarrow-up-right — define a new operator family

CREATE POLICYarrow-up-right — define a new row-level security policy for a table

CREATE PROCEDUREarrow-up-right — define a new procedure

CREATE PUBLICATIONarrow-up-right — define a new publication

CREATE ROLEarrow-up-right — define a new database role

CREATE RULEarrow-up-right — define a new rewrite rule

CREATE SCHEMAarrow-up-right — define a new schema

CREATE SEQUENCEarrow-up-right — define a new sequence generator

CREATE SERVERarrow-up-right — define a new foreign server

CREATE STATISTICSarrow-up-right — define extended statistics

CREATE SUBSCRIPTIONarrow-up-right — define a new subscription

CREATE TABLEarrow-up-right — define a new table

CREATE TABLE ASarrow-up-right — define a new table from the results of a query

CREATE TABLESPACEarrow-up-right — define a new tablespace

CREATE TEXT SEARCH CONFIGURATIONarrow-up-right — define a new text search configuration

CREATE TEXT SEARCH DICTIONARYarrow-up-right — define a new text search dictionary

CREATE TEXT SEARCH PARSERarrow-up-right — define a new text search parser

CREATE TEXT SEARCH TEMPLATEarrow-up-right — define a new text search template

CREATE TRANSFORMarrow-up-right — define a new transform

CREATE TRIGGERarrow-up-right — define a new trigger

CREATE TYPEarrow-up-right — define a new data type

CREATE USERarrow-up-right — define a new database role

CREATE USER MAPPINGarrow-up-right — define a new mapping of a user to a foreign server

CREATE VIEWarrow-up-right — define a new view

DEALLOCATEarrow-up-right — deallocate a prepared statement

DECLAREarrow-up-right — define a cursor

DELETEarrow-up-right — delete rows of a table

DISCARDarrow-up-right — discard session state

DOarrow-up-right — execute an anonymous code block

DROP ACCESS METHODarrow-up-right — remove an access method

DROP AGGREGATEarrow-up-right — remove an aggregate function

DROP CASTarrow-up-right — remove a cast

DROP COLLATIONarrow-up-right — remove a collation

DROP CONVERSIONarrow-up-right — remove a conversion

DROP DATABASEarrow-up-right — remove a database

DROP DOMAINarrow-up-right — remove a domain

DROP EVENT TRIGGERarrow-up-right — remove an event trigger

DROP EXTENSIONarrow-up-right — remove an extension

DROP FOREIGN DATA WRAPPERarrow-up-right — remove a foreign-data wrapper

DROP FOREIGN TABLEarrow-up-right — remove a foreign table

DROP FUNCTIONarrow-up-right — remove a function

DROP GROUParrow-up-right — remove a database role

DROP INDEXarrow-up-right — remove an index

DROP LANGUAGEarrow-up-right — remove a procedural language

DROP MATERIALIZED VIEWarrow-up-right — remove a materialized view

DROP OPERATORarrow-up-right — remove an operator

DROP OPERATOR CLASSarrow-up-right — remove an operator class

DROP OPERATOR FAMILYarrow-up-right — remove an operator family

DROP OWNEDarrow-up-right — remove database objects owned by a database role

DROP POLICYarrow-up-right — remove a row-level security policy from a table

DROP PROCEDUREarrow-up-right — remove a procedure

DROP PUBLICATIONarrow-up-right — remove a publication

DROP ROLEarrow-up-right — remove a database role

DROP ROUTINEarrow-up-right — remove a routine

DROP RULEarrow-up-right — remove a rewrite rule

DROP SCHEMAarrow-up-right — remove a schema

DROP SEQUENCEarrow-up-right — remove a sequence

DROP SERVERarrow-up-right — remove a foreign server descriptor

DROP STATISTICSarrow-up-right — remove extended statistics

DROP SUBSCRIPTIONarrow-up-right — remove a subscription

DROP TABLEarrow-up-right — remove a table

DROP TABLESPACEarrow-up-right — remove a tablespace

DROP TEXT SEARCH CONFIGURATIONarrow-up-right — remove a text search configuration

DROP TEXT SEARCH DICTIONARYarrow-up-right — remove a text search dictionary

DROP TEXT SEARCH PARSERarrow-up-right — remove a text search parser

DROP TEXT SEARCH TEMPLATEarrow-up-right — remove a text search template

DROP TRANSFORMarrow-up-right — remove a transform

DROP TRIGGERarrow-up-right — remove a trigger

DROP TYPEarrow-up-right — remove a data type

DROP USERarrow-up-right — remove a database role

DROP USER MAPPINGarrow-up-right — remove a user mapping for a foreign server

DROP VIEWarrow-up-right — remove a view

ENDarrow-up-right — commit the current transaction

EXECUTEarrow-up-right — execute a prepared statement

EXPLAINarrow-up-right — show the execution plan of a statement

FETCHarrow-up-right — retrieve rows from a query using a cursor

GRANTarrow-up-right — define access privileges

IMPORT FOREIGN SCHEMAarrow-up-right — import table definitions from a foreign server

INSERTarrow-up-right — create new rows in a table

LISTENarrow-up-right — listen for a notification

LOADarrow-up-right — load a shared library file

LOCKarrow-up-right — lock a table

MERGEarrow-up-right — conditionally insert, update, or delete rows of a table

MOVEarrow-up-right — position a cursor

NOTIFYarrow-up-right — generate a notification

PREPAREarrow-up-right — prepare a statement for execution

PREPARE TRANSACTIONarrow-up-right — prepare the current transaction for two-phase commit

REASSIGN OWNEDarrow-up-right — change the ownership of database objects owned by a database role

REFRESH MATERIALIZED VIEWarrow-up-right — replace the contents of a materialized view

REINDEXarrow-up-right — rebuild indexes

RELEASE SAVEPOINTarrow-up-right — destroy a previously defined savepoint

RESETarrow-up-right — restore the value of a run-time parameter to the default value

REVOKEarrow-up-right — remove access privileges

ROLLBACKarrow-up-right — abort the current transaction

ROLLBACK PREPAREDarrow-up-right — cancel a transaction that was earlier prepared for two-phase commit

ROLLBACK TO SAVEPOINTarrow-up-right — roll back to a savepoint

SAVEPOINTarrow-up-right — define a new savepoint within the current transaction

SECURITY LABELarrow-up-right — define or change a security label applied to an object

SELECTarrow-up-right — retrieve rows from a table or view

SELECT INTOarrow-up-right — define a new table from the results of a query

SETarrow-up-right — change a run-time parameter

SET CONSTRAINTSarrow-up-right — set constraint check timing for the current transaction

SET ROLEarrow-up-right — set the current user identifier of the current session

SET SESSION AUTHORIZATIONarrow-up-right — set the session user identifier and the current user identifier of the current session

SET TRANSACTIONarrow-up-right — set the characteristics of the current transaction

SHOWarrow-up-right — show the value of a run-time parameter

START TRANSACTIONarrow-up-right — start a transaction block

TRUNCATEarrow-up-right — empty a table or set of tables

UNLISTENarrow-up-right — stop listening for a notification

UPDATEarrow-up-right — update rows of a table

VACUUMarrow-up-right — garbage-collect and optionally analyze a database

VALUESarrow-up-right — compute a set of rows

Was this helpful?