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. 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.

  3. 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?

  4. 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();

  5. 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:

  6. 27 sty 2024 · In simple terms, UPSERT is the process of inserting a new record into a MySQL database table if the record does not exist or updating the existing record if it does. This operation is commonly required when you want to ensure that your dataset remains unique while still being able to update records as necessary.

  7. mysqli_query($con,"IF EXISTS (SELECT * FROM subs WHERE subs_email='$email') UPDATE subs SET subs_name='$name', subs_birthday='$birthday' WHERE subs_email='$email' ELSE INSERT INTO subs (subs_name, subs_email, subs_birthday) VALUES ('$name', '$email', '$birthday')"); mysqli_close($con);

  1. Ludzie szukają również