Fetch data using select keyword

Fetch data using select statement

In the previous post we have seen, how can we create a database, table, and insert data. In this post, we will see how to fetch data using a select keyword. We can use different options with select keywords, those options are highlighted in this blog/video.

Print specific columns

To print specific columns, we can just specify them after the select statement, and they should be separated by a comma only. Below statement prints the specified column data.

Select column1, column2 fom table_name;

Distinct Keyword

If any column consists of duplicate values, then with the use of a distinct keyword we can avoid printing duplicate values. The below statement will avoid duplicate values from that column while printing.

Select distinct column_name from table_name;

Commands file

You can download the commands file from here.

Leave a Comment

Your email address will not be published. Required fields are marked *