You are on page 1of 4

MODULE 2

DDL
DATA DEFINITION
LANGUAGE
Data Definition Language

DDL (Data Definition Language) is a language that allows Database


Administrators (DBA) or users to describe and give names of entities, attributes,
and relationships that the application needs along with associated integrity and
security restrictions (Connolly & Begg, 2010). According to Ema Utami &
Sukrisno (2005) DDL is a SQL command that is used to define or declare
database objects. Database objects can be tables or databases themselves.
DDL can also be used to create a database connection between the table and
its limits by determining the index as the key. Beside that, DDL can be used to
create, modify, and delete structure or definition of data type from objects that
are in the database.
CREATE is commands used to ALTER is commands to
make or to create new database modify column, add column, or
object or the database themselves delete column from the table
and also alter can be used to
modify the database
</>syntax </>syntax
CREATE DATABASE <Database_Name> ALTER TABLE <Table_Name> <ACTION>
example: <ACTION>
CREATE DATABASE Part_Stirling ADD <Column_Name> <Data_Type>
DROP COLUMN <Column_Name>
MODIFY <Column_Name> <Column_Type>
example:
ALTER TABLE Part_Stirling
DROP COLUMN Harga
DROP
DROP is commands to delete
database object.

</>syntax DROP DATABASE <Database_Name> example:

DROP TABLE <Table_Name> DROP TABLE Harga


Data Type Identifier
Data Type Description Identifier, is the variables name or another
A FIXED length string (can contain letters, numbers, and identifier. In general, identifier written in merger
CHAR (size) special characters). The size parameter specifies the column both capital letters and not capital like ‘Mahasiswa’,
length in characters - can be from 0 to 255. Default is 1. ‘Harga’, and so on but it’s not the standard rules.
A VARIABLE length string (can contain letters, numbers, and So, if writing identifier like this ‘mahasiswa’ is
special characters). The size parameter specifies the allowed.
VARCHAR (size)
maximum column length in characters - can be from 0 to

TEXT (size)
65535.
Holds a string with a maximum length of 65,535 bytes.
rules:
Using space ‘ ‘ is forbidden, forbidden to write
A medium integer. Signed range is from -2147483648 to
identifier as ‘Nama Part’.
2147483647. Unsigned range is from 0 to 4294967295. The Using underscore to separated identifier that has
INTEGER (size)
size parameter specifies the maximum display width (which more than one word. Example ‘Nama_Part’ and
is 255). ‘Gaji_Karyawan_Tetap’.
A floating point number. The total number of digits is Using number as first word is forbidden. Example
FLOAT (size, d) specified in size. The number of digits after decimal point is ‘1Data’
specified in the d parameter. Using special characters like ‘*’, ‘!’, ‘?’, ‘/’, and so on
A date. Format: YYYY-MM-DD. The supported range is from is forbidden.
DATE
'1000-01-01' to '9999-12-31'.
Many Others

You might also like