Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql insert multiple rows

INSERT INTO MyTable
  ( Column1, Column2, Column3 )
VALUES
  ('John', 123, 'Lloyds Office'), 
  ('Jane', 124, 'Lloyds Office'), 
  ('Billy', 125, 'London Office'),
  ('Miranda', 126, 'Bristol Office');
Comment

how to insert multiple rows in sql

INSERT INTO sales.promotions (
    promotion_name,
    discount,
    start_date,
    expired_date
)
VALUES
    (
        '2019 Summer Promotion',
        0.15,
        '20190601',
        '20190901'
    ),
    (
        '2019 Fall Promotion',
        0.20,
        '20191001',
        '20191101'
    ),
    (
        '2019 Winter Promotion',
        0.25,
        '20191201',
        '20200101'
    );
Code language: SQL (Structured Query Language) (sql)
Comment

sql insert multiple rows from 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 multiple rows from select

  INSERT INTO table2
     (name, email, phone)
     SELECT name, email, phone
     FROM table1;
Comment

Insert Multiple Rows at Once in SQL

INSERT INTO Customers(first_name, last_name, age, country)
VALUES
('Harry', 'Potter', 31, 'USA'),
('Chris', 'Hemsworth', 43, 'USA'),
('Tom', 'Holland', 26, 'UK');
Comment

sql insert multiple rows

INSERT INTO My_Table (FirstName, LastName)
VALUES
    ('Fred', 'Smith'),
    ('John', 'Smith'),
    ('Michael', 'Smith'),
    ('Robert', 'Smith');
Comment

sql insert multiple rows from another table

INSERT INTO customer (first_name, last_name)
SELECT fname, lname
FROM list_of_customers
WHERE active = 1;
Comment

PREVIOUS NEXT
Code Example
Sql :: why we have to set the password for my sql server 
Sql :: how we can perform acid Operations in sql with examples 
Sql :: sub blocks in sql 
Sql :: mysql set user password for a range of ips 
Sql :: dump only schema 
Sql :: create synonym for dblink in oracle 
Sql :: join creating duplicate columns sqllite 
Sql :: cloudformation deploy sqs example 
Sql :: proc sql not in working 
Sql :: download mysql database to excel in android studio 
Sql :: with_for_update sqlalchemy 
Sql :: How to do a cumulative count using Raw SQl / Laravel - Eloquent ORM 
Sql :: PGSQL dynamic table name 
Sql :: database db connection string format 
Sql :: how to delete a database record after a certain time 
Sql :: How to return only the Date from a SQL Server DateTime datatype 
Sql :: having all mysql 
Sql :: SQL Primary Key Error 
Sql :: mysql table information 
Sql :: mysql select bottom 10 rows 
Sql :: get id if is not equal in certain table 
Sql :: postgres drop all tables owned by a user 
Sql :: Mysql Install Ubuntu with native password 
Sql :: Manage Database in MySQL 
Sql :: month() in sql 
Sql :: ORACLE RANGE DATE USING CONNECT BY PER WEEK,MONTHS,ETC 
Sql :: db visualizer mssql 
Sql :: sql update from another table join 
Sql :: get many value to 1 column sql 
Sql :: match end of string regex sql 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =