Junior — Middle
Have you had experience working with relational database management systems?
sobes.tech AI
Answer from AI
Yes, I have experience working with relational DBMS. I usually used databases such as PostgreSQL and MySQL for storing structured data. In Node.js, libraries like pg for PostgreSQL or mysql2 for MySQL are commonly used to interact with relational databases.
Example of connecting to PostgreSQL using pg:
const { Client } = require('pg');
const client = new Client({
user: 'user',
host: 'localhost',
database: 'testdb',
password: 'password',
port: 5432,
});
client.connect();
client.query('SELECT * FROM users;', (err, res) => {
if (err) {
console.error(err);
} else {
console.log(res.rows);
}
client.end();
});
Working with relational databases includes creating tables, writing SQL queries, optimizing indexes, and ensuring data integrity.