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

PREVIOUS NEXT
Code Example
Sql :: show tablespace oracle 
Sql :: postgresql delete all content 
Sql :: insert into sql 
Sql :: SQL add a totals of differemt rows of the same id 
Sql :: SQL get last 5 minutes data 
Sql :: php delete database 
Sql :: delete table in mysql 
Sql :: insert many to many sql 
Sql :: change column name sql 
Sql :: how to check user grant in mysql 
Sql :: sql sum of same record 
Sql :: restore backup "text" postgresql command line 
Sql :: mysql switch case 
Sql :: how to comment in sql 
Sql :: mssql describe stored procedure sqlcmd 
Sql :: export mysql database command line 
Sql :: Write SQL in ruby on rails 
Sql :: how to put is null in where in clause 
Sql :: sql server select rows by distinct column 
Sql :: postgresql delete cascade 
Sql :: having clause in sql 
Sql :: changing column names in sql query results 
Sql :: Caused by: java.lang.RuntimeException: Unable to obtain credentials to communicate with the Cloud SQL API 
Sql :: alter session set nls_language french 
Sql :: how to limited number of rows in db2 select * from imglib FETCH FIRST 20 ROWS ONLY 
Sql :: postgres add prefix to primary key 
Sql :: List all the items that have not been part of any purchase order. sql 
Sql :: sql with as 
Sql :: To log postgres db in without a password 
Sql :: sql join on wildcard 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =