Junior — Middle
What is your experience with database management systems?
sobes.tech AI
Answer from AI
My experience with database management systems includes:
- Using relational DBMSs such as PostgreSQL and MySQL for storing and retrieving data using SQL queries.
- Working with ORM libraries in Python, such as SQLAlchemy or Django ORM, which simplify interaction with the database through objects.
- Optimizing queries and indexes to improve performance.
- Using transactions to ensure data integrity.
- In some projects, I have used NoSQL databases, such as MongoDB, for storing unstructured data.
Example of connecting to a PostgreSQL database using psycopg2:
import psycopg2
conn = psycopg2.connect(
dbname="testdb",
user="user",
password="password",
host="localhost"
)
cur = conn.cursor()
cur.execute("SELECT * FROM users WHERE id = %s", (1,))
user = cur.fetchone()
print(user)
cur.close()
conn.close()