Skip to Main Content

Hour of Code 2017: Khan Academy: Databases

Khan Academy: Databases

As the description says: "Khan Academy: Databases teaches you to manipulate data in a database and make your own custom store." This tutorial uses structured query language (SQL), commands to create, organize, populate and retrieve information from relational databases. Khan Academy is a well-known website with many tutorials primarily in science and math and in many languages with short videos and practical exercises.   

Introduction to Databases

A database is a collection of data on a computer organized for easy entry, searching and retrieval.  An address book is an everyday database with a single table of information.  Each category is called a field.  Data about one case is a record.  In an address book, the state is a field.  All the information about one person is a record.  A database like this is called a flat file.  It has only one table of information.  

relational database has several tables for efficient storage of information because the information can be reused, needing only an ID number to represent data.  For example, a relational database for an address book could have a table for city names.  Instead of entering "Seattle" or "Las Vegas" into the main table, only an ID number is needed.  Some tables will contain only ID numbers that match items in other tables, effectively storing the relationship among those things.  (See below for an example.)

Besides tables, a relational database will also have forms.  A form allows easy display and entry of information on a monitor.  

Reports are a way to retrieve information and are usually intended for printing.  

A query is a search for information across an entire database.  Forms, reports and queries all draw information from data in an entire database.  

So why not use a spreadsheet?  

  • Spreadsheets are good for smaller lists, say under 100 items.
  • Spreadsheets are good for sorting entire records.  They can’t extract selected information from records into a new display.
  • Databases are more efficient at storing relationships among things you’ve already entered.
  • Databases are good at working with information that repeats. 
  • Databases can import from and export to spreadsheets.  
 

Database example: a discography

A discography is a listing of recordings.  Alice wants to create a discography of all her polka recordings as a relational database.  She might start by creating several tables:  artist, record company, track and musician.  For each of her CDs, LPs, 45s, cassettes, and 8-tracks, she can enter the artist primarily responsible for a recording. Each record company only needs to be entered once and then that ID number is entered in the appropriate field of the album field.  Tracks are entered in their own table and a new table, album tracks, is created that contains the ID number of an album, and the ID numbers of all the tracks found on that album, along with side (if appropriate) and track number. 

A discography of Cajun, Louisiana Creole and zydeco music exists at Loyola.  Search the data using the form.  PHP is a program that can create web pages on demand based on data from a relational database.  

How do I get started with a new database?

How do I get started? 

  • Plan, plan & plan!  
  • What information do you have?
  • How do you want to get it back once it’s entered?
  • What will be in a single record?
  • What will the fields be?  
  • What format will they be?
  • Do I need a flat file or a relational database?
  • Can I use a template?

Where will it be stored?  Is it only for one person at a time or will it live on a server for many fo use?  Microsoft Access is part of Microsoft Office and can create relational databases.  Databases can be hosted on web servers using MySQL and other database programs.  Information on a single computer can be exported and imported onto a server for many to use.  

Unable to locate the requested user profile.