⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syntax.sgml

📁 关系型数据库 Postgresql 6.5.2
💻 SGML
字号:
 <chapter id="syntax">  <title>SQL Syntax</title>  <abstract>   <para>    <acronym>SQL</acronym> manipulates sets of data. The language is    composed of various <firstterm>key words</firstterm>. Arithmetic    and procedural expressions are allowed. We will cover these topics    in this chapter; subsequent chapters will include details on data    types, functions, and operators.   </para>  </abstract>  <sect1>   <title>Key Words</title>   <para>    <acronym>SQL92</acronym> defines <firstterm>key words</firstterm>     for the language    which have specific meaning. Some key words are    <firstterm>reserved</firstterm>, which indicates that they are    restricted to appear in only certain contexts. Other key words are    <firstterm>not restricted</firstterm>, which indicates that in certain     contexts they    have a specific meaning but are not otherwise constrained.   </para>   <para>    <productname>Postgres</productname> implements an extended subset of the    <acronym>SQL92</acronym> and <acronym>SQL3</acronym> languages. Some language    elements are not as restricted in this implementation as is    called for in the language standards, in part due    to the extensibility features of <productname>Postgres</productname>.    </para>   <para>    Information on <acronym>SQL92</acronym> and <acronym>SQL3</acronym> key words    is derived from <xref linkend="DATE97" endterm="DATE97">.   </para>   <sect2>    <title>Reserved Key Words</title>    <para>     <acronym>SQL92</acronym> and <acronym>SQL3</acronym> have      <firstterm>reserved key words</firstterm> which are not allowed      as identifiers and not allowed in any usage other than as fundamental     tokens in <acronym>SQL</acronym> statements.     <productname>Postgres</productname> has additional key words     which have similar restrictions. In particular, these key words     are not allowed as column or table names, though in some cases     they are allowed to be column labels (i.e. in AS clauses).    </para>    <tip>     <para>      Any string can be specified as an identifier if surrounded by      double quotes (<quote>like this!</quote>). Some care is required since      such an identifier will be case sensitive      and will retain embedded whitespace other special characters.     </para>    </tip>    <para>     The following are <productname>Postgres</productname>     reserved words which are neither <acronym>SQL92</acronym>     nor <acronym>SQL3</acronym> reserved words. These are allowed     to be present as column labels, but not as identifiers:     <programlisting>ABORT ANALYZE BINARY CLUSTER CONSTRAINT COPYDO EXPLAIN EXTENDLISTEN LOAD LOCK MOVE NEW NONE NOTIFY RESET SETOF SHOWUNLISTEN UNTIL VACUUM VERBOSE     </programlisting>    </para>    <para>     The following are <productname>Postgres</productname>     reserved words which are also <acronym>SQL92</acronym>      or <acronym>SQL3</acronym> reserved words, and which     are allowed to be present as column labels, but not as identifiers:     <programlisting>CASE COALESCE CROSS CURRENT ELSE ENDFALSE FOREIGN GLOBAL GROUP LOCALNULLIFORDER POSITION PRECISION TABLE THEN TRANSACTION TRUEWHEN     </programlisting>     The following are <productname>Postgres</productname>     reserved words which are also <acronym>SQL92</acronym>      or <acronym>SQL3</acronym> reserved words:     <programlisting>ADD ALL ALTER AND ANY AS ASCBEGIN BETWEEN BOTH BYCASCADE CAST CHAR CHARACTER CHECK CLOSE  COLLATE COLUMN COMMIT CONSTRAINT  CREATE CURRENT_DATE CURRENT_TIME  CURRENT_TIMESTAMP CURRENT_USER CURSORDECIMAL DECLARE DEFAULT DELETE DESC DISTINCT DROPEXECUTE EXISTS EXTRACTFETCH FLOAT FOR FROM FULLGRANT HAVINGIN INNER INSERT INTERVAL INTO ISJOIN LEADING LEFT LIKE LOCALNAMES NATIONAL NATURAL NCHAR NO NOT NULL NUMERICON OR OUTERPARTIAL PRIMARY PRIVILEGES PROCEDURE PUBLICREFERENCES REVOKE RIGHT ROLLBACKSELECT SET SUBSTRINGTO TRAILING TRIM UNION UNIQUE UPDATE USER USINGVALUES VARCHAR VARYING VIEWWHERE WITH WORK      </programlisting>    </para>    <para>     The following are <acronym>SQL92</acronym> reserved key words which     are not <productname>Postgres</productname> reserved key words, but which     if used as function names are always translated into the function     <function>length</function>:     <programlisting>CHAR_LENGTH CHARACTER_LENGTH     </programlisting>    </para>    <para>     The following are <acronym>SQL92</acronym> or <acronym>SQL3</acronym>      reserved key words which     are not <productname>Postgres</productname> reserved key words, but     if used as type names are always translated into an alternate, native type:     <programlisting>BOOLEAN DOUBLE FLOAT INT INTEGER INTERVAL REAL SMALLINT     </programlisting>    </para>    <para>     The following are either <acronym>SQL92</acronym>     or <acronym>SQL3</acronym> reserved key words     which are not key words in <productname>Postgres</productname>.     These have no proscribed usage in <productname>Postgres</productname>     at the time of writing (v6.5) but may become reserved key words in the     future:     <note>      <para>       Some of these key words represent functions in <acronym>SQL92</acronym>.       These functions are defined in <productname>Postgres</productname>,       but the parser does not consider the names to be key words and they are allowed       in other contexts.      </para>     </note>     <programlisting>ALLOCATE ARE ASSERTION AT AUTHORIZATION AVG BIT BIT_LENGTHCASCADED CATALOG COLLATION CONNECT CONNECTION CONSTRAINTS CONTINUE CONVERT CORRESPONDING COUNTDATE DEALLOCATE DEC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DOMAIN END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXTERNAL FIRST FOUNDGET GO GOTO IDENTITY IMMEDIATE INDICATOR INITIALLY INPUT INTERSECT ISOLATION LAST LEVEL LOWER MAX MIN MODULE OCTET_LENGTH OPEN OUTPUT OVERLAPS PREPARE PRESERVE RESTRICT ROWSSCHEMA SECTION SESSION SESSION_USER SIZE SOME  SQL SQLCODE SQLERROR SQLSTATE SUM SYSTEM_USERTEMPORARY TRANSLATE TRANSLATION UNKNOWN UPPER USAGEVALUE WHENEVER WRITE     </programlisting>    </para>   </sect2>   <sect2>    <title>Non-reserved Keywords</title>    <para>     <acronym>SQL92</acronym> and <acronym>SQL3</acronym> have      <firstterm>non-reserved keywords</firstterm> which have     a proscribed meaning in the language but which are also allowed     as identifiers.     <productname>Postgres</productname> has additional keywords     which allow similar unrestricted usage.     In particular, these keywords     are allowed as column or table names.    </para>    <para>     The following are <productname>Postgres</productname>     non-reserved key words which are neither <acronym>SQL92</acronym>     nor <acronym>SQL3</acronym> non-reserved key words:     <programlisting>ACCESS AFTER AGGREGATE BACKWARD BEFORE CACHE CREATEDB CREATEUSER CYCLEDATABASE DELIMITERS EACH ENCODING EXCLUSIVEFORWARD FUNCTION HANDLERINCREMENT INDEX INHERITS INSENSITIVE INSTEAD ISNULLLANCOMPILER LOCATION MAXVALUE MINVALUE MODENOCREATEDB NOCREATEUSER NOTHING NOTNULL OIDS OPERATOR PASSWORD PROCEDURALRECIPE RENAME  RETURNS ROW RULESEQUENCE SERIAL SHARE START STATEMENT STDIN STDOUT TRUSTED VALID VERSION     </programlisting>    </para>    <para>     The following are <productname>Postgres</productname>     non-reserved key words which are <acronym>SQL92</acronym>     or <acronym>SQL3</acronym> reserved key words:     <programlisting>ABSOLUTE ACTIONDAYHOURINSENSITIVE KEY LANGUAGE MATCH MINUTE MONTHNEXT OF ONLY OPTION PRIOR PRIVILEGES READ RELATIVE SCROLL SECONDTIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TRIGGER YEARZONE     </programlisting>    </para>    <para>     The following are <productname>Postgres</productname>     non-reserved key words which are also either <acronym>SQL92</acronym>     or <acronym>SQL3</acronym> non-reserved key words:     <programlisting>COMMITTED SERIALIZABLE TYPE     </programlisting>    </para>    <para>     The following are either <acronym>SQL92</acronym>     or <acronym>SQL3</acronym> non-reserved key words which are not     key words of any kind in <productname>Postgres</productname>:     <programlisting>ADAC CATALOG_NAME CHARACTER_SET_CATALOG CHARACTER_SET_NAME CHARACTER_SET_SCHEMA CLASS_ORIGIN COBOL COLLATION_CATALOGCOLLATION_NAME COLLATION_SCHEMA COLUMN_NAMECOMMAND_FUNCTION CONDITION_NUMBERCONNECTION_NAME CONSTRAINT_CATALOG CONSTRAINT_NAMECONSTRAINT_SCHEMA CURSOR_NAMEDATA DATE_TIME_INTERVAL_CODE DATE_TIME_INTERVAL_PRECISIONDYNAMIC_FUNCTIONFORTRANLENGTHMESSAGE_LENGTH MESSAGE_OCTET_LENGTH MORE MUMPSNAME NULLABLE NUMBERPAD PASCAL PLIREPEATABLE RETURNED_LENGTH RETURNED_OCTET_LENGTHRETURNED_SQLSTATE ROW_COUNTSCALE SCHEMA_NAME SERVER_NAME SPACESUBCLASS_ORIGINTABLE_NAMEUNCOMMITTED UNNAMED     </programlisting>    </para>   </sect2>  </sect1>  <sect1>   <title>Expressions</title>   <para>    <acronym>SQL92</acronym> allows <firstterm>expressions</firstterm>    to transform data in expressions. Expressions may contain operators    (see <xref linkend="operators-title" endterm="operators-title">    for more details) and functions    (<xref linkend="functions-title" endterm="functions-title"> has    more information).   </para>  </sect1> </chapter><!-- Keep this comment at the end of the fileLocal variables:mode: sgmlsgml-omittag:nilsgml-shorttag:tsgml-minimize-attributes:nilsgml-always-quote-attributes:tsgml-indent-step:1sgml-indent-data:tsgml-parent-document:nilsgml-default-dtd-file:"./reference.ced"sgml-exposed-tags:nilsgml-local-catalogs:"/usr/lib/sgml/CATALOG"sgml-local-ecat-files:nilEnd:-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -