Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

insert-into

MySQL How do you INSERT INTO a table with a SELECT subquery returning multiple rows?

February 17, 2023 by Tarik

INSERT INTO Results (People, names ) SELECT d.id, ‘Henry’ FROM Names f JOIN People d ON d.id = f.id Combine the static string Henry with your SELECT query.

Categories mysql Tags insert-into, mysql, select, subquery Leave a comment

Adding a line break in MySQL INSERT INTO text

January 7, 2023 by Tarik

If you’re OK with a SQL command that spreads across multiple lines, then oedo’s suggestion is the easiest: INSERT INTO mytable (myfield) VALUES (‘hi this is some text and this is a linefeed. and another’); I just had a situation where it was preferable to have the SQL statement all on one line, so I … Read more

Categories mysql Tags insert-into, mysql, newline Leave a comment

mysql -> insert into tbl (select from another table) and some default values [duplicate]

December 24, 2022 by Tarik

You simply have to do: INSERT INTO def (catid, title, page, publish) SELECT catid, title, ‘page’,’yes’ from `abc`

Categories mysql Tags insert-into, mysql Leave a comment

INSERT INTO…SELECT for all MySQL columns

December 21, 2022 by Tarik

The correct syntax is described in the manual. Try this: INSERT INTO this_table_archive (col1, col2, …, coln) SELECT col1, col2, …, coln FROM this_table WHERE entry_date < ‘2011-01-01 00:00:00’; If the id columns is an auto-increment column and you already have some data in both tables then in some cases you may want to omit … Read more

Categories mysql Tags insert-into, mysql, select Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa