Python for Infomatics Chapter 1 Database and SQL application 1 (translated), pythoninfomatics
14.1 what is a database
A database is a file that stores structured data. Most databases are similar to dictionaries- ing the relationship between keys and values. The biggest difference is that the database is stored on the hard disk or other permanent storage, so it still exists after the program ends. The dictionary capacity stored in the memory is limited by the memory configuration of the computer, so the database can store more data than the dictionary.
Similar to dictionaries, database software is very fast in data insertion and access, even if it is massive data. By creating a data index, the database software maintains its performance and allows the computer to quickly jump to a specific entry.
Currently, there are many database systems for different purposes, including Oracle, MySQL, Microsoft SQL Server, PostgreSQL, and SQLite. Since SQLite is a common database and built-in in Python, this book focuses on SQLite. SQLite is designed for embedded applications to provide database support for applications. For example, Firefox uses the SQLite database internally like other products.
You can access the http://sqlite.org/for more SQLite information.
SQLite is very suitable for processing problem-solving data in informatics, such as the Twitter crawler software we described in this chapter.
14.2 Database concept
When you first see a database, it looks like a workbook consisting of multiple tables. The main data structures in the database include tables, rows, and columns. In the technical description of relational databases, tables, rows, and columns are more formally referred to as links, tuples, and attributes. In this chapter, we use informal terms.
14.3SQLite manager-Firefox Plugin
Although this chapter focuses on using Python to operate data in the SQLite Database, using a Firefox plug-in called SQLite Database Manager allows you to perform operations more conveniently. This plug-in can be obtained from the following address for free:
Https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/
You can easily use your browser to create tables in the database, insert and edit data, or run simple SQL queries.
To some extent, the database manager is similar to a text editor that processes text files. When you want to perform one or more operations on a text file, you can open it directly in a text editor and modify it. But when you have many other users who need to modify it, you often write a simple Python program. When you perform database processing, you will find the same mode. You will use the database manager for simple operations, and use a more convenient Python program for more complex operations.
Note: the original article is Python for ICs ICS by Dr. Charles Severance.