View tables
You have already learned how to create database schemas and tables, so the logical question has come: how to add data to a table?
Before adding data to a table, let's learn how to view data in tables.
First of all, Workbench is aimed at executing SQL queries and viewing the results of their execution, so when you want to view the contents of a table, it simply prompts you to execute the query:
SELECT * FROM table
And I'm not kidding.
Workbench has a special button that allows you to view the contents of the table. It is displayed if you hover over the table name:
Let's click it and see what happens:
Here, a query to the table is displayed on top, and in the lower half of the screen - Result Grid - a table of results.
And this is the only way to view the contents of the tables.
Adding data to a table
If you're wondering how to view the contents of a table, then wait until you know how to add data to a table.
You can add them directly through the Result Grid, which you see in the lower half of the screen.
We just take and write lines there:
Then press the Apply button. As a result, we get the following SQL script:
Click the "Run script" button and get the result:
Changing data in a table
Data in the table is even easier to change than to add - just take it and change it.
Let's make 3 changes to our table:
- Ivanov will change the level to 40.
- Petrov will change the year to 2021.
- Let's change Sidorov's name to "Vitaly".
Change the data in the table:
Click Apply and get a list of requests:
That's it, the data in the table has been changed.
GO TO FULL VERSION