Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. 17 lis 2010 · I want to add a row to a database table, but if a row exists with the same unique key I want to update the row. For example: INSERT INTO table_name (ID, NAME, AGE) VALUES(1, "A", 19); Let’s say the unique key is ID, and in my Database, there is a row with ID = 1.

  2. 11 kwi 2019 · I need to do and IF/THEN statement in mysql based on whether a value exists in a column. If it exists, I need to perform an update on the record and if it does not, then an error should be thrown. I want to check that the siteID actually exists. How can I add an "IF EXISTS" statement?

  3. 29 kwi 2015 · IF EXISTS (select * from users where username = 'something') THEN. update users set id= 'some' where username = 'something'; ELSE. insert into users (username) values ('something'); END IF; end $$. delimiter ; and call it like this: call select_or_insert();

  4. You can use the INSERT INTO …. ON DUPLICATE KEY UPDATE statement in MySQL to achieve this. This statement will insert a new row into the table, or if a duplicate key violation occurs (i.e., a row with the same primary or unique key exists), it will update the existing row with the new values. Here’s the SQL query:

  5. 27 sty 2024 · It works by attempting to insert a new row. If the insertion would result in a duplicate entry for a PRIMARY KEY or a UNIQUE index, MySQL updates the existing row instead. INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...) ON DUPLICATE KEY UPDATE column1 = value1, column2 = value2, ...;

  6. 22 gru 2022 · INSERT INTO schema_name.table_name(id, data) VALUES(1, '["3"]') ON DUPLICATE KEY UPDATE data= IF(JSON_CONTAINS(data,'3', '$'), JSON_ARRAY_APPEND(data, '$', '3'), data) It does not insert "3" into data, whether or not it's already present. It doesn't return an error.

  7. 23 cze 2013 · I am trying to UPDATE values from a table, but I need to add some conditions. I found the function CASE, but I am not if it is the best method. Here is an example.

  1. Ludzie szukają również