This doesn\'t work:
INSERT INTO users (username, password) VALUES (\"Jack\",\"123\") WHERE id=\'1\';
Any ideas how to narrow insertion to a
UPDATE users SET username='&username', password='&password' where id='&id'
This query will ask you to enter the username,password and id dynamically
A conditional insert for use typically in a MySQL script would be:
insert into t1(col1,col2,col3,...)
select val1,val2,val3,...
from dual
where [conditional predicate];
You need to use dummy table dual.
In this example, only the second insert-statement will actually insert data into the table:
create table t1(col1 int);
insert into t1(col1) select 1 from dual where 1=0;
insert into t1(col1) select 2 from dual where 1=1;
select * from t1;
+------+
| col1 |
+------+
| 2 |
+------+
1 row in set (0.00 sec)