Node.js MySQL SELECT FROM Query Examples

Learn Node.js MySQL SELECT FROM query to access data of a MysQL Table.

Node.js MySQL SELECT FROM query

MySQL SELECT Query is used to select some of the records (with some of their properties if required) of a table.

In this Node.js Tutorial, we shall learn to access data of a table using following Node.js examples

We shall use the following MySQL Table, in the examples of this section [DATABASE : studentsDB, Table: studends]


Example to MySQL SELECT FROM query


Example to select only some of the columns

We shall select only two columns, name and marks


Example to use Result Object of MySQL SELECT FROM query

You may access rows using index and columns using dot operator.


Example to use Fields Object of MySQL SELECT FROM query

Fields contain information about columns of table. Each field contains all information about a column.

You may use the elements of a field object using dot operator. Example field.catalog,, field.type, etc.


Conclusion :

In this Node.js Tutorial – Node.js MySQL – Node.js MySQL SELECT FROM query, we have learnt to fetch records of table from MySQL database, and to use result object and fields object.