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:
![Workbench Adding data to a table](https://cdn.codegym.cc/images/article/61cc446f-cb9f-4b3d-850d-19967d83e1f2/1024.jpeg)
Let's click it and see what happens:
![Workbench Result Grid](https://cdn.codegym.cc/images/article/20dca21b-a23a-4192-8422-ebc629d26bd5/1024.jpeg)
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:
![Adding data to a table](https://cdn.codegym.cc/images/article/d0f114c6-19f3-4249-babf-757093acbb63/1024.jpeg)
Then press the Apply button. As a result, we get the following SQL script:
![Adding data to a table 2](https://cdn.codegym.cc/images/article/75da9476-f797-462d-b028-a9fe592d14b7/800.jpeg)
Click the "Run script" button and get the result:
![Run script Workbench](https://cdn.codegym.cc/images/article/4057db87-0fba-44ed-9152-1319005cf0b6/1024.jpeg)
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:
![Change the data in the table](https://cdn.codegym.cc/images/article/206c0d3d-b179-4d1e-b7cb-0ba1d6d10d3a/1024.jpeg)
Click Apply and get a list of requests:
![](https://cdn.codegym.cc/images/article/2f7a740a-03cf-40e2-a1a1-e9d6e6d040e7/800.jpeg)
That's it, the data in the table has been changed.
GO TO FULL VERSION