lab2
1-- Create the Employee table
CREATE TABLE Employee (
EMPNO INT,
ENAME VARCHAR(50),
JOB VARCHAR(50),
MGR INT,
SAL DECIMAL(10,2)
);
-- Add a new column 'commission' to the Employee table
ALTER TABLE Employee
ADD COMMISSION DECIMAL(10,2);
DBMS Manual
Dept. of CSE, RNSIT Page 3
2 -- Insert five records into the Employee table
INSERT INTO Employee (EMPNO, ENAME, JOB, MGR, SAL, COMMISSION)
VALUES
(101, 'John Doe', 'Manager', NULL, 50000.00, 2000.00),
(102, 'Jane Smith', 'Developer', 101, 40000.00, 1500.00),
(103, 'Michael Johnson', 'Salesperson', 101, 30000.00, NULL),
(104, 'Emily Brown', 'Analyst', 102, 45000.00, 2500.00),
(105, 'David Lee', 'Intern', 102, 25000.00, NULL);
3 -- Update the job details for a specific employee
UPDATE Employee
SET JOB = 'Senior Developer'
WHERE EMPNO = 102;
4 ALTER TABLE Employee
RENAME COLUMN Employ TO Employee;
5 -- Delete the employee whose Empno is 105
DELETE FROM Employee
WHERE EMPNO = 105;
Comments
Post a Comment