Frequently, advanced Python users will find themselves working with APIs or other external applications. In this lesson, we will learn how to work with SQL databases from a Python environment. SQL, which stands for Structured Query Language, is a programming language designed to manage data stored in a relational database. A relational database is a database that organizes information into one or more data tables.
Databases Contain Data Tables
These data tables each contain many fields and records. Below is an image of a data table, where we see:
- fields: the columns or attributes of the table
- records: the rows or observations associated with each field
The next image is a data table from a SQL relational database. This is a customer data table where the fields are:
This data table originated from the SQL relational database to your right. Notice how this database is organized into data tables, and each data table has many fields. The lines that run between the data tables are to depict how the tables are related. If you hover over one of the lines, you will notice that the data tables share an identical field. When two or more data tables need data on related topics, it may be necessary for them to contain the same field. This is how these tables are related, hence the name relational database.