SQL commands are divided into categories, the two main ones being Data Manipulation Language (DML) commands and Data Definition Language (DDL) commands. DML commands deal with data, either retrieving it or modifying it to keep it up-to-date. DDL commands create or change tables and other database objects such as views and indexes.
A list of the more common DML commands follows:
SELECT â€”used to query and display data from a database. The
SELECTstatement specifies which columns to include in the result set. The vast majority of the SQL commands used in applications are
INSERT â€”adds new rows to a table. INSERT is used to populate a newly created table or to add a new row (or rows) to an already-existing table.
DELETE â€”removes a specified row or set of rows from a table
UPDATE â€”changes an existing value in a column or group of columns in a table
The more common DDL commands follow:
CREATE TABLE â€”creates a table with the column names the user provides. The user also needs to specify a type for the data in each column. Data types vary from one RDBMS to another, so a user might need to use metadata to establish the data types used by a particular database. (See Metadata for a definition of metadata.
CREATE TABLEis normally used less often than the data manipulation commands because a table is created only once, whereas adding or deleting rows or changing individual values generally occurs more frequently.
DROP TABLE â€”deletes all rows and removes the table definition from the database. A JDBC API implementation is required to support the DROP TABLE command as specified by SQL92, Transitional Level. However, support for the
DROP TABLEis optional. In addition, the behavior of
DROP TABLEis implementation-defined when there are views or integrity constraints defined that reference the table being dropped.
ALTER TABLE â€”adds or removes a column from a table. It also adds or drops table constraints and alters column attributes
Most Viewed Articles (in JDBC )
Latest Articles (in JDBC)
Comment on this tutorial
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews