Sobes.tech
Junior — Middle

Do you have experience working with database management systems?

sobes.tech AI

Answer from AI

Yes, I have worked with various database management systems (DBMS), such as SQLite, PostgreSQL, and MySQL. In Python, libraries like sqlite3 for SQLite or ORM libraries like SQLAlchemy are often used to interact with databases, allowing working with the database through objects and simplifying query writing.

Example of a simple query using sqlite3:

import sqlite3

conn = sqlite3.connect('example.db')
cursor = conn.cursor()

# Create a table
cursor.execute('''CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)''')

# Insert data
cursor.execute('INSERT INTO users (name) VALUES (?)', ('Ivan',))

conn.commit()

# Read data
cursor.execute('SELECT * FROM users')
print(cursor.fetchall())

conn.close()