Objectives

Students will be able to:

  • import data from a csv file into a common database application
  • understand that a database table is composed of rows (records) and columns (fields)
  • undertand that fields can have different datatypes eg number, text
  • sort and filter data in the database table
  • possibly create a simple chart.

Scenario

Some clients (eg your laptop or smartphone) are requesting information from imdb.com's server in the cloud. The clients are using a web browser. The information will be sent in the form of a webpage.

But where is all the information coming from?

For example, visit and do a search for your favourite actor. What information does the website send back to you?

And where is this information coming from exactly?

The data is being stored on a database on a web server. Clients can request information from the database!

Databases - powering the web

Many other websites use databases to store data. For example, X (formerly known as Twitter), might store the following information everytime somebody tweets:

id username twitterHandle tweetContent Date
1 JamesBrolin @james01 Yo Yo Yo! Bro! 12/1/2024
2 MaceyT @maceyyy Feeling gorgeous 12/1/2024
3 LowBro @thelowbro Anyone in town for Hula? 12/5/2024
4 LowBro @thelowbro Anyone at all???? 12/6/2024
5 JamesBrolin @james01 Bro Bro Bro! Yo! 12/1/2024
6 MaxStorm @lilmista Coffeeeeeeeee!! 12/1/2024
7 JamesBrolin @james01 Dog ate ma homework! 12/1/2018
8 MollyAnne @mollyanne21 Hello! 12/1/2018
9 MollyAnne @mollyanne21 Hello! 12/1/2018

Observations

This is a database table.

It has 9 records of data. How many records store tweet info from @james01?
Each record has 5 fields. What is the name of the last field in each record?
One of the fields has alphanumeric datatype. Which one?
One of the fields has numeric datatype. Which one?
One of the fields has date datatype. Which one?
Each record has one piece of information that is unique to it. Which field stores this information?

   XAMPP

In order to simulate the above scenario, we need a web server which has a database.

We could buy our own domain eg www.mybestdomain.co.jp - most domains come with a database.

But we have to pay for it!

So, let's use a cool tool which will help us to simulate a webserver with a database.

XAMPP (pronounced ZAMP)

Downlaod onto your machine.

install the software and take a look at the following tutorial for an explanation how to get started.

    Getting started with XAMPP

Watch the video and let's get an overview of XAMPP's working environment.

Answer the questions on this worksheet.

    TEST THE SETUP

As in the video, let's use a text editor / IDE to create a .php file.

  1. Open XAMPP and start the web server
  2. Click Open Application Folder
  3. Inside the htdocs root folder, create a new folder called testdocs
  4. Using a text editor or IDE, create a file called test1.php and save it in the testdocs folder.
  5. Find a php code sample on the internet and paste it into your file. You could use one.
  6. Contact the virtual server by typing localhost in your web browsers address bar. It will redirect you to a subfolder called dashboard.
  7. Instead of looking in the server's dashboard folder, type the URL to navigate to your test1.php file: localhost/testdocs/test1.php
  8. If your setup is correct, you should see the php file displayed in your browser.

Food For Thought

This short course is going to give you an appreciation of databases! Probably without realising it, you interact with databases everyday. If you're a Facebook user, or a Gmail user, or an Instagram user, or a.... web user - you deal with databases!

SUBSCRIBE

Join my mailing list to receive updates on the latest blog posts and other things.