Junior — Middle
Can you give an example of an SQL query to retrieve data from a database?
sobes.tech AI
Answer from AI
A simple example of an SQL query to retrieve data from the users table:
SELECT id, name, email FROM users WHERE active = 1;
This query selects the id, name, and email columns from the users table where the user is active (active = 1).
In Node.js, to execute such a query, you can use packages like mysql2 or pg for PostgreSQL.