Questions tagged [sql-insert]

The SQL INSERT statement allows you to insert a single or multiple rows into a table.

Filter by
Sorted by
Tagged with
-2 votes
0 answers
62 views

Upgraded from SQL Compatibility Level 100 to (anything Higher) - Broke 'Order By' Inserts with Identity Column [closed]

I have a Visual FoxPro Application that was Built for SQL 2008. We Upgraded the DB Compatibility level and some of the reports now no longer have the proper sorted order of the data in the tables for ...
scooter133's user avatar
  • 1,301
1 vote
2 answers
22 views

How can I copy, modify, records and then insert them back into the same table with a unique ID?

The "fruit" table has a column for unique IDs for each row, along with other columns. I need to copy some of the rows from "fruit", and insert it back into "fruit" with ...
BitsNBytes's user avatar
1 vote
2 answers
48 views

How to use jsonb_populate_record() to insert into a table containing an IDENTITY column

I demonstrate the issue with the following simple table. (The actual table and JSON document have a lot more fields.) CREATE table contact ( id bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, ...
sudoExclaimationExclaimation's user avatar
0 votes
1 answer
73 views

INSERT INTO / SELECT except if matching values in certain columns

I have: Table A - structure can not be modified: autokey | value1a | value2a | value3a | value4a Table B - no key: value1b | value2b | value3b | value4b Query: INSERT INTO TableA (value1a, value2a, ...
user1983916's user avatar
1 vote
2 answers
43 views

Can't insert data into Room Database

Hi guys i have a problem about inserting data to Database using Room i have try so many things, but it's not working, maybe you can help me out to solve this problem the problem is i want to insert ...
Dzy's user avatar
  • 47
0 votes
2 answers
18 views

Inserting JSON data into Postgresql from Jenkins pipeline

I'm trying to insert JSON data into my database from Jenkins pipeline, unfortunately I have problem with proper format. My query looks like that: def insertQuery = """ ...
Frendom's user avatar
  • 528
1 vote
2 answers
32 views

Jooq insert will loss after application exited(using h2 local embeded file)

The dsl context creation: private val resource = Thread.currentThread().contextClassLoader.getResource("mock-data.db")!! private val conn = DriverManager.getConnection("jdbc:...
kio v's user avatar
  • 51
1 vote
1 answer
92 views

Inserting and updating records at the same time

I have got the following Postgres table: create table test ( id serial, contract varchar, amount int, aggregated int, is_aggregate int ); insert into test (contract, amount, ...
Westcoaster's user avatar
0 votes
1 answer
39 views

Postgres Throwing invalid input syntax for a column that allows Null Values

I am trying to load data from a csv file into a postgres database using psycopg2 This is the table schema: Column | Type | Collation | Nullable | Default --------------...
rishabh baradia's user avatar
0 votes
1 answer
39 views

In this code i can't run operation to insert database in laravel , may anyone askme where is wrong in my code

the controller public function storeToDatabase(Request $request) { $params = $request->except('_token'); $user_id = auth()->user()->id; $product_id = $params['...
GempitaRizki's user avatar
-1 votes
2 answers
45 views

Is there a way to import a table of info from Excel to SQL database?

My employer wants me to create a database backup of contact information for parents (I work at a high school). I have my database with tables and all that sorted out. What I want to know is if there ...
Andries Gous's user avatar
0 votes
0 answers
4 views

problem; on inserting data gotten from my sign up into my database up form

I tried to insert my values into the the database using $sql = "Insert into subscribe(id , name, email) values ( null, '$name', '$email')" it did not work i tried to insert if(isset($_POST[...
Anyasor Cornelius's user avatar
0 votes
0 answers
16 views

Insert statements not working in Supabase when hosting Spring Boot API to Render

I am practicing Spring Boot REST API and PostgreSQL. I create a service to crawl data from a website each 30 min and save data into PostgreSQL. Everything locally is working okay for both local ...
Văn Thuận Nguyễn's user avatar
-2 votes
4 answers
53 views

SQL Query - Insert values from two columns in another table into one column

Can anyone please help me with an SQL query which will allow me to populate the real_name column in table 1 with values from both first_name and second_name columns in table 2 by referencing the ...
SH4's user avatar
  • 3
0 votes
1 answer
50 views

How can I reduce the time it takes to insert large amount of row into a postgres database table (100Mil rows) using the copy command COPY csv INTO db

I need to insert about 100 million rows of flat data into a Postgres database on a schedule with a frequency of 24 hours. I.e. every 24 hours, I have an ingestor that inserts data from CSV files in ...
Ashahmali's user avatar
  • 113
1 vote
1 answer
41 views

SQLite Trigger back to back invocation

I have these back to back triggers that I invoking in a SQLite database. I have a table called weight that I am using to calculate BMI, and NIH Health standards classification for the weight. This is ...
EnlightenedFunky's user avatar
2 votes
0 answers
93 views

How to improve SQL Server 'INSERT INTO' query runtime?

I have about 24 million rows of data which I need to insert into a table with a standardised format. My insert query is as follows: SELECT ... INTO TABLE2 FROM TABLE1 This is usually how I perform ...
Ethan Mark's user avatar
-3 votes
2 answers
77 views

Use variable in SQL query c#

How can I use variable in SQL query? For example: String n = "jack"; Int a = 23; Conn.open(); SQLcommand CMD (insert into table (name,age) values (n, a); CMD.executenonquery(); Is this code ...
gohar iranian's user avatar
0 votes
1 answer
28 views

SQLite replace string while inserting into table

I have a spreadsheet that contains a table in which a user can define a generic format for specific objects. For example, a small snippet of that spreadsheet can be seen below. Some cells within that ...
kubiej21's user avatar
  • 700
1 vote
3 answers
59 views

Postgres, Insert into many values with select

This is my first post here so please accept my apologies in advance if anything is out of place. I have table "Users", for each user there is a statement about whether he participates in ...
alyona's user avatar
  • 13
0 votes
2 answers
84 views

"tx.executeSql" Not Working Properly In Expo-sqlite-storage

I am adding a feature to my app that allows users to include recurring expenses. I am storing this information in a table, which is created using the following code: // Creating or opening a table to ...
jay shah's user avatar
0 votes
2 answers
54 views

How do I insert data into one table I created by referencing a column in another table I created in SQL?

I have created two tables, animation_companies and cartoon_characters. I am given a "document to simulate a request from a supervisor to insert information into a database I have created. The ...
dwightasaurus97's user avatar
0 votes
1 answer
34 views

How to reference a variable from an outer loop in an inner loop in PL/SQL?

I am trying to reference a value from a FOR LOOP that I've created with a SELECT statement, as a parameter in an INSERT statement within that FOR LOOP. More specifically, I am trying to use that ...
Basic Glitch's user avatar
0 votes
0 answers
11 views

Query insert into table it's error does not exist

This query, how come it throws an error when it's run? SQL Error: ORA-00942: table or view does not exist table or view does not exist insert into new_end_kontrak2_all_202308 select a.*, null, ...
DANIEL's user avatar
  • 1
0 votes
3 answers
62 views

Insert multiple rows conditionally

I need to insert multiple (hundreds) rows in a table and I don't want to insert each row by hand. There has to be a way to do this, right? The table looks like this: (SQL Server) id userFK appUserFK ...
naitunix's user avatar
-3 votes
2 answers
92 views

How do I design a trigger for Postgresql, and what is wrong with my "Hello world" test?

I need to use triggers in postgresql (preferably via SQLALchemy ORM). However, I can't seem to get to first base with creating one. As a basic test, I am trying to put the string "Hello world&...
Logos Masters's user avatar
1 vote
1 answer
39 views

ORA-00979 : Another not a GROUP BY expression

Probably a similar question have already been answered, but I couldn't find it. My query below throw an ORA-00979 error: begin DELETE FROM TMP_MY_CHART1; INSERT INTO TMP_MY_CHART1 ( SELECT ...
Tom Ang's user avatar
  • 31
-1 votes
1 answer
35 views

innodb missing auto-increment values [duplicate]

I am not experienced in this area. Can you tell me why autoincrement skips values? This is my table: CREATE TABLE `orders` ( `id` int NOT NULL AUTO_INCREMENT, `product_id` int NOT NULL, `...
beslana's user avatar
1 vote
2 answers
878 views

Drizzle ORM not support Insert Returning

I have a question while working with Drizzle ORM and MySQL. Currently, Drizzle ORM does not provide insert returning function for MySQL. Check this link. My website adds users to the database and ...
Mason's user avatar
  • 127
0 votes
0 answers
52 views

insert into sql database with unknown number of columns

I have a dataset that I have written into a dataframe and created a database that match the columns from the dataset - This is done. Lets call the database: test I then want to use insert into the ...
Basilico's user avatar
0 votes
2 answers
66 views

How to increase exporting row limit in datagrip postgresql

I am trying to export some rows from postgresql table in Datagrip in SQL-Insert-Multirow format. I managed to export 410k rows but when number was above 6 million rows Datagrip throws exception. Is ...
Mrnobody's user avatar
0 votes
1 answer
92 views

Dynamic Table name in BigQuery:

I am working with a live streaming data from GA4. GA4 creates a new table each day and dope the previous one, so i have only one day of data. I want to store a history of data so I need to create a ...
RM Baig's user avatar
0 votes
0 answers
40 views

How do i resolve the SQL syntax error at the end this query?

Novice SQL user here, trying to update an existing database. I am trying to update everything at once with the following query INSERT INTO `table` (`lots`, `of`, `keys`) VALUES ('Row', '1', 'data'), ('...
user3517167's user avatar
0 votes
1 answer
105 views

Why do I get ERROR 4078 (HY000): Illegal parameter data types int and row for operation '='?

I am using MariaDB 11.0.2 and my database contains two tables. One with a pretty normal primary key and a column for naming tests. CREATE TABLE `Tests` ( `Test_ID` int(11) NOT NULL AUTO_INCREMENT, ...
Centaro's user avatar
  • 23
0 votes
0 answers
19 views

Inserting information into 2 columns, but no rows are added and there are no errors?

I have a Sign up/Sign in setup which inserts the username and password entered by the user to be stored in MySql. but when inserted there are no rows? or nothing gets inserted? the columns remain ...
Mehrzad Tarahomi's user avatar
0 votes
1 answer
83 views

How to insert into MySQL? [duplicate]

guys. I learn java from few weeks and now i tried to insert my data from simple bank account application into MySQL table (the id and the name from the main class, and the balance and previous ...
Kostadin Samardjiev's user avatar
0 votes
1 answer
30 views

E22021: Character not in repertoire

I want to add an entry with the WebUI Prisma Studio to the database until i have set up a form to do so. The database is postgresql hosted at vercel and in version 15. The table i want to insert to is ...
marian's user avatar
  • 27
0 votes
1 answer
50 views

unable to use insert select command

I am not able to insert two columns from 2 different tables into a new table. Both the columns are primary keys and are referenced as foreign keys in the structure of the new table.they are not ...
aman saji's user avatar
0 votes
1 answer
32 views

Inserting Values in to a self-referencing Table in SQL

I have created a table with this T-SQL: CREATE TABLE Employee ( Mgrno VARCHAR(10), Empno VARCHAR(10) PRIMARY KEY NOT NULL, EmpName VARCHAR(50), Department VARCHAR(20), Email ...
Deblo's user avatar
  • 1
0 votes
2 answers
65 views

Calling executemany of mySQL.connector from python with a list of tuples created from a netcdf file using numpy transpose gives a distorted query

(Microsoft Surface Pro 7, Windows 11 Home, Python 3.10.1, MySQL 8.0.33) The goal: Load a netcdf-file with sizes up too about 400MB into the SQL-Database in under 15 minutes, the data in the necdf is ...
Rudolf Golubich's user avatar
1 vote
1 answer
76 views

How to make a SQLite Trigger convert a JSON array of objects into new records?

I try to make a Trigger in SQLite (BEFORE or AFTER INSERT) which takes this new row: ** events table ** id timeslots 1 [{start: 2023, end: 2024 }, { start: 2025, end: 2025 }, ...] and save it ...
charnould's user avatar
  • 2,480
1 vote
1 answer
23 views

MYSQL - TRIGGER combined with IF + INSERT INTO

everyone My code doesn't have primary key nor foreign key on purpose so I'm looking for a solution without adding that. My error is: Error Code: 1054. Unknown column 'cedula' in 'field list' The ...
Laura Castañeda's user avatar
0 votes
0 answers
20 views

How can I do INSERT to a dependency relation between 3 classes?

I have the mother class Boat and the two subclasses, sailing and motor. If it is a sail type, I have to know how many sails it has, if it is a motor, the power and if it is both a sail and a motor, ...
Math Enjoyer's user avatar
1 vote
1 answer
19 views

how to update value of "last_dt" col when using"UPDATE" or "INSERT IGNORE INTO ~ ON DUPLICATE KEY UPDATE ~" statement

The last_dt column is the last date the data was changed. It is managed differently from the inserted date. Inserted date is managed by create_dt. I want to change the update date value only when ...
younghyun's user avatar
  • 341
1 vote
2 answers
157 views

Postgres INSERT INTO autoincrement table with single column primary key

I am trying to auto increment a table with a single column which is a primary key, eg: CREATE TABLE my_table (id PRIMARY KEY NOT NULL); I would usually just not include the primary key column in the ...
Max888's user avatar
  • 3,163
0 votes
1 answer
83 views

How to Upsert item with unique index in Android Room?

I have JSON data in an API host like this "product": { "barcode": "2489752310342", "productName": "Trench coat", "priceList&...
oguzata's user avatar
  • 33
0 votes
1 answer
202 views

Split comma separated value and insert into new columns on each row

I have a table where one of the columns, fullname is a comma separated value. For example, one of columns has first_name, last_name. I need to add two new columns, firstname and lastname to the table ...
ahron's user avatar
  • 803
0 votes
1 answer
75 views

Insert spinner on function javascript

Insert spinner on function JavaScript. Hi everyone, I'm taking my first steps with JavaScript and I find myself unable to insert a spinner I wrote the following code, could you help me understand the ...
ESPI's user avatar
  • 3
0 votes
1 answer
80 views

How to insert values into a table using a SELECT subquery returning more than 1 value?

I am building a db with MySQL and would like to add several records at the same time, using a SELECT subquery to find values from a different table. This query inserts a track into the tbl_track and ...
Joao Cerca's user avatar
1 vote
2 answers
53 views

MySQL insert varchar value into int auto increment column

I noticed strange MySQL behaviour on projects staging server. Given: create table test_table ( id int auto_increment, name varchar(64) not null, constraint test_table_pk primary ...
Marius's user avatar
  • 25

1
2 3 4 5
102