Go to the U of M home page
Showing posts with label structured query language. Show all posts
Showing posts with label structured query language. Show all posts

Thursday, December 12, 2024

Tony's Tech Terms: Structured Query Language

You have probably heard us use the acronym SQL (sometimes pronounced "sequel") from time to time, which stands for Structured Query Language. SQL is a language that is used to create, retrieve, update, and delete data in a relational database. It's a readable language with a specific structure.

If you learn "standard" SQL, you'll have a pretty good grasp of how to query tables in Oracle. However, Oracle has its own variant called PL/SQL (Procedural Language/Structured Query Language), so some standard queries will look a little different.

Let’s use this simple table named “campuses” as an example:

ID

NAME

ABBREVIATION

1

Crookston

UMNCR

2

Duluth

UMNDL

3

Morris

UMNMO

4

Rochester

UMNRO

5

Twin Cities

UMNTC


It's pretty easy to write some SQL to retrieve the Morris row. If we happen to know the ID (which is unique), we could query it with SELECT * FROM CAMPUSES WHERE ID = 3; (The "*" character says give me all the columns.) This query would return:

ID

NAME

ABBREVIATION

3

Morris

UMNMO


However, most of the time we don't have IDs memorized. We could get the same information with SELECT * FROM CAMPUSES WHERE NAME = 'Morris'; This is a much more intuitive query.

Note: I mentioned above that Oracle has its own version of SQL. I used single quotes around Morris in my query. My query would cause an error if I used double quotes. Other relational databases are not as opinionated about single vs. double quotes. This is just one example of the subtleties of working with Oracle.