Search
 
SCRIPT & CODE EXAMPLE
 

SQL

insert a select statement into a table

--format
INSERT INTO Customers (CustomerName, City, Country)
SELECT SupplierName, City, Country FROM Suppliers;

--examples
INSERT INTO Customers (CustomerName, City, Country)
SELECT SupplierName, City, Country FROM Suppliers;
Comment

SQL INSERT INTO SELECT Statement

INSERT INTO user_profile (
    name, 
    client_id, 
    email_id,
    mobile,
    create_date,
    last_modified
)
SELECT 
    name, 
    client_id, 
    email_id,
    mobile,
    now(),
    now()
FROM 
    user_profile
WHERE 
    id = 106
Comment

sql server insert into select

INSERT INTO sales.addresses (street, city, state, zip_code) 
SELECT
    street,
    city,
    state,
    zip_code
FROM
    sales.customers
ORDER BY
    first_name,
    last_name; 
Comment

insert into values select

INSERT INTO my_table SELECT * FROM source_table;
INSERT INTO my_table (a, b, c) SELECT a, b, c FROM source_table;
INSERT INTO my_table (a, b, c) SELECT a, b, c FROM source_table s
	WHERE s.my_col >= 10;
Comment

insert select

INSERT INTO table2
SELECT * FROM table1
WHERE condition;
Comment

SQL Server INSERT INTO SELECT

 INSERT INTO table1
 SELECT col1, col2 , col3 FROM table2
 WHERE your condition;
Comment

SQL Server INSERT INTO SELECT

 INSERT INTO salesTransaction_History
 SELECT * FROM salesTransaction
 WHERE item_Number='Salt-1';
Comment

SQL INSERT INTO SELECT Statement

INSERT INTO OldCustomers
SELECT *
FROM Customers;
Comment

select from table and insert into table in sql

INSERT INTO table_name(column_list)
SELECT 
   select_list 
FROM 
   another_table
WHERE
   condition;
Code language: SQL (Structured Query Language) (sql)
Comment

Insert into ... values ( SELECT ... FROM ... )

INSERT INTO table1 ( column1 )
SELECT  col1
FROM    table2  
Comment

PREVIOUS NEXT
Code Example
Sql :: how to view created temporary tables in mysql 
Sql :: createdb with postgresql on ubuntu 
Sql :: unique key in ms sql server 
Sql :: Client does not support authentication protocol requested by server; consider upgrading MySQL client 
Sql :: sql view talbe columns 
Sql :: mysql select date from datetime 
Sql :: complete date is 1 year or not sql server 
Sql :: sum value by month sql 
Sql :: postgresql check total storage 
Sql :: creating table in sql 
Sql :: change column name mysql 
Sql :: show oracle parameters 
Sql :: sql count how many times a value appears 
Sql :: mysql_num_fields in mysqli 
Sql :: oracle session statistics 
Sql :: how to run sql server on mac 
Sql :: how to get connect string from mysql database 
Sql :: postgresql function round 
Sql :: format the money fied with comma in international system using sql 
Sql :: for select oracle 
Sql :: SQL SELECT DISTINCT Statement 
Sql :: mysql if else 
Sql :: sql update 
Sql :: how to define a save method in ruby for sqlite3 databases 
Sql :: update table sql multiple set 
Sql :: sql select all tables from database change url 
Sql :: how to make case insensitive in sql 
Sql :: sql roll up rows into columns 
Sql :: sql mode 
Sql :: Create the connection pool mysql2 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =