In the previous section, you created a model, schema, and table. You also forward engineered your model to the live server. In this section, you will see how you can use MySQL Workbench to add data into your database on the live server.
Open the SQL Editor by opening a MySQL connection.
From the Navigator panel on the left,
movies table from the
dvd_collection schema. Right-click on the
movies table and choose Select
Rows - Limit 1000.
The Navigator panel has both Management and Schemas tabs.
You will see the query and its associated data grid. This is
where you can enter the data for your database. Remember that
movie_id was set to auto increment, so
values are not needed for this column. In the data grid, enter
the movie information shown in the following table.
|Gone with the Wind||1939-04-17|
|The Hound of the Baskervilles||1939-03-31|
|Above the Law||1988-04-08|
|Iron Man 2||2010-05-07|
Do not modify any values in the
Now click the Apply button in the toolbar located in the bottom right corner. A list of SQL statements will be displayed. Confirm that you understand the operations to be carried out. Click Apply to apply these changes to the live server.
Confirm that the script was executed correctly, then click Finish.
View the data grid again and observe that the autoincrement values have been generated.
Now you will check that the data really has been applied to
the live server. Launch the MySQL Command Line Client. Enter
SELECT * FROM movies; to see the data just
You can also carry out a similar check from within
MySQL Workbench. Close the
tab, which should load the Home page. Now, click on the
MyFirstConnection connection to load the
A new SQL Editor tab will be displayed. In the Query area, enter the following code:
USE dvd_collection; SELECT * FROM movies;
Now click the Execute toolbar button. This resembles a small lightning bolt. The SQL Editor will display a new Result tab contain the result of executing the SQL statements.
In this section of the tutorial, you have learned how to add data to your database, and also how to execute SQL statements using MySQL Workbench.