Insert, Update, Delete (Oracle)

Standard operation is a database insert, delete and update. The three so-called DML stands for Data Manipulation Language. SQL is a standard language for database processing. Of course, any use Oracle-SQL, only a few characteristics that differ from standard SQL.

Once we started discussing the "Try-try" Oracle, then we have a separate user is a user named TEST. Please go to your page or in Oracle XE to SQL + (if you install another version of the oracle, for example: 8i, 9i, 10g, and you also must enter hostring / tnsnames your database) and login with the user, namely:

User TEST
Password test

INSERT

Insert is used to enter data into a table in the user (schema) specific. Insert syntax can be written as follows:

INSERT INTO [nama_user].[nama_table]

([nama_kolom1], [nama_kolom2], . . .)

VALUES

([nilai1], [nilai2], . . .);

Description:
username: user name or schema name when logged in
nama_tabel: Name of the table contained in the user (schema) is
nama_kolom: Name of the column that will contain the data in [nama_tabel]
value: The value that will be filled in [nama_kolom], eg: [value1] will be populated into the [nama_kolom1], [value2] will be populated into the [nama_kolom2]
UPDATE

Update is used to change the data in a table in the user (schema) based on certain specific conditions. Update syntax can be written as follows:

UPDATE [nama_user].[nama_table]SET

[nama_kolom1] = [nilai1],

[nama_kolom2] = [nilai2],

[nama_kolom3] = [nilai3],

. . .

WHERE

[kondisi_update];

Description:
username: user name or schema name when logged in
nama_tabel: Name of the table contained in the user (schema) is
nama_kolom: Name of the column that will contain the data in [nama_tabel]
value: The value that will be filled in [nama_kolom]
kondisi_update: A condition that the filter (filter) which records all that will be updated
DELETE

Delete is used to delete data on a table in the user (schema) based on certain specific conditions. Delete syntax can be written as follows:

DELETE [nama_user].[nama_table]WHERE

[kondisi_delete];

Description:
username: user name or schema name when logged in
nama_tabel: Name of the table contained in the user (schema) is
kondisi_delete: A condition that the filter (filter) the records to be anywhere in the delete

Before reading the example below, a good idea to read the article first Create Table-Teaching and Learning System - (Analysis & Design). The article will help you to understand the examples given, because the tables used are based on case studies.

Insert:

INSERT INTO TEST.MURID (

NIS,
NAMA,
TGL_LAHIR,
JENIS_KELAMIN,
ALAMAT,
ORTU)

VALUES (

‘000001′,
‘MUKHTARUL UMAM’,
TO_DATE(‘23-04-1993′,‘DD-MM-YYYY’),
‘L’,
‘JL. P. DIPENOGORO, TEGAL’,
‘SULAIMAN’);

Update :


UPDATE TEST.MURID SET

NAMA = ‘MUKHTARUL UMAM SHOLEH’,
TGL_LAHIR = TO_DATE(‘25-04-1993′,‘DD-MM-YYYY’)

WHERE

NIS = ‘000001′;

Delete :


DELETE TEST.MURID

WHERE

NIS = ‘000001′;

NB:

* If you want to change the database kept by the end of each DML syntax to execute COMMIT;
* If you do not want to change the alias stored restored to the end with the execution of a ROLLBACK;
* Any DML syntax in COMMIT that it will not be in

0 comments:

Post a Comment