How can I query a specific row in a table in MySQL?

To retrieve a specific row from a table, you can use the SELECT statement and specify the row conditions with the WHERE clause.

For example, if there is a table named “students” with columns “id” and “name”, to query the row with id of 1, you can use the following statement:

SELECT * FROM students WHERE id = 1;

This will return all columns of the row with id 1.

If you only want to query specific columns, you can replace “*” with the column names, for example:

SELECT name FROM students WHERE id = 1;

This will return the “name” column of the row with id 1.

Leave a Reply 0

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


广告
Closing in 10 seconds
bannerAds