SQL statements

 

This topic contains tables that list the SQL statements classified by type.

  • SQL schema statements (Table 1)
  • SQL data change statements (Table 2)
  • SQL data statements (Table 3)
  • SQL transaction statements (Table 4)
  • SQL connection statements (Table 5)
  • SQL dynamic statements (Table 6)
  • SQL session statements (Table 7)
  • SQL embedded host language statements (Table 8)
  • SQL control statements (Table 9)
Table 1. SQL schema statements
SQL Statement Purpose
ALTER AUDIT POLICY statement Modifies the definition of an audit policy at the current server.
ALTER BUFFERPOOL statement Changes the definition of a buffer pool.
ALTER DATABASE statement Adds new storage paths to the collection of paths that are used for automatic storage table spaces.
ALTER EVENT MONITOR statement Changes the definition of a TABLE or UNFORMATTED EVENT TABLE event monitor.
ALTER DATABASE PARTITION GROUP statement Changes the definition of a database partition group.
ALTER FUNCTION statement Modifies an existing function by changing the properties of the function.
ALTER HISTOGRAM TEMPLATE statement Modifies the template describing the type of histogram that can be used to override one or more of the default histograms of a service class or a work class.
ALTER INDEX statement Changes the definition of an index.
ALTER MASK statement Changes the definition of a column mask.
ALTER METHOD statement Modifies an existing method by changing the method body associated with the method.
ALTER MODULE statement Changes the definition of a module.
ALTER NICKNAME statement Changes the definition of a nickname.
ALTER PACKAGE statement Alters bind options for a package at the current server without having to bind or rebind the package.
ALTER PERMISSION statement Changes the definition of a row permission.
ALTER PROCEDURE (external) statement Modifies an existing external procedure by changing the properties of the procedure.
ALTER PROCEDURE (sourced) statement Modifies an existing sourced procedure by changing the data type of one or more parameters of the sourced procedure.
ALTER PROCEDURE (SQL) statement Modifies an existing SQL procedure by changing the properties of the procedure.
ALTER SCHEMA statement Modifies an existing schema by changing the data capture attribute of the schema.
ALTER SECURITY LABEL COMPONENT statement Modifies a security label component.
ALTER SECURITY POLICY statement Modifies a security policy.
ALTER SEQUENCE statement Changes the definition of a sequence.
ALTER SERVER statement Changes the definition of a data source in a federated system.
ALTER SERVICE CLASS statement Changes the definition of a service class.
ALTER STOGROUP statement Changes the definition of a storage group.
ALTER TABLE statement Changes the definition of a table.
ALTER TABLESPACE statement Changes the definition of a table space.
ALTER THRESHOLD statement Changes the definition of a threshold.
ALTER TRIGGER statement Changes the definition of a trigger.
ALTER TRUSTED CONTEXT statement Changes the definition of a trusted context at the current server.
ALTER TYPE (structured) statement Changes the definition of a structured type.
ALTER USAGE LIST statement Changes the definition of a usage list.
ALTER USER MAPPING statement Changes the definition of a user authorization mapping.
ALTER VIEW statement Changes the definition of a view by altering a reference type column to add a scope.
ALTER WORK ACTION SET statement Adds, alters, or drops work actions within a work action set.
ALTER WORK CLASS SET statement Adds, alters, or drops work classes within a work class set.
ALTER WORKLOAD statement Changes a workload.
ALTER WRAPPER statement Updates the options that, along with a wrapper module, are used to access data sources of a specific type.
ALTER XSROBJECT statement Enables or disables decomposition support for a specific XML schema.
AUDIT statement Determines the audit policy that is to be used for a particular database or database object at the current server.
COMMENT statement Replaces or adds a comment to the description of an object.
CREATE ALIAS statement Defines an alias for a module, nickname, sequence, table, view, or another alias.
CREATE AUDIT POLICY statement Defines an auditing policy at the current server.
CREATE BUFFERPOOL statement Defines a new buffer pool.
CREATE DATABASE PARTITION GROUP statement Defines a database partition group.
CREATE EVENT MONITOR statement Specifies events in the database to monitor.
CREATE EVENT MONITOR (activities) statement Specifies activity events in the database to monitor.
CREATE EVENT MONITOR (change history) statement Specifies change history events in the database to monitor.
CREATE EVENT MONITOR (locking) statement Specifies locking events in the database to monitor.
CREATE EVENT MONITOR (package cache) statement Specifies package cache statement events in the database to monitor.
CREATE EVENT MONITOR (statistics) statement Specifies statistics events in the database to monitor.
CREATE EVENT MONITOR (threshold violations) statement Specifies threshold violation events in the database to monitor.
CREATE EVENT MONITOR (unit of work) statement Specifies unit of work events in the database to monitor.
CREATE FUNCTION statement Registers a user-defined function.
CREATE FUNCTION (external scalar) statement Registers a user-defined external scalar function.
CREATE FUNCTION (external table) statement Registers a user-defined external table function.
CREATE FUNCTION (OLE DB external table) statement Registers a user-defined OLE DB external table function.
CREATE FUNCTION (sourced or template) statement Registers a user-defined sourced function or a function template.
CREATE FUNCTION (SQL scalar, table, or row) statement Defines a user-defined SQL function.
CREATE FUNCTION MAPPING statement Defines a function mapping.
CREATE GLOBAL TEMPORARY TABLE statement Defines a created temporary table.
CREATE HISTOGRAM TEMPLATE statement Defines a template describing the type of histogram that can be used to override one or more of the default histograms of a service class or a work class.
CREATE INDEX statement Defines an index on a table.
CREATE INDEX EXTENSION statement Defines an extension object for use with indexes on tables with structured or distinct type columns.
CREATE MASK statement Defines a column mask.
CREATE METHOD statement Defines a method body to associate with a previously defined method specification.
CREATE MODULE statement Defines a module.
CREATE NICKNAME statement Defines a nickname.
CREATE PERMISSION statement Defines a row permission.
CREATE PROCEDURE statement Defines a procedure.
CREATE PROCEDURE (external) statement Defines an external procedure.
CREATE PROCEDURE (sourced) statement Defines a procedure (the sourced procedure) that is based on another procedure (the source procedure). In a federated system, a federated procedure is a sourced procedure whose source procedure is at a supported data source.
CREATE PROCEDURE (SQL) statement Defines an SQL procedure.
CREATE ROLE statement Defines a role at the current server.
CREATE SCHEMA statement Defines a schema.
CREATE SECURITY LABEL COMPONENT statement Defines a component that is to be used as part of a security policy.
CREATE SECURITY LABEL statement Defines a security label.
CREATE SECURITY POLICY statement Defines a security policy.
CREATE SEQUENCE statement Defines a sequence.
CREATE SERVER statement Defines a data source to a federated database.
CREATE SERVICE CLASS statement Defines a service class.
CREATE STOGROUP statement Defines a new storage group within the database.
CREATE SYNONYM statement Defines a synonym for a module, nickname, sequence, table, view, or another synonym.
CREATE TABLE statement Defines a table.
CREATE TABLESPACE statement Defines a table space.
CREATE THRESHOLD statement Defines a threshold.
CREATE TRANSFORM statement Defines transformation functions.
CREATE TRIGGER statement Defines a trigger.
CREATE TRUSTED CONTEXT statement Defines a trusted context at the current server.
CREATE TYPE statement Defines a user-defined data type at the current server.
CREATE TYPE (array) statement Defines an array type.
CREATE TYPE (cursor) statement Defines a cursor type.
CREATE TYPE (distinct) statement Defines a distinct data type.
CREATE TYPE (row) statement Defines a row type.
CREATE TYPE (structured) statement Defines a structured data type.
CREATE TYPE MAPPING statement Defines a mapping between data types.
CREATE USAGE LIST statement Defines a usage list in order to monitor all unique sections (DML statements) that have referenced a particular table or index during their execution.
CREATE USER MAPPING statement Defines a mapping between user authorizations.
CREATE VARIABLE statement Defines a global variable.
CREATE VIEW statement Defines a view of one or more table, view or nickname.
CREATE WORK ACTION SET statement Defines a work action set and work actions within the work action set.
CREATE WORK CLASS SET statement Defines a work class set.
CREATE WORKLOAD statement Defines a workload.
CREATE WRAPPER statement Registers a wrapper.
DROP statement Deletes objects in the database.
GRANT (database authorities) statement Grants authorities on the entire database.
GRANT (exemption) statement Grants an exemption on an access rule for a specified label-based access control (LBAC) security policy.
GRANT (global variable privileges) statement Grants one or more privileges on a created global variable.
GRANT (index privileges) statement Grants the CONTROL privilege on indexes in the database.
GRANT (module privileges) statement Grants privileges on a module.
GRANT (package privileges) statement Grants privileges on packages in the database.
GRANT (role) statement Grants roles to users, groups, or to other roles.
GRANT (routine privileges) statement Grants privileges on a routine (function, method, or procedure).
GRANT (schema privileges) statement Grants privileges on a schema.
GRANT (security label) statement Grants a label-based access control (LBAC) security label for read access, write access, or for both read and write access.
GRANT (sequence privileges) statement Grants privileges on a sequence.
GRANT (server privileges) statement Grants privileges to query a specific data source.
GRANT (SETSESSIONUSER privilege) statement Grants the privilege to use the SET SESSION AUTHORIZATION statement.
GRANT (table space privileges) statement Grants privileges on a table space.
GRANT (table, view, or nickname privileges) statement Grants privileges on tables, views and nicknames.
GRANT (workload privileges) statement Grants the USAGE privilege on a workload.
GRANT (XSR object privileges) statement Grants the USAGE privilege on an XSR object.
REFRESH TABLE statement Refreshes the data in a materialized query table.
RENAME statement Renames an existing table.
RENAME STOGROUP statement Renames an existing storage group.
RENAME TABLESPACE statement Renames an existing table space.
REVOKE (database authorities) statement Revokes authorities from the entire database.
REVOKE (exemption) statement Revokes the exemption on an access rule for a specified label-based access control (LBAC) security policy.
REVOKE (global variable privileges) statement Revokes one or more privileges on a created global variable.
REVOKE (index privileges) statement Revokes the CONTROL privilege on given indexes.
REVOKE (module privileges) statement Revokes privileges on a module.
REVOKE (package privileges) statement Revokes privileges from given packages in the database.
REVOKE (role) statement Revokes roles from users, groups, or other roles.
REVOKE (routine privileges) statement Revokes privileges on a routine (function, method, or procedure).
REVOKE (schema privileges) statement Revokes privileges on a schema.
REVOKE (security label) statement Revokes a label-based access control (LBAC) security label for read access, write access, or for both read and write access.
REVOKE (sequence privileges) Revokes privileges on a sequence.
REVOKE (server privileges) statement Revokes privileges to query a specific data source.
REVOKE (SETSESSIONUSER privilege) statement Revokes the privilege to use the SET SESSION AUTHORIZATION statement.
REVOKE (table space privileges) statement Revokes the USE privilege on a given table space.
REVOKE (table, view, or nickname privileges) statement Revokes privileges from given tables, views or nicknames.
REVOKE (workload privileges) statement Revokes the USAGE privilege on a workload.
REVOKE (XSR object privileges) statement Revokes the USAGE privilege on an XSR object.
SET INTEGRITY statement Sets the set integrity pending state and checks data for constraint violations.
TRANSFER OWNERSHIP statement Transfers ownership of a database object.
Table 2. SQL data change statements
SQL Statement Purpose
DELETE statement Deletes one or more rows from a table.
INSERT statement Inserts one or more rows into a table.
MERGE statement Updates a target (a table or view) using data from a source (result of a table reference).
TRUNCATE statement Deletes all rows from a table.
UPDATE statement Updates the values of one or more columns in one or more rows of a table.
Table 3. SQL data statements
SQL Statement Purpose
ALLOCATE CURSOR statement Allocates a cursor for the result set identified by the result set locator variable.
ASSOCIATE LOCATORS statement Gets the result set locator value for each result set returned by a procedure.
CLOSE statement Closes a cursor.
DECLARE CURSOR statement Defines an SQL cursor.
FETCH statement Assigns values of a row to host variables.
FLUSH BUFFERPOOLS statement Writes out the dirty pages in the buffer pools to disk.
FLUSH EVENT MONITOR statement Writes out the active internal buffer of an event monitor.
FLUSH FEDERATED CACHE statement The FLUSH FEDERATED CACHE statement flushes the federated cache, allowing fresh metadata to be obtained the next time an SQL statement is issued against the remote table or view using a federated three part name.
FLUSH OPTIMIZATION PROFILE CACHE statement Removes the cached optimization profiles.
FLUSH PACKAGE CACHE statement Removes all cached dynamic SQL statements currently in the package cache.
FREE LOCATOR statement Removes the association between a locator variable and its value.
LOCK TABLE statement Either prevents concurrent processes from changing a table or prevents concurrent processes from using a table.
OPEN statement Prepares a cursor that will be used to retrieve values when the FETCH statement is issued.
SELECT INTO statement Specifies a result table of no more than one row and assigns the values to host variables.
SET variable statement Assigns values to variables.
VALUES INTO statement Specifies a result table of no more than one row and assigns the values to host variables.
Table 4. SQL transaction statements
SQL Statement Purpose
COMMIT statement Terminates a unit of work and commits the database changes made by that unit of work.
RELEASE SAVEPOINT statement Releases a savepoint within a transaction.
ROLLBACK statement Terminates a unit of work and backs out the database changes made by that unit of work.
SAVEPOINT statement Sets a savepoint within a transaction.
Table 5. SQL connection statements
SQL Statement Purpose
CONNECT (type 1) statement Connects to an application server according to the rules for remote unit of work.
CONNECT (type 2) statement Connects to an application server according to the rules for application-directed distributed unit of work.
DISCONNECT statement Terminates one or more connections when there is no active unit of work.
RELEASE (connection) statement Places one or more connections in the release-pending state.
SET CONNECTION statement Changes the state of a connection from dormant to current, making the specified location the current server.
Table 6. SQL dynamic statements
SQL Statement Purpose
DESCRIBE statement Obtains information about an object.
DESCRIBE INPUT statement Obtains information about the input parameter markers of a prepared statement.
DESCRIBE OUTPUT statement Obtains information about a prepared statement or information about the select list columns in a prepared SELECT statement.
EXECUTE statement Executes a prepared SQL statement.
EXECUTE IMMEDIATE statement Prepares and executes an SQL statement.
PREPARE statement Prepares an SQL statement (with optional parameters) for execution.
Table 7. SQL session statements
SQL Statement Purpose
DECLARE GLOBAL TEMPORARY TABLE statement Defines a declared temporary table.
EXPLAIN statement Captures information about the chosen access plan.
SET COMPILATION ENVIRONMENT statement Changes the current compilation environment in the connection to match the values contained in the compilation environment provided by a deadlock event monitor.
SET CURRENT DECFLOAT ROUNDING MODE statement Verifies that the specified rounding mode is the value that is currently set for the CURRENT DECFLOAT ROUNDING MODE special register.
SET CURRENT DEFAULT TRANSFORM GROUP statement Changes the value of the CURRENT DEFAULT TRANSFORM GROUP special register.
SET CURRENT DEGREE statement Changes the value of the CURRENT DEGREE special register.
SET CURRENT EXPLAIN MODE statement Changes the value of the CURRENT EXPLAIN MODE special register.
SET CURRENT EXPLAIN SNAPSHOT statement Changes the value of the CURRENT EXPLAIN SNAPSHOT special register.
SET CURRENT FEDERATED ASYNCHRONY statement Changes the value of the CURRENT FEDERATED ASYNCHRONY special register.
SET CURRENT IMPLICIT XMLPARSE OPTION statement Changes the value of the CURRENT IMPLICIT XMLPARSE OPTION special register.
SET CURRENT ISOLATION statement Changes the value of the CURRENT ISOLATION special register.
SET CURRENT LOCALE LC_MESSAGES statement Changes the value of the CURRENT LOCALE LC_MESSAGES special register.
SET CURRENT LOCALE LC_TIME statement Changes the value of the CURRENT LOCALE LC_TIME special register.
SET CURRENT LOCK TIMEOUT statement Changes the value of the CURRENT LOCK TIMEOUT special register.
SET CURRENT MAINTAINED TABLE TYPES FOR OPTIMIZATION statement Changes the value of the CURRENT MAINTAINED TABLE TYPES FOR OPTIMIZATION special register.
SET CURRENT MDC ROLLOUT MODE statement Assigns a value to the CURRENT MDC ROLLOUT MODE special register.
SET CURRENT OPTIMIZATION PROFILE statement Assigns a value to the CURRENT OPTIMIZATION PROFILE special register.
SET CURRENT PACKAGE PATH statement Assigns a value to the CURRENT PACKAGE PATH special register.
SET CURRENT PACKAGESET statement Sets the schema name for package selection.
SET CURRENT QUERY OPTIMIZATION statement Changes the value of the CURRENT QUERY OPTIMIZATION special register.
SET CURRENT REFRESH AGE statement Changes the value of the CURRENT REFRESH AGE special register.
SET CURRENT SQL_CCFLAGS statement Changes the value of the CURRENT SQL_CCFLAGS special register.
SET CURRENT TEMPORAL BUSINESS_TIME statement Changes the value of the CURRENT TEMPORAL BUSINESS_TIME special register.
SET CURRENT TEMPORAL SYSTEM_TIME statement Changes the value of the CURRENT TEMPORAL SYSTEM_TIME special register.
SET ENCRYPTION PASSWORD statement Sets the password for encryption.
SET EVENT MONITOR STATE statement Activates or deactivates an event monitor.
SET PASSTHRU statement Opens a session for submitting data source native SQL directly to the data source.
SET PATH statement Changes the value of the CURRENT PATH special register.
SET ROLE statement Verifies that the authorization ID of the session is a member of a specific role.
SET SCHEMA statement Changes the value of the CURRENT SCHEMA special register.
SET SERVER OPTION statement Sets server option settings.
SET SESSION AUTHORIZATION statement Changes the value of the SESSION USER special register.
SET USAGE LIST STATE statement Manages the state of a usage list and the associated data and memory.
Table 8. SQL embedded host language statements
SQL Statement Purpose
BEGIN DECLARE SECTION statement Marks the beginning of a host variable declaration section.
END DECLARE SECTION statement Marks the end of a host variable declaration section.
GET DIAGNOSTICS statement Used to obtain information about the previously executed SQL statement.
INCLUDE statement Inserts code or declarations into a source program.
RESIGNAL statement Used to resignal an error or warning condition.
SIGNAL statement Used to signal an error or warning condition.
WHENEVER statement Defines actions to be taken on the basis of SQL return codes.
Table 9. SQL control statements
SQL Statement Purpose
CALL statement Calls a procedure.
CASE statement Selects an execution path based on multiple conditions.
Compound SQL statement Encloses SQL statements with BEGIN and END keywords.
Compound SQL (inlined) statement Combines one or more other SQL statements into an dynamic block.
Compound SQL (embedded) statement Combines one or more other SQL statements into an executable block.
Compound SQL (compiled) statement Groups other statements together in an SQL procedure.
FOR statement Executes a statement or group of statements for each row of a table.
GOTO statement Used to branch to a user-defined label within an SQL procedure.
IF statement Selects an execution path based on the evaluation of a condition.
ITERATE statement Causes the flow of control to return to the beginning of a labelled loop.
LEAVE statement Transfers program control out of a loop or a compound statement.
LOOP statement Repeats the execution of a statement or a group of statements.
PIPE statement Returns a row from a compiled table function.
REPEAT statement Executes a statement or group of statements until a search condition is true.
RESIGNAL statement Used to resignal an error or warning condition.
RETURN statement Used to return from a routine.
SIGNAL statement Used to signal an error or warning condition.
WHILE statement Repeats the execution of a statement or group of statements while a specified condition is true.

直接放个DB2 SQL STATEMENT大全好了!的更多相关文章

  1. SQL语句大全

    经典SQL语句大全(绝对的经典) 一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份s ...

  2. SQL 语句大全(转载)

    经典SQL语句大全 一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份sql serv ...

  3. SQL语句大全(转载)

    经典SQL语句大全 一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份sql serv ...

  4. 经典SQL语句大全以及50个常用的sql语句

    经典SQL语句大全 一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份sql serv ...

  5. 经典SQL语句大全(网络资源共享)

    下列语句部分是Mssql语句,不可以在access中使用.  SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE)  DML—数据操纵语言(SELECT,DELET ...

  6. SQL 语句大全

    转载:http://www.cnblogs.com/yubinfeng/archive/2010/11/02/1867386.html 经典SQL语句大全 一.基础 1.说明:创建数据库 CREATE ...

  7. [转] - 经典SQL语句大全

    经典SQL语句大全 一.基础 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop database dbname3.说明:备份sql serv ...

  8. SQL语句大全(mysql,sqlserver,oracle)

    SQL语句大全 --语句功能--数据操作SELECT --从数据库表中检索数据行和列-selectINSERT --向数据库表添加新数据行-insertDELETE --从数据库表中删除数据行-del ...

  9. mysql sql语句大全(转载)

      1.说明:创建数据库 CREATE DATABASE database-name 2.说明:删除数据库 drop database dbname 3.说明:备份sql server --- 创建 ...

随机推荐

  1. Javascript高级程序设计——面向对象之理解对象

    在面向对象语言中都有类的概念,通过类来创建具有属性和方法的对象.而ECMAScript中没有类的概念,ECMAScript中定义了对象:无需属性的集合,其属性值可以包含基本值.对象.或者函数. 在Ja ...

  2. oracle 行列转换的运用

    问题: 员工表: A(E_ID,NAME,) 部门表:  B(D_ID,D_NAME) 员工与部门关系:C(ID,E_ID,D_ID) SELECT  A.E_ID,A.NAME ,B.D_NAME ...

  3. Unity 视频播放杂谈

    http://www.cnblogs.com/zsb517/p/4060814.html 背景:      游戏机中想加入舞蹈元素,最先的想法是开发舞蹈游戏,然后通过动画来表现舞蹈,给用户提供舞蹈教学 ...

  4. JavaScript引用类型

    引用类型虽然看起来和类很相似,但是它们却是不同的概念,引用类型的值,也就是对象是引用类型的一个实例.在Js中引用类型主要有Object,Array,Date,正则,Function等. 数组Array ...

  5. VB .NET周期实现

    这里仅提供一个方案,当然会有比本方案更好的,欢迎提供. 简介 在vb.net实现周期调度的问题时(就是间隔固定的时间做什么事情),我们最先想到的一定是(反正我是)利用timer(定时器)来做这个计时的 ...

  6. java抓取快递100信息接口

    package zeze; import java.io.IOException; import org.json.JSONArray; import org.json.JSONException; ...

  7. [大坑]FFT学习

    [大坑]FFT学习 Macros #define fon(i,s) for(int i=0;i<s; ++i) #define fone(i,s) for(int i=0;i<=s;++i ...

  8. phpcms评论的url替换问题

    在整个项目改ip之前,评论里的url是127.0.1.113 改成localhost之后,更新了所有的url和缓存,但是v9_comment表中的url字段没有更新. 想一下后台只有一个地方是替换数据 ...

  9. phpcms常用方法简介

    function thumb() /** * 生成缩略图函数 * @param $imgurl 图片路径 * @param $width 缩略图宽度 * @param $height 缩略图高度 * ...

  10. php 使用redis锁限制并发访问类

    1.并发访问限制问题 对于一些需要限制同一个用户并发访问的场景,如果用户并发请求多次,而服务器处理没有加锁限制,用户则可以多次请求成功. 例如换领优惠券,如果用户同一时间并发提交换领码,在没有加锁限制 ...