Minggu, 31 Oktober 2010

Insert,Update, Delete in oracle

Standard operation of a database is to insert, delete and update. All three are commonly called DML stands for Data Manipulation Language. SQL is a standard language for database processing. Of course, any use Oracle-SQL, just that there are some characteristics that are different from standard SQL.

Once we started discussing the "Try-try" Oracle, then we have a user that is a separate user called TEST. Please you enter the page or go to the Oracle XE SQL + (if you install another version of the oracle, for example: 8i, 9i, 10g, and you also have to include the value 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 a user (schema) specific. 
Insert syntax can be written as follows:
INSERT INTO [nama_user].[nama_table]
([nama_kolom1], [nama_kolom2], . . .)
VALUES
([nilai1], [nilai2], . . .);
Keterangan :
nama_user
:
Nama user atau nama schema ketika login
nama_tabel
:
Nama tabel yang terdapat pada user (schema) tersebut
nama_kolom
:
Nama kolom yang akan diisi data pada [nama_tabel]
nilai
:
Nilai yang akan diisikan pada [nama_kolom], mis : [nilai1] akan diisikan ke dalam [nama_kolom1], [nilai2] akan diisikan ke dalam [nama_kolom2]
UPDATE
Update is used to change the data in a table in a user (schema) on the basis of certain specific conditions. SyntaxUpdate can be written as follows:
UPDATE [nama_user].[nama_table]SET
[nama_kolom1] = [nilai1],
[nama_kolom2] = [nilai2],
[nama_kolom3] = [nilai3],
. . .
WHERE
[kondisi_update];
Keterangan :
nama_user
:
Nama user atau nama schema ketika login
nama_tabel
:
Nama tabel yang terdapat pada user (schema) tersebut
nama_kolom
:
Nama kolom yang akan diisi data pada [nama_tabel]
nilai
:
Nilai yang akan diisikan pada [nama_kolom]
kondisi_update
:
Sebuah kondisi yang yang menyaring (filter) record-record mana saja yang akan di update
DELETE
Delete is used to erase data on a table in a user (schema) under certain specific conditions. SyntaxDelete can be written as follows:
DELETE [nama_user].[nama_table]WHERE
[kondisi_delete];
Keterangan :
nama_user
:
Nama user atau nama schema ketika login
nama_tabel
:
Nama tabel yang terdapat pada user (schema) tersebut
kondisi_delete
:
Sebuah kondisi yang yang menyaring (filter) record-record mana saja yang akan di delete
Before reading the example below, a good idea to first read the article 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 a database kept by the end of each DML syntax to execute COMMIT;
·        If companies do not want to keep the alias want restored then end with the execution ROLLBACK;

Diberdayakan oleh Blogger.

Blogger template by AdsenseBloggerTemplates | Original design by andrastudio

Powered by Blogger