5,153
questions
1
vote
0
answers
9
views
How to implement SCD2 type table from partitioned table Postgresql/Clickhouse?
I have usual partitioned by ds - Date column table with many features.
Not, all columns change every day, therefore most rows are just duplicated of the previous rows.
I want to implement SCD2 table ...
2
votes
1
answer
53
views
Postgres Permissions violated by before-insert trigger function
I've got a table with row level permissions enabled. I've got an insert policy for my user, and I've granted permissions for them on specific columns. I added a new column to track the id of whoever ...
4
votes
2
answers
101
views
Create rows of data into table that do not have a specific column value
I have a table that has missing information that needs to be inserted with very specific conditions. However, I am unsure on how to proceed.
I have one table that contains an overall view of ...
0
votes
2
answers
66
views
Insert a column that depends from the previous row already inserted
I have a table in PL/SQL called TABLE_1 with five columns like this:
I want to create a new table TABLE_2, which has the same data but adding a new column c5 like the following:
The column c5 has ...
0
votes
1
answer
75
views
INSERT INTO SQL Server table errors: The supplied value is not a valid instance of data type float [duplicate]
I have a Pandas df I created from reading an email attachment. When inserting into a SQL Server table I see the following error for Parameter 6 which is Call Length column:
Parameter 6 (""):...
1
vote
3
answers
82
views
Insert sql but all rows have the same id (no unique constraint)
I'm trying to make an insert where the first row is the default item and the other rows are the variants with different language (making a primary key with id and locale) and I was thinking on ...
0
votes
1
answer
21
views
Spark InsertInto Slow Renaming in AWS S3
When using insertInto in AWS s3, the data is initially written to the .spark-staging folder and then moved (fake renaming) to the actual location in batches of 10 files at a time. Moving staging data ...
0
votes
1
answer
66
views
How to Use a Single INSERT INTO Statement for Multiple Rows in Python?
I’m currently working on a Discord Python bot where I loop through a list of ForumTags and generate an INSERT INTO SQL statement for each object to insert data into a MySQL database.
However, I want ...
0
votes
0
answers
50
views
Powershell array of strings into single SQL column
I've this array of strings:
$qLastSS_T
2024-07-08 11:56:32
2024-08-08 12:56:32
2024-09-08 13:56:32
2024-10-08 13:56:32
2024-11-08 15:56:32
2024-12-08 16:56:32
and a SQL table like this:
Is it ...
0
votes
1
answer
93
views
"ambiguous column name" error from AFTER INSERT trigger
In DBeaver version 23.3.4.202402060628 I have the following SQLite3 code (for a high speed injection moulded part and package tracking machine in a factory):
-------------------------------------------...
0
votes
1
answer
48
views
SQL - insert rows preserving overall number of duplicate values
I have a table, say, Product (Id, Name):
Id
Name
1
'one'
2
'two'
3
'three'
I have a new version of data that is needed to update the table, with possible duplicate values.
For example:
Name
'...
-1
votes
1
answer
53
views
I am trying to figure out why my INSERT INTO code does not accept my Function(rental_string)
The function alone seems to be working. pgAdmin gave me the thumbs up on it, as well as the table. I tried many different ways to type the function and INSERT INTO portion. I have been working on this ...
-1
votes
1
answer
57
views
Insert with values from existing table
I need to move some values based on expiration date, but unfortunately because the tables are not one to one in number of records I receive an error message when my query is run. I need SQL to be able ...
0
votes
1
answer
47
views
Why is Teradata so slow to INSERT decimals and CLOBs with .NET?
I have code that's trying to load data in batch through the Teradata .Net provider. I'm using the TdDataAdapter approach as follows:
using (TdDataAdapter adapter = new TdDataAdapter())
{
...
1
vote
0
answers
23
views
Does it make a difference if a CTE comes before or after an insert?
insert statements in postgres can use CTEs ("with" expressions). These can come either before or after the insert itself. Is there any difference between one style vs the other?
For example, ...
0
votes
1
answer
65
views
INSERT INTO SELECT subquery that uses a udf so that it returns 1 value
I'm attempting to create a new table but altering some of the data from my old table using a INSERT INTO SELECT statement. I'm trying to take a field with numbers and letters and pull out the numbers ...
-1
votes
2
answers
71
views
How to use try-catch in trigger
I want to prevent inserting data into a table and return 'Error' if 'OrderDate' column is greater than '2021-01-01'. How can I do this by the use of TRIGGER and TRY...CATCH in sql-server v.2019
...
1
vote
1
answer
47
views
PostgreSQL - How to INSERT with shared values in a specific column
I am creating an Exam Management System database.
I have a table called Questions:
q_id (pk)
q_text
1
What is the name of our galaxy?
2
What planet do we live on?
And a second table called Choices:...
0
votes
0
answers
351
views
Drizzle ORM: how to add data to two tables with many-to-many relations
I want to insert data according to the following codes to the two tables named as productTable and discountCodeTable in the following way. These two tables have a many to many relationship and are ...
0
votes
1
answer
15
views
INSERT INTO with validated (limited) values
I think this is rather trivial, but I lost the way ..
SQL, Oracle 11 - a simple statement:
INSERT INTO NEW_TABLE (A, B, NEW_LENGTH)
SELECT
A, B, OLD_LENGTH
FROM
...
0
votes
0
answers
28
views
Update source SQL Server table with data from another table [duplicate]
How can I update a source SQL Server table with data from another table if the data is not a one-to-one relationship?
For example, the target table - in which the data needs to be entered into, looks ...
0
votes
1
answer
71
views
I want to insert data to a column from its own table data?
I have a table called T1.
I have to insert data into new column Change of T1's table.
Change column values will be difference of columns open and close (close-open).
Datetime
open
Close
Change
14-03-...
0
votes
1
answer
65
views
Insert into table or table var gives the wrong conversion error when inserting an int into an nvarchar column
When executing the following code in SQL Server Express 2019 (v15.0.2110), I get an error telling me that the insert fails due to SQL Server's inability to cast my NChar string into an int, where the ...
2
votes
1
answer
88
views
Oracle takes a very long time to insert rows
I have installed Oracle 23c Free in a Docker image. One of the new features is that you can insert multiple values in a single statement, just like all the other DBMSs.
I tested this by adding about ...
0
votes
2
answers
383
views
SQLite Insert or replace AND On Conflict Do Nothing
I am working on a database that will be populated using a Python script that reads data from a Excel file and then executes SQLite Queries. The data in the Excel file will be updated regularly and in ...
0
votes
2
answers
126
views
mysql: insert sql was committed but data is not visible immediately
I use MWAA to run my SQL jobs, which are executed on RDS MySQL Community. For example, I start with job 'A', and once it's completed, I proceed to run job 'B'.
In job 'A', I use insert SQL to insert ...
0
votes
0
answers
34
views
Trouble in Insert MySql Workbench
Only createAt, updateAt and the registration ID are inserted - the 'email' and 'password' fields are empty, giving insert in the other fields and not in the two:
Executing (default): INSERT INTO '...
0
votes
0
answers
54
views
Export number fields without quotation marks on SQL Developer
I am using Oracle SQL Developer 20.2.0.175.
I have the table X with a numeric and a VARCHAR column.
X_IDIOMA NUMBER(2) NOT NULL
X_DESC_CORTA VARCHAR2(6 CHAR)
I do select * from x;. Then, I ...
0
votes
1
answer
34
views
Postgres - Data insertion into a table - Wrong Visualization
I want to insert a subset of values into a table, called "Regions", made by just two column, "ID_Region" and "Region"
So, I've written this piece of code:
INSERT INTO ...
0
votes
1
answer
50
views
Copy table to another table with an extra column at the start
In the past, I have successfully copied tables from one to other like this:
INSERT INTO myhistory SELECT p.*, NOW(), '' FROM mymain p
Here, the extra columns were at the end. However, I now have a ...
0
votes
0
answers
19
views
How to match info from another tab column and insert Main tab column
Excel - How to insert document number from another tab.
No similar ID criteria on both tab. can match by title document column
Main tab - empty document number column, and title document column(600 ...
1
vote
1
answer
30
views
Query Across Servers in PostgreSQL
Is is possible to query across servers in PostgreSQL? For example, by using an INSERT INTO query to insert table data from a table in one server to another? If so, would the query look roughly like ...
0
votes
0
answers
66
views
SQLite - how to INSERT nested json data into related tables
In SQLite, I want to insert the following json data into two related tables, form (parent) and waterIntake (child), connected through the foreign key 'currentDate' in waterIntake that references the ...
0
votes
0
answers
68
views
Converting non-numeric entries as NULL
I am trying to move all the data from one column in an Excel sheet into a SQL Server database table using SQL Server Management Studio. The data in the table covers different OS versions by year, and ...
1
vote
1
answer
85
views
Insert Fails with Auto-Incrementing ID (Cannot insert value null into column 'id')
I'm encountering an "insert fails" error when trying to create new gig records. The error message is:
Cannot insert value null into column 'id', table 'GigHub.dbo.Gigs';
column does not ...
-1
votes
1
answer
51
views
SQL syntax help for arbitrage calculator
So I am somewhat new to SQL, and i am trying to get data that i imported from a script to be manipulated in a way that's readable for a arbitrage bot.
here is what i have so far:
Image of database ...
0
votes
2
answers
73
views
Can't connect to the right DataSource in Spring Tool Suite
I'm trying to run a Post Method to INSERT into a SQL database, but no matter what I do it connects to the wrong datasource. This is my application.yml:
server:
port: 9091
spring:
application:
...
0
votes
1
answer
234
views
I am using PostgreSQL. I am facing an error while inserting values in columns, everything is correct all column names, case sensitive, values
I am learning SQL, here while entering values into the customer table with five columns CustID, CustName, Age, City, Salary. I am entering everything correctly, and case sensitive, but I still get an ...
-1
votes
1
answer
54
views
How to insert values for the second time in a particular column in mysql?
I am trying to put values in a particular column with the help of insert into but I get some error, and when I am using "insert ignore into", then in output an extra observation in created ...
0
votes
2
answers
51
views
MYSQL - Using MAX or COUNT in SELECT for INSERT and Have MAX/COUNT change for each INSERT
I am using the sample Northwind DB and would like to INSERT a new product for every discontinued product and renaming the new product with an appended '_v2'. Problem is I would like to specify a new ...
0
votes
0
answers
19
views
Insert Statement w/ sub-query that has multiple records [duplicate]
How can use a sub-query with an insert statement?
Example:
INSERT INTO SCHOOLCARD (SchoolCardID, ScheduleID, Course1, Course2, Course3, ScheduleNote)
VALUES (LOWER(NEWID()),
(SELECT ScheduleID ...
1
vote
0
answers
31
views
Adding a different string to a table fails [duplicate]
When creating a Table type with a single string column and trying to INSERT 2 differents strings make it fails.
First, I created a new Table Type with a single string column:
CREATE TYPE [dbo].[...
0
votes
1
answer
74
views
Spring Boot JPA (HSQLDB): INSERT using SELECT from data.sql, unexpected token: SELECT
I have this class:
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "SECURITY_AUTHORITIES")
public class SecurityAuthority implements GrantedAuthority {
@Serial
private ...
0
votes
0
answers
23
views
value for insert on a procedure call is taken as column name generating an error that reports such column doesn't exist
I'm pretty sure I'm missing something simple here (hopefully) but I can't figure out what it is so any help will be very much appreciated.
I have the following procedure
CREATE OR REPLACE PROCEDURE ...
0
votes
0
answers
31
views
MySQL Workbench gives duplicate warnings when there should not be any
I have two databases: txdb and rhdb. I am trying to combine PARCEL and WATERID from txdb.event and insert it into rhdb.orders. However, MySQL Workbench shows me this warning:
358 row(s) affected, 52 ...
1
vote
0
answers
56
views
MySQL: Inserting datetime value (including timezone) results in wrong column value
Since I couldn't find a similar thread, here's my issue.
My table "test_table" consists of a datetime column "timestamp_column".
The MySQL server is configured to run in timezone ...
1
vote
2
answers
142
views
How do I create a SQLite trigger to automatically calculate columns after INSERT?
This question follows on from my previous question here, which I have a working answer to:
How do I create a PostgreSQL TRIGGER to automatically calculate columns after INSERT?
but now I need to do ...
0
votes
1
answer
2k
views
How can I 'tell' PostgreSQL what the timestamp format is when I INSERT a text string that represents a timestamp into a table?
NOTE: There are a few other questions that are very similar to this and which deal with the same kind of issues, but I really felt they did not articulate it well enough for me. So I am asking this ...
0
votes
1
answer
34
views
BigQuery - Transaction rows double when Insert Into and Left Outer Join statement used
I'm trying to update 5 columns in a table with last year values by doing a left outer join on same table. And then I'm updating a 'Text' column in it. I'm using the below code but it is doubling the ...
0
votes
0
answers
20
views
I get an error with my INSERT for no apparent reason [duplicate]
I wrote this INSERT with multiple rows:
INSERT INTO WAREHOUSES (WAREHOUSE_ID, LOCATION)
VALUES (10, "Aguascalientes, Aguascalientes"),
(20, "Mexicali, Baja California"),
...