Instructions for Navigating an SQL Database

Let’s assume that you aren’t creating a database, meaning that all that’s necessary is the programming, something made simple. SQL is a database language used to navigate and organize the database of your choosing and create graphics with, but for now, you will see the programming side.

Before I continue, SQL would be useful in a Digital Humanities context where you are dealing with way more data than you can handle in the usual Excel sheet. SQL makes a molehill out of a mountain when it comes to data.

Now, onto the tutorial.

  1. Load your database into any SQL browser of your choice (I’m using the DB Browser for SQLite). Specifically look for the .db file.
  2. Now that you have your database, you can start programming to navigate the database. You can SELECT a column from a table. in that order. For exampleSELECT * FROM people(the star means everything, you can also specify the column)
  3. Next, you can specify the information you are looking for such as where shirt_or_hat = 'hat' or WHERE state = 'TX'. The WHERE function will find the items that matches from the columns called.
  4. If you want to be more generalistic, you can use % on the beginning or end of a word, such as %Angelos or C% or %yu%. This is specifically for the WHERE function.
  5. If you would like to look at a limited number of results, SQL has the function LIMIT, that will automatically let you look at the first to the limited response. For example, LIMIT 42, LIMIT 69. You can also start with a number other than one using OFFSET, such as OFFSET 42, so you can start with the 42nd result rather than the first.
The database in question. Adopted from Lynda.com.
An example of code. That works!

Here some worthy resources to learn more about SQL, considering my tutorial is certainly nonexhaustive:

https://www.w3schools.com/sql/

https://www.codecademy.com/learn/learn-sql

Author: lintone

Leave a Reply

Your email address will not be published. Required fields are marked *