insert-select Questions

1

Solved

Here we have a certain table: CREATE TABLE mytbl ( id int PRIMARY KEY generated by default as identity, col1 int, col2 text, ... ); We need to copy part of the rows of the table and get i...
Dyer asked 20/6, 2023 at 22:24

5

Solved

I'm adding an 'index' column to a table in SQLite3 to allow the users to easily reorder the data, by renaming the old database and creating a new one in its place with the extra columns. The probl...
Purehearted asked 2/9, 2012 at 2:57

7

Solved

I have a query that inserts using a SELECT statement: INSERT INTO courses (name, location, gid) SELECT name, location, gid FROM courses WHERE cid = $cid Is it possible to only select "name...
Nerveless asked 22/3, 2011 at 12:38

5

Say you have a table: `item` With fields: `id` VARCHAR( 36 ) NOT NULL ,`order` BIGINT UNSIGNED NOT NULL And: Unique(`id`) And you call: INSERT INTO `item` ( `item`.`id`,`item`.`order` ) S...
Beggary asked 10/6, 2011 at 0:44

3

Have some tables: CREATE TABLE `asource` ( `id` int(10) unsigned NOT NULL DEFAULT '0' ); CREATE TABLE `adestination` ( `id` int(10) unsigned NOT NULL DEFAULT '0', `generated` tinyint(1) GENERA...
Linzy asked 5/2, 2016 at 18:25

1

I've read from this source that you can do an insert on dupcliate key ignore in postgres, but I cannot seem to get this to work for a select from: link What I've seen you can do is: insert into ...
Lipp asked 2/2, 2017 at 5:31

1

Solved

I'm having an issue with MySQL 5.6 InnoDb ignoring a NOT NULL foreign key when running an INSERT INTO xxx (col) SELECT .... The constraint is enforced properly when running insert statements in oth...
Abe asked 23/12, 2016 at 0:10

0

Hi I am using Spring Boot 1.3.5.RELEASE. I have a situation where I need to fire INSERT INTO someTable1 (col1, col2, col3) SELECT (10346, someTable2Id, 1048) FROM someTable2. I am using Sprin...

3

Solved

I have a SQL request that return some ora-01427 error: single-row subquery returns more than one row INSERT INTO my_table (value0, value1, value2, value3) VALUES((SELECT MAX(value0) FROM my...

2

Solved

I am new in using stored procedures. I have this query that gets values from tables. After that, I need to insert the result to another table. Here's my query: SELECT a.gender, b.purpose_abro...
Gregorio asked 17/12, 2013 at 8:58
1

© 2022 - 2024 — McMap. All rights reserved.