Explore the surprisingly powerful features of Python's built-in SQLite with these beginner-friendly questions covering its strengths, common uses, and important limitations.
Which SQL database engine is included with Python for immediate use without additional setup?
Explanation: SQLite comes bundled with Python through the sqlite3 module, enabling immediate use with no installation. PostgreSQL and MySQL are popular but not included by default. Oracle is a separate commercial product and never bundled with Python.
What is a key advantage of using SQLite in Python applications?
Explanation: SQLite operates serverlessly, so there's no need to install or run an external database server. Docker setup and internet access are unnecessary, and it runs locally, not just in web browsers.
How do you create a new SQLite database file in Python using sqlite3?
Explanation: Calling sqlite3.connect with a filename either creates the file or opens it if it exists. The other options are not valid methods for creating or opening a SQLite database via Python.
What type of projects commonly use SQLite because of its zero-setup and lightweight design?
Explanation: SQLite is ideal for CLI tools, simple apps, or local prototypes due to its ease of use. It is not designed for large-scale analytics, enterprise clusters, or intensive computational workloads.
Which special filename lets you create a temporary SQLite database in RAM only?
Explanation: Using ':memory:' as the database name with sqlite3.connect creates a SQLite database in RAM, perfect for testing. The other options do not serve this function in SQLite.
Which database feature does SQLite support to guarantee data consistency during changes?
Explanation: SQLite is ACID-compliant, supporting reliable transactions. GraphQL and sharding are unrelated, while horizontal scaling is not a feature of SQLite.
What must you do to use foreign key support in SQLite?
Explanation: Foreign key constraints in SQLite require enabling with 'PRAGMA foreign_keys = ON;'. There is no paid version, OS limitation, or required plugin.
Why is SQLite less suitable for heavily used multi-user web applications?
Explanation: SQLite locks the entire database during write operations, making it less ideal for high-concurrency scenarios. It fully supports SQL and reliable data storage, and does not delete data unpredictably.
Which statement about SQLite's user authentication is true?
Explanation: SQLite has no built-in user authentication. Responsibility for access control falls to the application. It does not support user roles, password hashing, or mandatory admin accounts.
Which scenario best illustrates a practical use of SQLite in Python?
Explanation: SQLite is well-suited for intermediate local storage, such as keeping scraped data before cloud upload. It is not intended for high-traffic, massively parallel, or streaming use cases.