Posts Tagged ‘DDL’
Learning DDL in Oracle
the types of DDL in the oracle, namely:
A. CREATE TABLE
Used to create tables. Syntax is generally as follows:
CREATE TABLE [schema], table (column datatype [DEFAULT expr] [, ...]);
Example of a table is:
create table MHS (
nim varchar2 (7),
name varchar2 (15),
CPI number (3.2),
jml_e number (2)
);

Then to see the existing tables, can write
Select * from tab;

Then to see the description of the table, can write
Desc MHS;

2. ALTER TABLE
ALTER TABLE statement is used to:
-> Adding a new column
To add a new column, the following general syntax:
ALTER TABLE table ADD (column datatype [DEFAULT expr] [, column datatype] …);
alter table item add / modify the brand varchar (50);
add to add a field, while the Modify to edit the field;
alter table rename column name> table> name> field>;
to change the name of the field
MHS alter table add the address varchar (20);

-> Delete column
DROP COLUMN clause is used to remove the columns that are not needed anymore in the table. For example, to delete the address in the table above MHS.
MHS alter table drop column address;

-> Modify an existing column
We can modify the column by changing the data type, size and default values.
The syntax of the ALTER TABLE command to modify the columns as follows:
Modify the ALTER TABLE table (column datatype [DEFAULT expr] [, column datatype] …);
Example:
Modify the ALTER TABLE student (jml_e number (5));
Table altered.

3. DROP TABLE
Used to eliminate the table. Perform the deletion table with the DROP command, then do the following:
-> All the data and the structure of the table is deleted
-> All pending transactions will be commit
-> All indexes will be removed
-> The command can not drop this on-rollback
For example, if you want to remove MHS table, then that should be addressed:
DROP TABLE MHS;

4. RENAME
Used to merubaha name of an object (table, view, sequence or synonim). For example, if we want to change the student table, then the command to do are:
RENAME TO MHS students;

5 Command DDL (Data Definition Language)
Post an this is my project work on the SQL DML command … may be useful for readers wrote … ![]()
Overview of the SQL …
SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases. The entire database applications on the market, both free and is licensed, adopt the SQL language for database processing. There are two types of command in SQL, the DDL and DML.
DDL (Data Definition Language) is a SQL command associated with the definition of a database and tables.Some basic commands are included in the DDL, among others.
A. CREATE
Function: CREATE Command is working to create a database or create a table inside the database.
Syntax: CREATE database_name database;
Parameters: -
Example: CREATE pharmacy database;
Explanation: CREATE command above will create a database with the name of the pharmacy.
2. SHOW
Function: This function SHOW Command to display the database or table that we created earlier.
Syntax: SHOW databases;
Parameters: -
Example: SHOW databases;
Explanation: The SHOW command above will show all the existing database.
3. USE
Function: USE Command is working to open / activate / enter the database we have created. Once we enter into the database we have created, then we can manipulate existing data, including to create a table in the database.
Syntax: USE database_name;
Parameters: -
Example: USE pharmacies;
Explanation: The command above will enable the database with the name of the pharmacy so that we can manipulate the data.
4. ALTER
Function: ALTER Command is working to change the structure of a table. Change here is not simply renew the existing table structure, but also changed the name of the field, adding a primary key, change the field type, or delete fields that have been made previously.
Syntax: ALTER TABLE table_name parameter_option;
Parameters: add, modify, drop
Example: ALTER TABLE ADD medication price int (6);
Explanation: The command above will add a field into the price of the drug table.
5. DROP
Function: DROP Command is working to remove, either database, table, or field that has been entered into the table.
Syntax: DROP TABLE table_name;
Parameters: -
Example: DROP TABLE supplier;
Explanation: The command above will remove the table supplier in the pharmacy database.
Glance About Sybase Power Designer 11
build an information system that is fast, structured and effective. Sybase Power Designer 11
supports multiple modeling as follows:
• Business Process
• Data Modelling
• XML Modelling
• Application Modeling with UML
• Information Liquidity Modeling
• Integrated Modelling
data (data modeling) for then we will use to perform database design.
Simply put, to perform data modeling in Power Designer, we have to begin at
level Conceptual Data Model, where the data modeling is done using the method Entity
Relationship Diagram. In the CDM, data type that is used is general and not specific
against a particular database.
CDM that we have built. Power Designer has a lot of support for the target database, sowe
not to be confused about the type - the type of data used, because the Power Designer will
adjust as the data type that we defined earlier in the stage of the CDM.
The last stage is the script generates Data Definition Language (DDL) of the PDM that has been
is made. Through this we can generate the DDL objects - database objects (tables, triggers, views,
procedure) then DDL scripts so that we can execute the software of other databases such as Oracle
or MySQL, or we can also create a connection and execute it directly via the PowerDesigner.
What is DDL & DML?
DDL - Data Definition Language
is a collection of SQL commands used to create, modify and delete metadata structuresand definitions of database objects.DML - Data Manipulation Language
is a collection of SQL commands that are used for processing the contents of the data inthe table such as insert, modify and delete the contents of the data - and not associatedwith changes in the structure and data type definitions of database objects.Let us see from the definition and more examples in the following sections below.
DDL - Data Definition LanguageAs the definition described above, DDL is a set of SQL commands that are used to make(create), modify (alter) and delete (drop) the structure and data type definitions ofdatabase objects.
Objects in the database in question - in MySQL - is as follows:
database
table
View
index
Procedure (Stored Procedure)
function
trigger
example:
Making (CREATE)
CREATE DATABASE
CREATE FUNCTION
CREATE INDEX
CREATE PROCEDURE
CREATE TABLE
CREATE TRIGGER
CREATE VIEWChanges (ALTER & RENAME)
ALTER DATABASE
ALTER FUNCTION
ALTER PROCEDURE
ALTER TABLE
ALTER VIEW
RENAME TABLEElimination (DROP)
DROP DATABASE
DROP FUNCTION
DROP INDEX
DROP PROCEDURE
DROP TABLE
DROP TRIGGER
DROP VIEW
| OBJECT | CREATE | ALTER | DROP | RENAME |
| DATABASE | Yes | Yes | Yes | |
| FUNCTION | Yes | Yes | Yes | |
| INDEX | Yes | Yes | ||
| PROCEDURE | Yes | Yes | Yes | |
| TABLE | Yes | Yes | Yes | Yes |
| TRIGGER | Yes | Yes | ||
| VIEW | Yes | Yes | Yes |
Some DML Commands list of MySQL 5.0CALL
DELETE
DO
HANDLER
INSERT
LOAD DATA INFILE
REPLACE
SELECT
TRUNCATE
UPDATE





