SQL (Structured Query Language) is the native language for interacting with databases & is designed for exactly this purpose. It is a language of databases. A database models real-life entities like professors & universities by storing them in tables. Each table contains data from a single entity type. This reduces redundancy by storing entities only once. For example, there only needs to be one row of data containing a certain company’s details. Lastly, a database can be used to model the relationship between entities.

Querying Databases

While SQL can be used to create & modify databases, this tutorial’s focus will be on querying databases. A query is a request for data from a database table (or combination of tables). Querying is an essential skill for a data scientist since the data you need for your analyses will often live in databases.

In SQL, we can select data from a table using a statement. For example, the following query selects the column from the table:

In this query, & are called keywords. In SQL, keywords are not case-sensitive, which means you can write the same query as:

That said, it’s good practice to make SQL keywords uppercase to distinguish them from other parts of your query, like column & table names. It’s also good practice to include a semicolon at the end of your query. This tells SQL where the end of the query is.

SQL Order of Execution

Note: Your query will always need a SELECT & a FROM statement (to identify which columns you want returned from which table) -the others are optional.

Example of SELECT

In the following example, we will SELECT the column from the table.

When we run the above code, it produces the following result:


Data Scientist & Machine Learning Engineer