EX:2 Data Manipulation Language (DML)
Aim: To create and manage tables using DML commands like insert, update, delete,
and select.
Procedure:
1. Open Command Prompt and connect to the Oracle database using the
command: sqlplus / as sysdba;
2. Create a table named employee with attributes empid, empname, designation
and salary.
3. Insert records into the table employee.
4. Use update command to make changes to the table employee
Eg: UPDATE employee SET salary = 55000 WHERE empid = 101;
5. Use delete command to remove the records or rows from the table.
6. Display the table using the SELECT command to view the changes in the table.
7. Exit
OUTPUT:
SQL> CREATE TABLE employee (empid NUMBER(5), empname VARCHAR2(50),
designation VARCHAR2(30), salary NUMBER(10,2));
Table Created
SQL> INSERT INTO employee VALUES (101, 'Rahul', 'Manager', 50000);
1 row inserted
SQL> INSERT INTO employee VALUES (102, 'Anita', 'Developer', 35000);
1 row inserted
SQL> INSERT INTO employee VALUES (103, 'Karthik', 'Analyst', 40000);
1 row inserted
SQL> UPDATE employee SET salary = 55000 WHERE empid = 101;
SQL> UPDATE employee SET designation = 'Senior Developer WHERE empid = 102;
SQL> DELETE FROM employee WHERE empid = 103;
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM employee;
Result:
Thus the DML commands were executed successfully.