I have a table called 'LOGIN' with the following columns:
designation. I want the user to be added only by the head of that particular department to which the employee belongs. The employees in same dept will have the same id type like VBA2034, VBA2305 and so on.
I am addling what to and how to do it. I tried using like as below but its throwing an error. I searched for the INSERT command with WHERE clause and LIKE clause but didn't get exactly how to do it. Is it ok if I write the query like below.
INSERT INTO `login`(`username`, `password`, `dept_id`, `address`, `type`, `name`) VALUES ('VBA5013',123,'VBA','nehru vihar','customer executive','mr kuwara') where 'username' like 'VBA----' and 'dept_id' like 'VBA';
WHERE only applies to
INSERT creates a new record, using
WHERE doesn't make any sense if there's nothing yet.