I am trying to insert rows into a table using string_split command. It works fine if there are no duplicates. However, if there are duplicates, it errors out. I would like to know how to modify the …
Tag: sql-insert
How to insert a random integer number, for a given column and several rows
I was wondering.. Is it possible, with a SQL query, to: generate randomly, a list of integer number insert this in a table, for a specific column, and for multiple rows I didn’t try anything, to be …
MySQL INSERT inserting BIT to 1 instead of 0
I have the following query which should insert a 0 but instead inserts 1. It is executed with prepared statements in PHP: All inserts are performed fine, except a 1 is inserted in column6 instead of a 0. Column 6 has the datatype BIT. The query works fine, however, when executing directly in the phpmyadmin ‘MySQL’ tab. What am I
Sql arithmetic overflow
I have this query: Insert into Course(name,age,id,facebookuser) Values(‘Example’,25,204813,blalbla@walla.com), (‘Exmnumtwo’,35,504813,email@walla.com) Which gives me the error 8115: “arithmetic …
INSERT INTO with use CASE – sqlite?
I have a problem with syntax. I need use IF in sqlite, and I replace IF – CASE. My statement doesn’t work, I don’t know, what is wrong? Answer Assuming the default for aNew is NULL: Otherwise you’ll need to put that logic in your application code.
SELECT DISTINCT values and INSERT INTO table
I want to take a column with values that repeat multiple times and get that value only once and store it for later use, but at the same time I would like to get another value in the same row as that distinct column. A, B, C represent three columns. Ignore C for now. My question is: How can I
Change values before insert into table / PostgreSQL
Ive got the following problem. I want to change some values of INSERT statement, e.g. there’s a query: INSERT INTO table(a,b) values(x,y); But table has also another column c. I want to check (…
Number of similar columns occurrences
I am new to SQL SERVER and need your advise on something. I have a big table with stores information. Here is bench_id column: **bench_id** 31 51 51 61 61 61 71 71 I have created another small table …
What’s the fastest way to do a bulk insert into Postgres?
I need to programmatically insert tens of millions of records into a Postgres database. Presently, I’m executing thousands of insert statements in a single query. Is there a better way to do this, some bulk insert statement I do not know about? Answer PostgreSQL has a guide on how to best populate a database initially, and they suggest using the