01 SQL DML Operations On MY - EMPLOYEE Table
01 SQL DML Operations On MY - EMPLOYEE Table
AIM:
ALGORITHM:
STEP-1: Start
Santhoshkumar S 1
2
STEP-6: Populate the next two rows of data from the sample data
Concatenate the first letter of the first_name with the first seven
characters of the last_name to produce Userid:
INSERT INTO MY_EMPLOYEE (ID, Last_name, First_name, Userid,
Salary)
VALUES (3, 'Biri', 'Ben', SUBSTR('Ben', 1, 1) ||
SUBSTR('Biri', 1, 7), 1100);
INSERT INTO MY_EMPLOYEE (ID, Last_name, First_name, Userid,
Salary)
VALUES (4, 'Newman', 'Chad', SUBSTR('Chad', 1, 1) ||
SUBSTR('Newman', 1, 7), 750);
Santhoshkumar S 2
3
STEP-11: Change the salary to 1000 for all the employees with a salary
less than 900
UPDATE MY_EMPLOYEE SET Salary = 1000 WHERE Salary < 900;
STEP-12: Exit
Santhoshkumar S 3
4
EXERCISE
1. Create MY_EMPLOYEE table with the following structure:
Command:
CREATE TABLE MY_EMPLOYEE (
ID NUMBER(4) NOT NULL,
Last_name VARCHAR2(25),
First_name VARCHAR2(25),
Userid VARCHAR2(25),
Salary NUMBER(9,2)
);
Output:
Table created.
Santhoshkumar S 4
5
Santhoshkumar S 5
6
5. Populate the next two rows of data from the sample data. Concatenate the first letter
of the first_name with the first seven characters of the last_name to produce Userid:
Command:
INSERT INTO MY_EMPLOYEE (ID, Last_name, First_name, Userid, Salary)
VALUES (3, 'Biri', 'Ben', SUBSTR('Ben', 1, 1) || SUBSTR('Biri', 1, 7), 1100);
Santhoshkumar S 6
7
10. Change the salary to 1000 for all the employees with a salary less than 900:
Command:
UPDATE MY_EMPLOYEE SET Salary = 1000 WHERE Salary < 900;
Output:
2 rows updated.
Santhoshkumar S 7