Skip to content

Tag: sql-insert

SQL concatenate – INSERT MANY VALUES TO ONE ROW

I’m currently trying to add 3 rows in to 1 row so that the information is separated by a ‘,’like using a concatenation. However, I’m new to this and any help will be useful. Below is my current code and what I have tried. This code below does not work: I have also tried this code below…

Update row if exists or insert

I’m working on a web based PHP form that’s currently connect to an Oracle database. I’m trying to get the functionality working so that after a user submits the form it’ll check if a row exists based on the Job Number, if it does then update, otherwise insert the values. It’s bri…

inserting into table with conditions

SQL. i have two tables residents (primary key rid) and dependents (primary key did). dependents is connected to residents through rid. I want to insert rows into dependents table only if the rid in the insert statement matches with any of the rid in the residents table. i tried the code below, but there is so…

How do I update if exist, else insert in MySQL

I have table with AUTO_INCREMENT field defined as PRIMARY_KEY. I have columns like: vote_id,vote_user_id,vote_ask_id,vote_comment_id,vote_post_id,vote_type,vote_status I want to INSERT new records but before I do that I want to check if there is a row with columns(vote_user_id,vote_ask_id,vote_type) as same a…