Junior — Middle
What types of databases or data warehouses have you used in your practice?
sobes.tech AI
Answer from AI
In practice, I have used the following types of databases and data stores:
- Relational databases (SQL): PostgreSQL, MySQL, SQLite. Used for storing structured data with support for complex queries and transactions.
- Document-oriented databases (NoSQL): MongoDB. Used for flexible storage of JSON-like documents, especially when the data structure may change frequently.
- Key-value stores: Redis. Used for caching and quick data access.
- File storage: Amazon S3 for storing large files and backups.
Example of connecting to PostgreSQL in Python using the psycopg2 library:
import psycopg2
conn = psycopg2.connect(
dbname="mydb",
user="user",
password="password",
host="localhost"
)
cur = conn.cursor()
cur.execute('SELECT * FROM users')
rows = cur.fetchall()
for row in rows:
print(row)
cur.close()
conn.close()