DB2 - Simple Examples - Reference Guide



Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

DB2 - Simple Examples - Reference Guide - In Portuguese:
Click on the word Description
ADD Adds a column in an existing table
ADD CONSTRAINT Adds a constraint after a table is already created
ALIAS An alias is just that, an alternative name for a field or value.
ALL Returns true if all of the subquery values meet the condition
ALTER Adds, deletes, or modifies columns in a table, or changes the data type of a column in a table
ALTER COLUMN Changes the data type of a column in a table
ALTER DATABASE The SQL ALTER DATABASE statement is used to changes the description of a database.
ALTER INDEX The SQL ALTER INDEX statement is used to alters the definition of an index.
ALTER TABLE Adds, deletes, or modifies columns in a table
ALTER TABLESPACE The SQL ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
The ALTER TABLE statement is also used to add and drop various constraints on an existing table.
ALTER VIEW The ALTER VIEW statement regenerate an existing view by altering a reference type column to add a scope.
The ALTER VIEW statement also enables or disables a view for use in query optimization.
AND Only includes rows where both conditions is true
ANY Returns true if any of the subquery values meet the condition
AS Renames a column or table with an alias
ASC Sorts the result set in ascending order
AVG The AVG() function returns the average value of a numeric column.
BACKUP DATABASE Creates a back up of an existing database
BETWEEN Selects values within a given range
CASE Creates different outputs based on conditions
CHECK A check constraint is a rule that specifies what values are allowed to be stored in a table.
For example, you can specify that the price of a book must be positive.
COLUMN Changes the data type of a column or deletes a column in a table
COUNT The COUNT() function returns the number of rows that matches a specified criterion.
CREATE Creates a database, index, view, table, or procedure
CREATE DATABASE Creates a new SQL database
CREATE INDEX Creates an index on a table (allows duplicate values)
CREATE OR REPLACE VIEW Updates a view
CREATE PROCEDURE Creates a stored procedure
CREATE SYNONYM The CREATE SYNONYM statement defines a synonym for a module, nickname, sequence, table, view, or another synonym.
CREATE TABLE Creates a new table in the database
CREATE UNIQUE INDEX Creates a unique index on a table (no duplicate values)
CREATE VIEW Creates a view based on the result set of a SELECT statement
DATABASE Creates or deletes an SQL database
DATE TIME The datetime data types are DATE, TIME, and TIMESTAMP.
Although datetime values can be used in certain arithmetic and string operations and are compatible with certain strings, they are not strings or numbers.
DEFAULT A constraint that provides a default value for a column
DELETE Deletes rows from a table
DESC Sorts the result set in descending order
DISTINCT Selects only distinct (different) values
DROP Deletes a column, constraint, database, index, table, or view
DROP COLUMN Deletes a column in a table
DROP CONSTRAINT Deletes a UNIQUE, PRIMARY KEY, FOREIGN KEY, or CHECK constraint
DROP DATABASE Deletes an existing SQL database
DROP DEFAULT Deletes a DEFAULT constraint
DROP INDEX Deletes an index in a table
DROP TABLE Deletes an existing table in the database
DROP VIEW Deletes a view
EXEC Executes a stored procedure
EXISTS Tests for the existence of any record in a subquery
FOREIGN KEY A constraint that is a key used to link two tables together
FROM Specifies which table to select or delete data from
FULL OUTER JOIN Returns all rows when there is a match in either left table or right table
GRANT Grants privileges to a user to access a DB2 object.
GROUP BY Groups the result set (used with aggregate functions: COUNT, MAX, MIN, SUM, AVG)
HAVING Used instead of WHERE with aggregate functions
IN Allows you to specify multiple values in a WHERE clause
INDEX Creates or deletes an index in a table
INNER JOIN Returns rows that have matching values in both tables
INSERT INTO Inserts new rows in a table
INSERT INTO SELECT Copies data from one table into another table
INSERT MULTIPLE ROWS The Db2 INSERT statement allows you to insert multiple rows into a table
IS NULL Tests for empty values
IS NOT NULL Tests for non-empty values
JOIN Joins tables
LEFT JOIN Returns all rows from the left table, and the matching rows from the right table
LIKE Searches for a specified pattern in a column
LIMIT Specifies the number of records to return in the result set
MATHEMATICAL OPERATORS SQL Mathematical Operators
MAX The MAX() function returns the largest value of the selected column.
MIN The MIN() function returns the smallest value of the selected column.
NOT Only includes rows where a condition is not true
NOT NULL The NOT NULL constraint enforces a column to not accept NULL values, which means that you cannot insert or update a record without adding a value to this field.
OR Includes rows where either condition is true
ORDER BY Sorts the result set in ascending or descending order
OUTER JOIN Returns all rows when there is a match in either left table or right table
PRIMARY KEY A constraint that uniquely identifies each record in a database table
PROCEDURE A stored procedure
RIGHT JOIN The RIGHT JOIN command returns all rows from the right table, and the matching records from the left table.
The result is NULL from the left side, when there is no match.
SELECT Selects data from a database
SELECT DISTINCT Selects only distinct (different) values
SELECT INTO Copies data from one table into a new table
SET Specifies which columns and values that should be updated in a table
SQL Operators SQL Arithmetic Operators
SUM The SUM() function returns the total sum of a numeric column.
TABLE Creates a table, or adds, deletes, or modifies columns in a table, or deletes a table or data inside a table
TRUNCATE TABLE Deletes the data inside a table, but not the table itself
TYPES OF CONSTRAINTS A constraint is a rule that is used for optimization purposes.
UNION Combines the result set of two or more SELECT statements (only distinct values)
UNION ALL Combines the result set of two or more SELECT statements (allows duplicate values)
UNIQUE A constraint that ensures that all values in a column are unique
UPDATE Updates existing rows in a table
VALUES Specifies the values of an INSERT INTO statement
VIEW Creates, updates, or deletes a view
WHERE Filters a result set to include only records that fulfill a specified condition