Learning.
Copy
const mysql = require('mysql2/promise'); const pool = mysql.createPool({ host: 'localhost', user: 'root', database: 'sample', password: 'password', }); (async () => { try { for(let i = 0; i < 30; i++){ await pool.query('INSERT INTO users (name, age) VALUES (?, ?);', ["taro" + i, i] ); } } catch (err) { console.log(err); } pool.end(); })(); Copy
CREATE TABLE users ( id INT AUTO_INCREMENT, name VARCHAR(255) NOT NULL, age INT NULL, PRIMARY KEY (id) );Copy
ALTER TABLE users ADD ( address text null, tell int null );Copy