Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Data Analysis Tools Overview ยท Lesson 4 of 10

Module Three

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
4
Module 3: Database and SQL Tools

Module 3: Database and SQL Tools

1. Introduction to Databases

Welcome to Module Three!

In the previous module, you learned how to use Microsoft Excel and Google Sheets to organise information in rows and columns.

But imagine that a bank has information about five million customers. Can you imagine trying to manage all that information using a small spreadsheet?

It would be difficult!

This is why organisations use databases.

A database helps people store, organise, manage, and retrieve large amounts of information using a computer.

In this module, you will learn what databases are, how they work, and how SQL helps people find information stored inside them.

2. What Is a Database?

A database is an organised collection of information stored electronically so that it can be accessed, managed, and updated.

Think of a database as a digital filing cabinet.

Instead of keeping hundreds of paper files inside a cabinet, an organisation can store information in a computer database.

Examples of Information Stored in Databases

  • Customer names and phone numbers.
  • Student registration records.
  • Bank account information.
  • Hospital patient records.
  • Product information in supermarkets.
  • Employee information in companies.

Real-Life Example: A School Database

Imagine that your school has 2,000 students.

The school needs to store information such as:

  • Student names.
  • Registration numbers.
  • Class levels.
  • Parents' contact information.
  • Examination scores.

A database can store all these records and help authorised school staff find the information they need.

3. Understanding Database Tables, Rows, and Columns

Many databases organise information using tables.

A database table looks similar to a spreadsheet because it contains rows and columns.

Example: Student Information Table

Student ID Student Name Class Age
101 John JSS 1 12
102 Mary JSS 2 13
103 David JSS 1 12
104 Sarah JSS 3 14

Let's understand the different parts:

  • Table: A collection of related information.
  • Column: A category of information, such as Student Name.
  • Row: A complete record belonging to one student.
  • Field: A single category of information in a record.
  • Record: All the information stored about one person or item.

4. What Is a Database Management System (DBMS)?

A Database Management System, also called a DBMS, is software that helps people create, manage, and use databases.

Think of a DBMS as a manager that helps organise information inside a digital filing cabinet.

Examples of Database Management Systems

  • MySQL: A popular database system used by websites and business applications.
  • PostgreSQL: A powerful database system used for many types of applications.
  • Microsoft SQL Server: A database system developed by Microsoft.
  • SQLite: A lightweight database system used in many applications.
  • Oracle Database: A database system used by many large organisations.

Example

When you register on a website, the website may save your name, email address, and other information in a database.

The website's database management system helps store and retrieve that information when needed.

5. Introduction to SQL

SQL stands for Structured Query Language.

SQL is a language used to communicate with relational databases.

Imagine that a database contains information about 10,000 students. You want to find only the students in JSS 2.

Instead of searching through every record manually, you can use SQL to request the information.

This request is called a query.

Why Is SQL Important?

  • It helps retrieve information from databases.
  • It allows users to add new records.
  • It helps update existing information.
  • It can remove records when necessary.
  • It helps organise and analyse information.

6. Understanding Basic SQL Commands

SQL has different commands. Each command performs a particular task.

A. SELECT Command

The SELECT command is used to retrieve information from a database.

Example:

SELECT * FROM Students;

This command asks the database to display all columns and records from the Students table.

B. WHERE Command

The WHERE condition helps you find records that match a particular requirement.

Example:

SELECT * FROM Students
WHERE Class = 'JSS 2';

This query displays students whose class is JSS 2.

C. INSERT Command

The INSERT command is used to add new information to a database table.

Example:

INSERT INTO Students
(StudentID, StudentName, Class, Age)
VALUES
(105, 'Peter', 'JSS 1', 12);

This command adds a new student record.

D. UPDATE Command

The UPDATE command changes existing information in a database.

Example:

UPDATE Students
SET Class = 'JSS 2'
WHERE StudentID = 101;

This changes the class of the student whose ID is 101.

E. DELETE Command

The DELETE command removes records from a database table.

Example:

DELETE FROM Students
WHERE StudentID = 105;

This removes the record belonging to student ID 105.

Important: Always check your WHERE condition before running UPDATE or DELETE commands. Without a suitable condition, you may change or remove more records than intended. Practise these commands on sample data first.

7. Understanding Primary Keys

A primary key is a column or combination of columns used to uniquely identify each record in a database table.

Think about your school registration number. Two students should not have the same registration number.

This makes the registration number useful as a primary key.

Example

Student ID Name Class
101 John JSS 1
102 Mary JSS 2
103 David JSS 1

Each student has a different Student ID. This makes it possible to identify each student correctly.

8. Understanding Foreign Keys

A foreign key is a column in one database table that refers to a key in another table.

It helps connect related information stored in different tables.

Example: School Database

Imagine that a school has two tables.

Students Table

Student ID Student Name
101 John
102 Mary

Examinations Table

Exam ID Student ID Score
1 101 85
2 102 92

The Student ID in the Examinations table can refer to the Student ID in the Students table.

This relationship helps the school connect examination scores to the correct students.

9. Exploring MySQL and PostgreSQL

Now that you understand databases and SQL, let's look at two popular database systems.

A. MySQL

MySQL is a database management system used by many websites and applications.

It helps developers store information such as customer accounts, product details, and orders.

B. PostgreSQL

PostgreSQL is another database management system. It is known for its powerful features and ability to manage complex data.

Where Are These Tools Used?

  • Online shopping websites.
  • Banking applications.
  • School management systems.
  • Hospital management systems.
  • Business applications.
  • Customer management platforms.

10. How SQL Supports Data Analysis

Data analysts often use SQL to find useful information inside databases.

For example, a supermarket wants to know which products generated the highest sales.

The analyst can use SQL to retrieve product sales records and calculate totals.

Here is another example:

SELECT ProductName, QuantitySold
FROM Sales;

This query retrieves the product names and quantities sold from the Sales table.

SQL can also be used with other tools:

  • Excel can receive data retrieved from a database.
  • Python can connect to databases and analyse their information.
  • Power BI can use database information to create dashboards.

This is why SQL is an important skill for data analysts.

11. Practical Activity

Project: Create a Simple Student Database

Imagine that you are helping your school organise student information.

Create a table called Students with the following columns:

  • StudentID
  • StudentName
  • Class
  • Age

Enter the following sample records:

StudentID StudentName Class Age
101 John JSS 1 12
102 Mary JSS 2 13
103 David JSS 1 12
104 Sarah JSS 3 14

Practise writing the following SQL commands:

  1. Display all students.
  2. Find students in JSS 1.
  3. Add a new student called Peter.
  4. Change John's class to JSS 2.
  5. Delete a sample student record after checking the correct Student ID.

Challenge: Explain why StudentID is a better identifier than StudentName for this table.

12. Knowledge Check

Answer the following questions to test what you have learned.

  1. What is a database?
  2. What is a Database Management System?
  3. Give three examples of database management systems.
  4. What is SQL?
  5. What does the SELECT command do?
  6. Which SQL command adds a new record?
  7. What is the purpose of the WHERE condition?
  8. What is a primary key?
  9. What is a foreign key?
  10. Give two examples of organisations that use databases.

13. Module Summary

Well done! You have completed Module Three of Data Analysis Tools Overview.

In this module, you learned:

  • What databases are and why organisations use them.
  • The meaning of database tables, rows, columns, fields, and records.
  • What a Database Management System does.
  • Examples of database systems such as MySQL and PostgreSQL.
  • What SQL means and how it communicates with databases.
  • How to use basic SQL commands.
  • The difference between primary keys and foreign keys.
  • How SQL supports data analysis.

Coming Up Next

Module 4: Programming Tools for Data Analysis

In the next module, you will discover how programming languages such as Python and R help data analysts work with information. You will also explore tools such as Jupyter Notebook, Pandas, and NumPy.

Keep practising. Every new skill brings you closer to becoming a confident data analyst!

CRMNuggets โ€“ Learn. Practice. Get Certified.

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’