Designing SQL INSERT Query using dbForge Query Builder for MySQL
โน๏ธ Learn how to create INSERT query with the special feature in MySQL Query Builder Tool by Devart: create a SELECT query, preview added data, convert SELECT query to INSERT, and then run it.
๐ Read more about dbForge Query Builder for MySQL:
https:/devart.com/dbforge/mysql/querybuilder/
๐ฅ Download a 30-days trial version of dbForge Query Builder for MySQL:
https://devart.com/dbforge/mysql/querybuilder/download.html
โ
Subscribe to our channel:
https://youtube.com/user/DevartSoftware/
#MySQL, #Query, #MySqlInsertQuery, #QueryBuilder, #dbforge, #Devart
Closed Caption:
Welcome to dbForge Query Builder for MySQL Tutorials.
In this tutorial, you will learn how to:
- create a SELECT query
- preview added data,
- convert a SELECT query to an INSERT query
and run it.
First, we will show how to insert data into
a table.
Select the Example.Customer table, and retrieve data from it.
As you can see, there are no records in the table at the moment.
Now, send the table to the Query Builder diagram.
Change the query type from "Select" to "Insert values".
Select required columns, assign values to them,
and execute the query.
Here is the result.
Let's take a look at the table data.
As you can see, the data has been successfully inserted into the table.
This query allows adding user-defined column values to the table.
However, it is not applicable when inserting multiple data.
Therefore, let's consider inserting values
of several Source tables into a single target
table.
Select the necessary tables and send them to the Query Builder.
Let's fit the diagram view for a better visual experience.
Add a selection condition for the query.
Let's select all records from the AddressType table and filter them by the "Name" column
with the condition โValues is equal "Home".
Now select the columns that you want to insert into the table.
You can preview the data that will be inserted.
You can see, there is a lot of data that matches the condition.
Change the query type from "Select" to "Insert results".
Next, select the table to insert data into,
and ensure that the table and query fields match.
In this case, they don't, since the field
order in the table differs from that in the query.
Let's fix that.
Note, that the column types must match as well, while matching Column names are not
obligatory.
Let's take a look at the query text.
Everything is fine.
Now, execute the query and ensure that the data has been inserted successfully.
Here is our result.
Everything is just as designed.
You have been watching the dbForge Query Builder for MySQL Tutorial.
You can download a 30-day trial edition of
dbForge Query Builder for MySQL at Devart.com
Video Length: 02:24
Uploaded By: Devart
Published: 9/4/2020
View Count: 604