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

PREVIOUS NEXT
Code Example
Sql :: change from not null postgresql 
Sql :: sql get month and year from date 
Sql :: how to find total working hour in sql 
Sql :: how to search query in python3 sqlite3 
Sql :: PostgreSQL: To_Number function 
Sql :: how to change server name in sql server 
Sql :: count in sql 
Sql :: remove root password mysql 
Sql :: sql dcl 
Sql :: delete all duplicate rows keep the latest except for one in mysql 
Sql :: php insert null mysql 
Sql :: sql select whole row max column 
Sql :: how to filter repeated same result using sql query 
Sql :: psql shell 
Sql :: delete from select postgresql 
Sql :: sql join on comma separated field 
Sql :: mysql delete older duplicates 
Sql :: how to update values in sql 
Sql :: add column mysql with foreign key 
Sql :: how to select multiple columns from different tables in mysql 
Sql :: having in sql 
Sql :: not keyword in sql 
Sql :: sql use with to get value counts and percentages 
Sql :: mql5 list all available symbols 
Sql :: if role exists sql 
Sql :: many to many flask-sqlalchemy 
Sql :: tsql from yyyymm to date 
Sql :: Syntax error or access violation: 1075 Incorrect table def inition; there can be only one auto column and it must be defined as a key 
Sql :: create table if not exists 
Sql :: oracle logfile switch 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =