5,900 questions
0
votes
1
answer
70
views
Snowflake: SQL equivalent of INSERT INTO table BY NAME
The goal is to simulate SQL INSERT BY NAME behavior in Snowflake
Using the BY NAME modifier, the names of the column list of the SELECT statement are matched against the column names of the table to ...
-4
votes
1
answer
87
views
How do I retrieve the primary key of the updated record?
I have this insert query for my MariaDB 10.6.19 database:
CREATE TABLE manufacturers (
manufacturers_id int(11) NOT NULL AUTO_INCREMENT key,
manufacturers_name varchar(32) unique NOT NULL,
...
0
votes
0
answers
87
views
If a record already exists, update current record and insert new record [duplicate]
If a value already exists in a table, how do I update the current record and add the new record as a new row?
This is the current upsert query:
UPDATE d
SET d.[AccountId] = S.[Account_Number],
...
2
votes
2
answers
105
views
Proper way to locate the position of a single newly inserted row based on order by clause immediately after insert?
After inserting a single row of data into a table (always a single row), I'd like to return to the application code the relative position of that row based on an order by clause. Thus, the application ...
-1
votes
2
answers
140
views
Insert or Update - Understanding difference between SQL statements [duplicate]
We have a database utility in our product suite that handles both the creation of new databases and the upgrade of existing ones.
For new tenants or customers, the creation flow is executed.
For ...
1
vote
0
answers
57
views
Extremely slow DB insert using Turbodbc
I have built Turbodbc 5.1.2 from source with simdutf 7.3.0, Python 3.11. When trying to insert 150,000 rows of 46 columns to a MySQL 8.0 InnoDB table, Turbodb takes about 190s, compared to 15s with my ...
-1
votes
1
answer
76
views
SQL insert from select changing two columns [closed]
I'm not a SQL expert. I'm trying to make a insert from a select, but I would like to change two columns using the data from a temporary table.
I'm trying to reuse the data from an existing register ...
1
vote
1
answer
110
views
Apache Doris INSERT INTO ... SELECT ... query is unexpectedly slow - how to troubleshoot?
I am experiencing performance issues with an
INSERT INTO target_table
SELECT ...
FROM source_table
[WHERE ...]
[GROUP BY ...]
query in my Apache Doris cluster (version 2.0.8).
The SELECT part of the ...
0
votes
2
answers
126
views
Prevent Violation of Unique Index with Multiple Concurrent Inserts
I'm using a Postgres 9.5 database with a front of Spring Boot.
On the database end I have an event_attendee table that users can insert attendees into. In the table there is a unique index on ...
-3
votes
1
answer
53
views
error 1046 in subquery inserting data from specific columns to another table [closed]
I am trying to copy a few fields of video information from one MariaDB table to another using a subquery, decoupling some video info from a classified ads table for later refactoring.
video:
id (int ...
0
votes
1
answer
82
views
I am struggling with parameters in VB.net when building the Insert Into SQL statement
The parameters within the Using block don't seem to align. My suspicion is the primary key is at fault, but I am using Scope_Identity.
If String.IsNullOrEmpty(InvoiceID_TextBox.Text) Then
Using ...
-4
votes
1
answer
61
views
INSERT multiple rows from SELECT returns error "This is not permitted" [closed]
I have two tables of same structure and want to insert rows from tableA into tableB.
The following example works fine:
INSERT INTO tableA (uniqueColA, colB, colC)
SELECT uniqueColA, colB, colC ...
0
votes
1
answer
96
views
Convert JavaScript Array to SQL Multirow Values List
Trying to load a JavaScript array into a SQL Server table. I convert the array to a string, however, its format does not immediately translate into something (I know of) to use as separate records to ...
-1
votes
2
answers
82
views
Sqlite3, how to make an INSERT statement inside a SELECT query?
I want to do, in exactly one sqlite3 query, an operation that :
Checks for the existence of a value in my table (call it V), written in a row indexed by A
If V exists and is equal to V_Param (...
0
votes
1
answer
93
views
Mysql rowcount always returns 1 on INSERT IGNORE statement
I am using pymysql connector to do some inserts into my database. I am trying to return whether or not a record was added or updated.
My code is
import pymysql
db = pymysql.connect(host='127.0.0.1',...