- [Instructor] For our first series of examples
in this lesson, we'll be focusing on relational databases
and the structured query language.
So as you probably know a database is simply
a collection of data and traditional relational database
management systems focus on storing that data in tables
and sometimes many tables
that have relationships between them.
We'll be focusing on using the Structured Query Language
or sequel as many people referred to it
some read it by the letters SQL
and that is the pretty much universal language
of relational database systems.
We'll demonstrate some queries that extract data
from a database and we'll also take a look at capabilities
for inserting records into a database,
updating records and deleting records as well.
Now for the purpose of these examples we'll be focused
on using the sequel light database management system,
which comes bundled with Python,
and as you'll see there's also a module built
into the Python standard library
for interacting with sequel light.
Now when we're working with relational data,
we're going to be using tables that consist
of rows and columns,
and the relational database itself is just
a table based representation of data.
So this is a simple employee table
in which we have several rows of data,
several columns of data,
and specifically you notice that we marked
the number column as a primary key.
This is a value that helps uniquely identify
each of the rows within a given table.
Now every row describes one unique entity
in the case of our employee table up above one employee
and the columns within a given row
are the individual pieces of data or attributes
associated with that unique entity,
and as I mentioned the primary key,
is usually a column but it could also be a group of columns
and that is used to uniquely identify every one of the rows.
Now when you're working with those tables,
one of the most common things you'll do
is use sequel queries to grab subsets
of the data in a given table.
So this is a result of an example
in which you select from that employee table,
each department and its location,
and here we happen to be presenting the data
in increasing order by department number.
So one of the things that we'll be able to do for example,
is to sort the results that we are getting back
when we query the database.
Now as we work our way through this section 16_02
and its subsections, again we'll be focused on using
the sequel light database management system.
It's an open source DBMS, and again included with Python,
most of the popular database systems out there
have Python support, so once you choose
whichever database management system you want to use,
you would simply take advantage of whatever
Python module they provide
for interacting with that database.