Page 244 - PYTHON-12
P. 244
12.10.1 Data Definition Language (DDL) Commands
The DDL part of SQL permits database tables to be created or deleted. It also defines indices
(keys), specifies links between tables and imposes constraints on tables. It contains the necessary
statements for creating, manipulating, altering and deleting the table.
SQL
DDL DML
SELECT
DROP CREATE
INSERT
ALTER
UPDATE
DELETE
Fig. 12.15: Most Commonly Used SQL Commands
Examples of DDL commands in SQL are:
CREATE DATABASE: creates a new database.
USE command: to select and open an already existing database.
CREATE TABLE: creates a new table.
ALTER TABLE: modifies a table.
DROP TABLE: deletes a table.
CTM: The DDL command lets us define the database structure and its related operations.
The DDL provides a set of definitions to specify the storage structure and access methods used by
the database system and also defines proper and relevant data types.
12.10.2 Data Manipulation Language (DML) Commands
A Data Manipulation Language (DML) is a part of SQL that helps a user access or manipulate data.
The DML statements are executed in the form of queries which are handled by the DML compiler.
It contains the set of statements to:
1. Retrieve data from the tables of the database.
2. Insert data into the tables of the database.
Computer Science with Python–XII 12.14 DML commands carry out query-processing operations and manipulate data in the database
3. Delete data from the tables of the database.
4. Update data among the rows/records in the tables of the database.
objects. Several DML commands available are:
1. SELECT statement: To extract information from
Learning Tip: The query and update
the table; may or may not be on the basis of certain
commands form the DML part of SQL.
They enable the user to access or
conditions/criteria.
manipulate data stored in a database.
2. INSERT INTO statement: To insert new data (record)
into a table.