create table employees(
emp_id INT PRIMARY KEY AUTO_INCREMENT,
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
desig VARCHAR(50) NOT NULL DEFAULT 'Probation',
dept VARCHAR(50) NOT NULL
);
INSERT into employees (emp_id,fname,lname,desig,dept) VALUES (101,'Raju','DWIVEDI','Manager','Loan');
INSERT into employees (fname,lname,desig,dept) VALUES ('Sham','SUNDAR','Cashier','Cash');
INSERT into employees (fname,lname,desig,dept) VALUES ('Paul','TIWARI','Asscociate','Loan');
INSERT into employees (fname,lname,desig,dept) VALUES ('Alex','MISHRA','Accountant','Loan');
INSERT into employees (fname,lname,desig,dept) VALUES ('Victor','TRIPATHI','Asscociate','Deposit');
ALTER TABLE employees ADD Column salary INT Not NULL Default 25000;
#UPDATE employees set salary = 12000 where emp_id =102;
UPDATE employees
SET salary = CASE
WHEN emp_id = 101 THEN 15000
WHEN emp_id = 102 THEN 12000
WHEN emp_id = 103 THEN 18000
WHEN emp_id = 104 THEN 14000
WHEN emp_id = 105 THEN 16000
ELSE salary -- Keep the salary unchanged for other employees
END;
select count(*) from employees; #This counts the total number of rows in the employees table
show tables;
select count(*) from employees;
select count(fname) from employees;
#no of diffrent department from employees
select count(DISTINCT(dept)) from employees;
#total number of maangers
select count(emp_id) from employees where desig = 'manager'; #This counts only the rows where the desig is 'Manager'
To embed this project on your website, copy the following code and paste it into your website's HTML: