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

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 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 :: buscar nombre de columna en todas las tablas sql server 
Sql :: start postgres server 
Sql :: MYSQL HOT TO COUNT THE DURATION BETWEEN TWO DATES 
Sql :: mysql order by desc null last 
Sql :: How to convert Varchar to Double in sql? 
Sql :: sql order by case 
Sql :: grant read only privileges postgres user 
Sql :: sql in sublime 
Sql :: python how escape sql 
Sql :: media sql 
Sql :: oracle pl sql source 
Sql :: pl sql ptint 
Sql :: spring import sql 
Sql :: postgresql change default value 
Sql :: postgres type cast to string 
Sql :: sql where max date 
Sql :: sql server query all database objects 
Sql :: execute mysql file 
Sql :: show slave status mysql 
Sql :: brew install mysql 8 
Sql :: Alter table add column in SQL Server- NAYCode.com 
Sql :: SQL Auto Increment Primary Key - SQL Server 
Sql :: mysql alter table add column first 
Sql :: lowest salary in sql 
Sql :: sql server list locks 
Sql :: mysql drop database 
Sql :: nested if in mysql 
Sql :: mysql count with if 
Sql :: sequelize migration default value 
Sql :: replace null value within column mysql 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =