Apache Derby provides DML statements to perform Insert, Update, Delete operations.

Some DML commands supported by Apache Derby are mentioned below.

  1. Insert Table
  2. Update Table
  3. Delete Table
  4. Select Table

1. Insert Table

We can use the Delete command to delete the existing records from a table. If we mention a where clause then it will delete a particular row.

Syntax:
ij> INSERT INTO table-Name
    [ (Simple-column-Name [ , Simple-column-Name]* ) ]
      Query

To perform the Insert operation we have created a table named “EMP” in which we will insert data using the Insert statement.

Command:
ij> INSERT  INTO EMP VALUES(101,'Kusko','Marketing');
ij> INSERT  INTO EMP VALUES(102,'Figeroa','Executive');
ij> INSERT  INTO EMP VALUES(103,'Corrio','Finance');
ij> INSERT  INTO EMP VALUES(104,'Vocelka','IT');
ij> INSERT  INTO EMP VALUES(105,'Stenseth','HR');
ij> INSERT  INTO EMP VALUES(106,'Glick','HR');
ij> INSERT  INTO EMP VALUES(107,'Sergi','Marketing');
ij> INSERT  INTO EMP VALUES(108,'Shinko','Finance');
ij> INSERT  INTO EMP VALUES(109,'Stockham','Executive');
ij> INSERT  INTO EMP VALUES(110,'Ostrosky','HR');

Output:
insert derby

insert derby


2. Update Table

We can use an Update statement to change the existing records.

Syntax:
ij> UPDATE table-Name
        SET column-Name = Value
        [ , column-Name = Value} ]*
        [WHERE clause] | UPDATE table-Name
        SET column-Name = Value
        [ , column-Name = Value ]*
        WHERE CURRENT OF

Using the Update statement we will update “dept name” and make it “IT” where “empid” is 106.

Command:
ij> UPDATE EMP SET DEPTNAME=’IT’ where EMPID=106;

Output:
update derby


3. Delete Table

Delete statement is used to delete all rows from a table. If we mention a where clause then it will delete a particular row.

Syntax:
ij> DELETE FROM table-Name
        [WHERE clause] |DELETE FROM table-Name WHERE CURRENT OF

Command:
ij> DELETE FROM EMP WHERE EMPID= 110;

Output:
delete derby


4. Select Table

The select statement is used to show the content of a table.

Syntax:
ij> SELECT column_name, column_name, .. * FROM table_name;

Command:
ij> SELECT * from EMP;

Output:
select derby