Database IntegrationLesson 51Free preview
MySQL Select From
This lesson is part of Node.js · All levels
Summary
SELECT is used to read data from one or more tables, complete with clauses such as SELECT, FROM, and column selections. You can select a specific column, count the number of rows with COUNT, or combine a table with JOIN. The result of the mysql2 query is an array of objects that are ready to be sent as JSON.
Key points
- SELECT the column from the table determines what data is taken
- Take all the columns, it's best to mention the columns needed
- COUNT, SUM, and AVG are commonly used aggregate functions
- MySQL results are arrays that can be sent directly to the frontend.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.