Database Systems

 Database Systems


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


# Create a connection to the database

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


# Create a table

conn.execute('''CREATE TABLE IF NOT EXISTS users

                 (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)''')


# Insert data into the table

conn.execute("INSERT INTO users (name, age) VALUES ('Alice', 25)")

conn.execute("INSERT INTO users (name, age) VALUES ('Bob', 30)")


# Query the table

result = conn.execute("SELECT * FROM users")

for row in result:

    print(row)


# Close the connection

conn.close()

No comments:

Post a Comment

The Importance of Cybersecurity in the Digital Age

 The Importance of Cybersecurity in the Digital Age Introduction: In today's digital age, where technology is deeply intertwined with ev...