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

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

In this query, SELECT & FROM 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

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

RELATED LINKS

Data Scientist & Machine Learning Engineer