Professional Documents
Culture Documents
Statement and Retire Operation
Statement and Retire Operation
RETIRE OPERATION
INTRODUCTION
The most common operation in SQL is the query, which is performed with the
declarative SELECT statement. A data definition language or data description language
(DDL) is a syntax similar to a computer programming language for defining data structures,
especially database schemas. A data manipulation language (DML) is a family of syntax
elements similar to a computer programming language used for selecting, inserting, deleting
and updating data in a database. Performing read-only queries of data is sometimes also
considered a component of DML.
DIMONIC STATEMENTS
The data definition language concept and name was first introduced in relation to the
Codasyl database model, where the schema of the database was written in a language syntax
describing the records, fields, and sets of the user data model. Later it was used to refer to a
subset of Structured Query Language (SQL) for creating tables and constraints. SQL-92
introduced a schema manipulation language and schema information tables to query schemas.
These information tables were specified as SQL/Schemata in SQL:2003.
The term DDL is also used in a generic sense to refer to any formal language for
describing data or information structures. Many data description languages use a declarative
syntax to define fields and data types. SQL, however, uses a collection of imperative verbs
whose effect is to modify the schema of the database by adding, changing, or deleting
definitions of tables or other objects. These statements can be freely mixed with other SQL
statements, so the DDL is not truly a separate language.
CREATE STATEMENTS
1
A CREATE statement in SQL creates an object in a relational database management
system (RDBMS). In the SQL 1992 specification, the types of objects that can be created are
schemas, tables, views, domains, character sets, collations, translations, and assertions.
Many implementations extend the syntax to allow creation of additional objects, such
as indexes and user profiles. Some systems (such as PostgreSQL) allow CREATE, and other
DDL commands, inside a transaction and thus they may be rolled back.
QUERY BY EXAMPLE
A commonly used CREATE command is the CREATE TABLE command. The typical
usage is:
Column definition: [column name] [data type] {NULL | NOT NULL} {column
options}
For example, the command to create a table named employees with a few sample
columns would be:
Some forms of CREATE TABLE DDL may incorporate DML (data manipulation
language)-like constructs as well, such as the CREATE TABLE AS SELECT (CTAS) syntax
of SQL.
2
DROP STATEMENTS
Some systems (such as PostgreSQL) allow DROP and other DDL commands to occur
inside of a transaction and thus be rolled back. The typical usage is simply:
For example, the command to drop a table named employees would be:
The DROP statement is distinct from the DELETE and TRUNCATE statements, in
that DELETE and TRUNCATE do not remove the table itself. For example, a DELETE
statement might delete some (or all) data from a table while leaving the table itself in the
database, whereas a DROP statement would remove the entire table from the database.
ALTER STATEMENTS
For example, the command to add (then remove) a column named bubbles for an
existing table named sink would be:
3
RENAME STATEMENT
Rename - to rename the table. for example: rename table old_name to new_name;
Manipulation of persistent database objects, e.g., tables or stored procedures, via the
SQL schema statements, rather than the data stored within them, is considered to be part of a
separate data definition language. In SQL these two categories are similar in their detailed
syntax, data types, expressions etc., but distinct in their overall function. Data manipulation
languages have their functional capability organized by the initial word in a statement, which
is almost always a verb. In the case of SQL, these verbs are:
The Data Manipulation Language (DML) is the subset of SQL used to add, update
and delete data:
4
UPDATE example SET field1 = 'updated value' WHERE field2 = 'N';
RETIRE OPERATION
CONCLUSION
Data Manipulation Language (DML) statements are used for managing data in
database. DML commands are not auto-committed. It means changes made by DML
command are not permanent to database, it can be rolled back. SQL statements are divided
into two major categories: data definition language (DDL) and data manipulation language
(DML). Both of these categories contain far more statements than we can present here, and
each of the statements is far more complex than we show in this introduction. If you want to
master this material, we strongly recommend that you find a SQL reference for your own
database software as a supplement to these pages.
REFERENCES
http://office.microsoft.com/en-in/training/queries-i-get-answers-with-queries-
RZ001077757.aspx?section=6
http://docs.oracle.com/cd/B12037_01/server.101/b10759/statements_1001.htm
http://www.orafaq.com/faq/what_are_the_difference_between_ddl_dml_and_dcl_
commands
http://www.tutorialspoint.com/sql/sql-rdbms-concepts.htm
http://www.w3schools.com/sql/sql_intro.asp
5
http://www.orafaq.com/faq/what_are_the_difference_between_ddl_dml_and_dcl_
commands
http://stackoverflow.com/questions/24274899/automatic-data-retirement-in-
relational-database