Database systems are software systems that store and manage large amounts of structured and unstructured data. Understanding database systems is essential for developing software that interacts with databases. Here's an example of a simple database program in Python using the
SQLite library:
import sqlite3
conn = sqlite3.connect('example.db')
conn.execute('''CREATE TABLE IF NOT EXISTS users
(id INTEGER PRIMARY KEY, name TEXT, age INTEGER)''')
conn.execute("INSERT INTO users (name, age) VALUES ('Alice', 25)")
conn.execute("INSERT INTO users (name, age) VALUES ('Bob', 30)")
result = conn.execute("SELECT * FROM users")
for row in result:
print(row)
conn.close()