Insert into values SELECT FROM

0 votes
I'm attempting to INSERT INTO a table data from another table. Although many database engines allow this, I usually seem to have trouble remembering the exact syntax for the SQL engine of the day (MySQL, Oracle, SQL Server, Informix, and DB2).

Is there a silver-bullet syntax from a SQL standard (for example, SQL-92) that I could use to enter the values without having to worry about the underlying database?
Feb 22, 2022 in Database by Vaani
• 7,070 points
1,601 views

1 answer to this question.

0 votes

Try:

INSERT INTO tableA ( column_1 )
SELECT  col_1
FROM    tableB  

This is standard ANSI SQL and it should be working on any DBMS

answered Feb 23, 2022 by Neha
• 9,020 points

Related Questions In Database

0 votes
1 answer

How to insert date values into table?

You have to convert the literal to ...READ MORE

answered Feb 18, 2022 in Database by Vaani
• 7,070 points
3,125 views
0 votes
1 answer

My values in my codes aren't inserted into mySQL. I input 5 but it will show 0. Any ideas?

Hello, You can refer my corresponding sample web ...READ MORE

answered Jul 13, 2020 in Database by Niroj
• 82,880 points
954 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

MERGE INTO YourTable T USING ...READ MORE

answered Feb 3, 2022 in Database by Vaani
• 7,070 points
795 views
0 votes
0 answers

How do I UPDATE from a SELECT in SQL Server?

INSERT INTO Table (col1, col2, col3) SELECT col1, ...READ MORE

Feb 4, 2022 in Database by Vaani
• 7,070 points
519 views
0 votes
1 answer

Excel - Create item list from table values

What is Data Validation, and how does ...READ MORE

answered Apr 11, 2022 in Database by gaurav
• 23,260 points
2,025 views
0 votes
0 answers

Displaying ALL data from sqlite database into listview in tabbed activity

I've been struggling with this problem for ...READ MORE

Aug 20, 2022 in Database by Kithuzzz
• 38,020 points
3,085 views
0 votes
0 answers

How to Return Multiple Values from CASE clause in Where Condition

I have a condition where utilizing the ...READ MORE

Aug 25, 2022 in Database by Kithuzzz
• 38,020 points
2,088 views
0 votes
0 answers

Display data from SQL database into php/ html table.

I want to display one of my ...READ MORE

Aug 27, 2022 in Database by Kithuzzz
• 38,020 points
806 views
0 votes
2 answers

Case in Select Statement

I think these could be helpful for ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
693 views
0 votes
1 answer

Ordering by the order of values in a SQL IN() clause

Use MySQL's FIELD() function: SELECT name, description, ... FROM ... WHERE id ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
5,214 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP