Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Introduction to SQL for Data Analysis ยท Lesson 2 of 9

Module One

๐Ÿ“– 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.
2

Module 1: Introduction to SQL and Databases

Module Overview

Imagine you are the principal of a school with 1,000 students. How would you keep records of their names, ages, classes, examination scores and school fees?

You could write everything in a notebook or Excel spreadsheet. But what happens when the school has 10,000 students? Finding information could become difficult.

This is where databases and SQL become useful. In this module, you will learn what databases are, how they work and how SQL helps people find and analyse information.

Learning Objectives

By the end of this module, you should be able to:

  • Explain what a database is.
  • Understand what SQL means.
  • Identify tables, rows and columns.
  • Explain what a Database Management System (DBMS) does.
  • Recognise popular SQL database systems.
  • Explain how SQL is used in data analysis.

1. What Is Data?

Data means facts or information collected about people, places, things or activities.

Examples of data include:

  • Your name and age.
  • Your school's name.
  • Your examination scores.
  • The price of a bag of rice.
  • The number of customers in a supermarket.

When data is properly organised, it becomes easier to understand and use for making decisions.

2. What Is a Database?

A database is an organised collection of information that can be stored, accessed, managed and updated using a computer.

Think about a school database. It may contain information about students, teachers, examination results and school fees.

Example: A School Students Database

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

The table above stores information about students. A school can have many tables inside one database.

3. Understanding Tables, Rows and Columns

A database table looks similar to a spreadsheet in Microsoft Excel. It organises information into rows and columns.

What Is a Table?

A table is where related information is stored. For example, a school database may have a Students table, Teachers table and Results table.

What Is a Row?

A row contains information about one particular record. For example, one row may contain all the details of one student.

What Is a Column?

A column stores one type of information about different records. Examples include Name, Age, Class and Student ID.

Remember:

  • Table = A collection of related records.
  • Row = One record.
  • Column = One category of information.

4. What Is SQL?

SQL means Structured Query Language. It is a language used to communicate with relational databases.

Imagine a school principal wants to find all students in JSS 2. Instead of checking every student's record manually, the principal can use an SQL command to request that information.

SQL allows us to:

  • Retrieve information from a database.
  • Add new records.
  • Change existing information.
  • Delete records when necessary.
  • Organise and analyse information.

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

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

Think of a database as a filing cabinet and the DBMS as the system that helps you organise, find and manage the files inside it.

Examples of database management systems include:

  • MySQL: A popular database system used by websites and applications.
  • PostgreSQL: A powerful open-source database system.
  • Microsoft SQL Server: A database system developed by Microsoft.
  • SQLite: A lightweight database commonly used in mobile and desktop applications.
  • Oracle Database: A database system used by many large organisations.

6. How SQL Works

SQL works by allowing you to send instructions to a database. These instructions are called queries.

For example, imagine a supermarket has a database containing information about its products.

The database may contain:

Product ID Product Name Price (โ‚ฆ)
1 Rice 85,000
2 Beans 45,000
3 Vegetable Oil 12,000

If you want to see all the products, you can write:

SELECT * FROM Products;

Let's understand this command:

  • SELECT: Tells the database that you want to retrieve information.
  • *: Means all columns.
  • FROM: Tells the database where to get the information.
  • Products: The name of the table.
  • ; Marks the end of the SQL statement in this example.

The command asks the database to show every column and every record in the Products table.

7. What Is Data Analysis?

Data analysis means examining information to discover useful facts, patterns and answers to questions.

Imagine a supermarket owner wants to know:

  • Which product sells the most?
  • How much money did the supermarket make?
  • Which products are becoming expensive?
  • How many customers bought products this week?

SQL helps the owner retrieve and organise the information needed to answer these questions.

8. Who Uses SQL?

Many professionals use SQL in their daily work, including:

  • Data Analysts: Use SQL to retrieve and analyse information.
  • Data Scientists: Use SQL to access datasets for research and modelling.
  • Database Administrators: Manage and maintain databases.
  • Software Developers: Connect applications to databases.
  • Business Analysts: Use information to understand business performance.

9. Real-Life Uses of SQL in Nigeria

SQL is useful in many industries, including:

  • Banks: Managing customer and transaction records.
  • Schools: Managing student information and examination results.
  • Hospitals: Organising patient and appointment records.
  • Supermarkets: Tracking products, sales and stock levels.
  • Telecommunications: Managing customer and service records.
  • Online businesses: Managing orders, customers and payments.

10. Module Summary

In this module, you have learned that:

  • Data is a collection of facts and information.
  • A database stores information in an organised way.
  • Tables contain rows and columns.
  • SQL means Structured Query Language.
  • A DBMS helps users manage databases.
  • SQL is used to retrieve and analyse information.
  • Many professionals use SQL in different industries.

Knowledge Check

Test what you have learned by answering these questions.

  1. What does SQL stand for?
  2. What is a database?
  3. What is the difference between a row and a column?
  4. What does DBMS mean?
  5. Mention three examples of database management systems.
  6. Which SQL command is used to retrieve information?
  7. What does the asterisk (*) mean in an SQL SELECT statement?
  8. Give two examples of organisations that use databases.
  9. What is data analysis?
  10. Mention two professionals who use SQL.

Practical Activity

Imagine you are managing a small school in Ibadan. Your school has the following student records:

Student ID Name Age Class
201Samuel13JSS 2
202Mary12JSS 1
203Peter14JSS 3
204Esther13JSS 2

Complete these activities:

  1. Identify the table name you would give this information.
  2. How many student records are shown?
  3. How many columns are in the table?
  4. Which column contains the students' ages?
  5. Explain why storing these records in a database could be useful.

Key Terms to Remember

  • Data: Facts or information.
  • Database: An organised collection of information.
  • Table: A structure used to organise related records.
  • Row: A single record in a table.
  • Column: A category of information in a table.
  • SQL: Structured Query Language.
  • DBMS: Database Management System.
  • Query: An instruction sent to a database.

Congratulations! You have completed Module 1. You now understand the basic ideas behind SQL and databases. In the next module, you will learn how to set up and work with an SQL environment.

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.
โ†’