Join us in Las Vegas on June 13-16 for the Snowflake Summit

Learn More
datameer banner faq

How to INSERT values in a table using SELECT query in SQL?

  • How-Tos FAQs
  • December 16, 2018

This can be done in below:

INSERT INTO orders (ID, customer_name, order_date, total_orders)
SELECT ID, customer_name, order_date, total_orders
FROM orders
WHERE customer_name = 'Jack'

We replace VALUES statements using SELECT… FROM. The SELECT statement will support all the keys like a regular select query like WHERE, ORDER BY, GROUP BY, etc.

A Faster Way To Build Data Models

Mix SQL and no code to create data models in a few clicks vs months.

Try Datameer Today


Up Next:

Read How to insert the result of a stored procedure in a table in SQL?

More Resources We Think You Might Like

SQL FAQ Feat

How to return all information of a row with MAX...

Suppose we have a table “score” as below, and we need all information on a row with the maximum s...

  • How-Tos FAQs
  • December 16, 2018
SQL FAQ Feat

How to UPDATE a table with a SELECT statement i...

Let’s create two tables as below to demonstrate UPDATE from SELECT. CREATE TABLE orders (  ...

  • How-Tos FAQs
  • December 16, 2018
SQL FAQ Feat

How to insert the result of a stored procedure ...

Let’s create a simple stored procedure (SP) with a SELECT query. There are different ways to inse...

  • How-Tos FAQs
  • December 16, 2018