Aditya Gupta

Aditya Gupta

Aditya Gupta is a founding member and editor at CodeForGeek. He first found his way into tech by reading articles, and now writes approachable guides to Node.js security, authentication, AI tools, coding agents, and web scraping.

NodeJS MySQL Create Database

NodeJS MySQL Create Database

Create a MySQL database from Node.js with one query. The trick is connecting without naming a database first, running CREATE DATABASE IF NOT EXISTS, then verifying the schema exists. Here is how to do it with mysql2 and handle the…

NodeJS MySQL Select Unique

NodeJS MySQL Select Unique

I ran SELECT UNIQUE age FROM users on a table with a duplicated age. It returned 22, 17 and 15, the same rows SELECT DISTINCT returns. On MySQL 8 that statement stops before the table is read, because UNIQUE never…

Node.js MySQL Insert Record

Node.js MySQL Insert Record

I pointed a Node script at a MySQL table and the connection succeeded. The INSERT failed on a name containing an apostrophe. Pasting values into the SQL string holds until real data arrives, then a name like O’Brien ends the…

NodeJS MySQL Select Record

NodeJS MySQL Select Record

RowDataPacket is the name MySQL hands back to Node.js, and it is the line most readers get stuck on. This is the select step end to end, from a running MySQL server to a callback whose rows you can read.…

NodeJS MySQL Drop Table

NodeJS MySQL Drop Table

DROP TABLE crashed my Node process when I re-ran it without a guard, and the fix turns that crash into a warning. I built every code path below on Node 26.7.0 with mysql 2.18.1 and mysql2 3.24.4 against MariaDB 10.11.14.…

NodeJS MySQL Create Table

NodeJS MySQL Create Table

Running node app.js once creates the users table. Running it again returns Table users already exists. If you copy the Node.js MySQL create table snippet from an older tutorial you expect it to be safe to rerun because the code…

NodeJS MySQL Create Connection

NodeJS MySQL Create Connection

I rebuilt this MySQL connection from scratch on Node 26 with mysql2 3.24.4 because the old page still taught the unmaintained mysql package. It left every error to a throw that crashes your process. I ran each snippet below against…

10 Simple Steps to Solve SQL Problems [2026]

10 Simple Steps to Solve SQL Problems [2026]

SQL problems become manageable when you turn the prompt into decisions about rows, columns, grouping, and result order, and I ran the worked example below with Python 3.11.16 and SQLite 3.53.1 so you can inspect how each clause changes the…