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

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 :: SQL SELECT AS Alias 
Sql :: aliasing in sql 
Sql :: sql where statement 
Sql :: how to uninstall mysql windows 10 
Sql :: get full yearr data omonthwuse sql 
Sql :: oracle sysdba connect as another user 
Sql :: install mysql ubuntu 20.10 
Sql :: postgresql replace html tags from string 
Sql :: varchar2 length in oracle 
Sql :: how to count codition 
Sql :: oracle activate program 
Sql :: load utilities in sql server 
Sql :: sqlite referential integrity 
Sql :: will graphql replace sql 
Sql :: alter domain sql 
Sql :: A good way of running a SQL query in JDBC using a parameterized statement 
Sql :: select all column 
Sql :: delete recurring email keep smallest id number 
Sql :: creating h2 database in relative directory eclopse 
Sql :: PSQL qith variables 
Sql :: get db connection detail from sql developer profile 
Sql :: mysql drop vs delete 
Sql :: mysql check if entry exists 
Sql :: sap return 
Sql :: synapse sql table set pk 
Sql :: systemverilog unique constraint unique values 
Sql :: expose db in virtualbox 
Sql :: how to add session data into mysql database from button 
Sql :: online t-sql editor 
Sql :: play framework connection via windows sql server 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =