View Table Data MySQL Essential Training

View Table Data MySQL Essential Training

MySQL

View Table Data MySQL Essential Training




In our previous lesson we’ve learned about how to insert a row inside the table. Now we are in the position of showing them to real world in this View Table Data MySQL Essential Training lesson. In our previous class itself we give a very basic idea about how to display them using the CLI commands.
In our first lesson in this MySQL series we talk about the four functionalities of MYSQL CRUD(Create, Read, Update, Delete). We already seen how to create and insert into the table and database. Here we move to the Read state of the database. We can find many ways to read a data from the table.
Select is the one of the important and most frequently used command to view our data stored in our tables. Lets discuss this with an real time example. in our previous lesson we inserted a three rows in the table called emp_details.
View Table Data MySQL Essential Training
Here we can see how to display them in different ways.
Syntax: select * from table_name;
// select is an keyword to select all the values from the defined table

Here we select the values from the table emp_details. The * special character is mention all the columns in the table. This command in View Table Data MySQL Essential Training is list all the rows inserted in the table emp_details. If we wants to get an condition based values to be receive we can use the conditions also.
View Table Data MySQL Essential Training
The above is listed all rows in the table emp_details. From the table emp_details, if we just wants to display only the row which is has the “CEO” as a designation. Then we can change the select query like the following.

The above will filter only the rows which has the designation as CEO. Here we use the where keyword for the define the condition we wants to filter in the entire table.
View Table Data MySQL Essential Training
From the above CLI command we can filter the particular kind of row with all the column fields. In View Table Data MySQL Essential Training lesson, if you want to show particular columns only in the table we can use the following method.




From the above command the query will shows only the designation and contact of the all the rows in the table called emp_details. Instead of * special character, we can give what are the fields particularly wants to be showed in the display. We can mention more than column name separated by comma.
View Table Data MySQL Essential Training
Some time we wants to show all the values or particular values showed in reverse order. So far in this View Table Data MySQL Essential Training lesson we use the CLI provided functions for arrange the rows in ascending and descending order.

The above CLI command will shows all the rows in table emp_details in the reverse order. The ORDER BY is the keyword for arrange the table rows in which order.
View Table Data MySQL Essential Training
The above all are the methods to display the rows from the table in different ways. We hope this will helps you to get an idea about how to show the data from the tables.




Leave a Reply