Hello, data detective! In the last module, you learned about cyber threats. In this module, we will learn about a powerful tool that helps Security Operation Centre (SOC) Analysts investigate threats: MySQL. MySQL is a way to store, search, and manage information in a database. Think of it as a giant digital filing cabinet. Let's learn how to use it!
In Module One, you learned about the SOC. In Module Two, you learned about security tools. In Module Three, you learned about cyber threats. Now, in Module Four, we will focus on MySQL. But what is MySQL? It is a program that helps us organise and search for information quickly. Imagine a library with millions of books. MySQL is like the librarian who can find any book in seconds.
SOC Analysts use MySQL to search logs, find suspicious activities, and track attackers. In this module, we will learn how to write simple commands to store and retrieve data. We will use very simple language, so don't worry if you have never coded before. You will be a MySQL expert by the end!
Remember: Every great detective needs a way to organise clues. MySQL is your clue organizer!
After this module, you will be able to:
Ada is 10 years old and lives in Lagos. Her school has a computer lab with 50 computers. One day, the lab manager noticed something strange โ someone had been accessing the lab computers late at night. He needed to find out who it was. He had logs (records) of every time someone logged in, but there were thousands of entries. He was overwhelmed.
Ada's older sister, Amina, is a SOC Analyst. She came to help. She opened a program called MySQL. She typed a simple command to search for logins after 10 PM. In just a few seconds, the results appeared โ there was only one person who had logged in late at night! The lab manager was amazed. He asked Amina how she did it. She said, "I used MySQL to search through the data quickly."
Ada was so impressed. She asked Amina to teach her MySQL. Amina said, "It's like talking to the computer in a language it understands. Let me show you!"
Question for you: Have you ever had to find something in a big pile of information? How did you do it?
Definition: A database is a place where we store information in an organised way. It is like a digital filing cabinet.
Why it is important: Databases help us store and find information quickly. Without a database, it would be very hard to find anything.
Simple explanation: Imagine a shelf with books. If the books are organised by subject, it's easy to find one. That's a database.
Real-life example: Your school's student records are stored in a database.
School example: The library catalogue is a database of all books.
Home example: A recipe box with cards is a tiny database.
Nigerian example: A bank stores all customer account information in a database.
Database = Organised Information Example: - Student names - Classes - Grades
Mini summary: A database is an organised collection of information.
Definition: MySQL is a type of database software. It helps us create, read, update, and delete data.
Why it is important: MySQL is used by many companies and organisations to manage their data. Knowing MySQL is a valuable skill.
Simple explanation: MySQL is like a language we use to talk to the database.
Real-life example: Many websites use MySQL to store user information.
School example: A school might use MySQL to store student grades.
Home example: A family might use a simple database to keep track of their books.
Nigerian example: Nigerian companies use MySQL to store customer data.
MySQL = Language to talk to the database - Create data - Read data - Update data - Delete data
Mini summary: MySQL is a language that helps us manage data in a database.
Definition: A table is like a grid of rows and columns. Each row is a record, and each column is a field.
Why it is important: Tables help us organise data into a structure that is easy to search.
Simple explanation: Imagine a spreadsheet with rows and columns โ that's a table.
Real-life example: A table of students with columns for name, age, and grade.
School example: A class register is a table.
Home example: A list of phone numbers is a table.
Nigerian example: A customer table with name, account number, and balance.
Table Example: +----------+-----+-------+ | Name | Age | Grade | +----------+-----+-------+ | Tunde | 10 | A | | Ada | 9 | B | | Chidi | 11 | A+ | +----------+-----+-------+
Mini summary: A table organises data into rows and columns.
Definition: Creating a table means defining the columns and what type of data each column will hold.
Why it is important: Before we can add data, we need a table to put it in.
Simple explanation: It's like drawing the grid on a piece of paper before writing in it.
Real-life example: A school creates a table to store student information.
School example: A teacher creates a table with columns for students' names and test scores.
Home example: A family creates a table to keep track of chores.
Nigerian example: A shopkeeper creates a table for customers and their orders.
SQL to create a table:
CREATE TABLE students (
name VARCHAR(50),
age INT,
grade VARCHAR(2)
);
Mini summary: Creating a table is like drawing a grid to fill in later.
Definition: Inserting data means adding rows of information into a table.
Why it is important: A table is empty until we add data to it.
Simple explanation: It's like writing in a notebook.
Real-life example: Adding a new student's information to the school database.
School example: Entering the latest test scores into the table.
Home example: Adding a new chore to the chore list.
Nigerian example: Adding a new customer to the shop's database.
SQL to insert data:
INSERT INTO students (name, age, grade)
VALUES ('Tunde', 10, 'A');
Mini summary: Inserting data means adding new rows to a table.
Definition: Reading data means retrieving information from a table. We do this with the SELECT command.
Why it is important: Reading data is how we find the information we need.
Simple explanation: It's like asking the database a question.
Real-life example: A SOC Analyst uses SELECT to find all logins after 10 PM.
School example: A teacher wants to see all students who got an A.
Home example: A parent wants to see a list of all chores.
Nigerian example: A bank manager wants to see all customers with high balances.
SQL to read data: SELECT * FROM students; SELECT name, grade FROM students WHERE age = 10;
Mini summary: SELECT helps us read and retrieve data from a table.
Definition: Updating data means changing existing information in a table.
Why it is important: Sometimes information changes, and we need to keep the database up to date.
Simple explanation: It's like crossing out a word and writing a new one.
Real-life example: A student's grade is updated from a B to an A.
School example: A student changes their phone number.
Home example: A chore is marked as completed.
Nigerian example: A customer's address is updated.
SQL to update data: UPDATE students SET grade = 'A' WHERE name = 'Ada';
Mini summary: Updating data changes existing information in a table.
Definition: Deleting data means removing rows from a table.
Why it is important: Sometimes we need to remove old or incorrect information.
Simple explanation: It's like tearing out a page from a notebook.
Real-life example: Removing a student who has left the school.
School example: Deleting a test score that was entered incorrectly.
Home example: Removing a chore that is no longer relevant.
Nigerian example: Removing a customer who closed their account.
SQL to delete data: DELETE FROM students WHERE name = 'Chidi';
Mini summary: Deleting data removes rows from a table.
Definition: The WHERE clause helps us search for specific rows that match a condition.
Why it is important: It helps us find exactly what we are looking for.
Simple explanation: It's like using a filter to find only the things you want.
Real-life example: Find all students who are 10 years old.
School example: Find all students who got an A.
Home example: Find all chores that are not completed.
Nigerian example: Find all customers with a balance over โฆ100,000.
SQL with WHERE: SELECT * FROM students WHERE age = 10; SELECT name FROM students WHERE grade = 'A';
Mini summary: WHERE helps us search for specific data.
Definition: ORDER BY sorts the results in ascending or descending order.
Why it is important: It helps us see data in a meaningful order.
Simple explanation: It's like putting numbers in order from smallest to largest.
Real-life example: Sorting students by age.
School example: Sorting test scores from highest to lowest.
Home example: Sorting chores by priority.
Nigerian example: Sorting customers by account balance.
SQL with ORDER BY: SELECT * FROM students ORDER BY age DESC;
Mini summary: ORDER BY helps us sort data.
Definition: SOC Analysts use MySQL to search logs and find suspicious activities.
Why it is important: MySQL helps investigators find clues quickly.
Simple explanation: It's like using a magnifying glass to find tiny clues.
Real-life example: Searching login logs for failed attempts.
School example: Searching for who accessed a system late at night.
Home example: Searching for who logged into a smart device.
Nigerian example: Searching for suspicious transactions in a bank's database.
Security Query Example: SELECT * FROM login_logs WHERE login_time > '22:00:00' AND success = false;
Mini summary: MySQL helps SOC Analysts find security clues.
Definition: You can combine SELECT, WHERE, and ORDER BY to create powerful searches.
Why it is important: Combining commands gives us more control.
Simple explanation: It's like using a toolkit with many tools together.
Real-life example: Find failed logins after 10 PM and sort by time.
School example: Find students with B grades and sort by name.
Home example: Find high-priority chores and sort by deadline.
Nigerian example: Find customers with low balances and sort by last transaction.
Combined Query: SELECT * FROM login_logs WHERE success = false ORDER BY login_time DESC;
Mini summary: Combining commands makes searches more powerful.
Definition: The more you practise MySQL, the better you become.
Why it is important: Practice helps you remember commands and use them quickly.
Simple explanation: Like riding a bike โ you get better with practice.
Real-life example: A SOC Analyst practises queries every day.
School example: Students practise writing SQL commands in class.
Home example: A parent practises with a simple database.
Nigerian example: A bank employee practises with customer data.
Practice Schedule: - Write a CREATE TABLE command - INSERT 5 rows - SELECT specific data - UPDATE a row - DELETE a row
Mini summary: Practice is key to becoming a MySQL expert.
Definition: A summary of the most important MySQL commands.
Why it is important: Knowing the basics is enough to start using MySQL.
Simple explanation: These are the building blocks of MySQL.
Real-life example: Every SOC Analyst uses these commands.
School example: Students learn these commands first.
Home example: These commands can be used for simple projects.
Nigerian example: These commands are used in many Nigerian companies.
Key Commands: - CREATE TABLE - INSERT INTO - SELECT - UPDATE - DELETE - WHERE - ORDER BY
Mini summary: These are the essential MySQL commands.
Definition: You have learned the basics of MySQL and can use it to manage data.
Why it is important: This skill is valuable for any SOC Analyst.
Simple explanation: You can now organise, search, and manage data like a pro.
Real-life example: You can help a company search through logs.
School example: You can help your teacher organize grades.
Home example: You can help your family track chores or movies.
Nigerian example: You can help a small business track customers.
You โ Learned MySQL โ Can manage data! ๐
Mini summary: You are now a MySQL user โ congratulations!
Step 1: Plan columns (name, age, grade)
Step 2: CREATE TABLE students (name VARCHAR(50), age INT, grade VARCHAR(2));
Step 3: Table created.
Step 4: INSERT INTO students (name, age, grade) VALUES ('Tunde', 10, 'A');
Step 5: SELECT * FROM students;
Step 6: UPDATE students SET grade = 'B' WHERE name = 'Tunde';
Step 7: DELETE FROM students WHERE name = 'Tunde';
Plan Table
|
V
Create Table
|
V
Insert Data
|
V
Query Data (SELECT)
|
V
Analyse Results
|
V
Update/Delete as Needed
| Command | What It Does | Example |
|---|---|---|
| CREATE TABLE | Creates a new table | CREATE TABLE students (name VARCHAR(50)); |
| INSERT INTO | Adds data | INSERT INTO students VALUES ('Tunde'); |
| SELECT | Reads data | SELECT * FROM students; |
| UPDATE | Changes data | UPDATE students SET name = 'Tunde' WHERE id = 1; |
| DELETE | Removes data | DELETE FROM students WHERE id = 1; |
| Data Type | What It Stores | Example |
|---|---|---|
| INT | Whole numbers | 10, 25, 100 |
| VARCHAR | Text (short) | 'Tunde', 'Lagos' |
| DATE | Dates | '2025-01-01' |
| DECIMAL | Numbers with decimals | 10.50 |
Lesson 1: What is a database?
|
Lesson 2: What is MySQL?
|
Lesson 3: Tables
|
Lesson 4: CREATE TABLE
|
Lesson 5: INSERT
|
Lesson 6: SELECT
|
Lesson 7: UPDATE
|
Lesson 8: DELETE
|
Lesson 9: WHERE
|
Lesson 10: ORDER BY
|
Lesson 11: Security Investigations
|
Lesson 12: Combining Commands
|
YOU ARE A MYSQL USER! ๐
Congratulations! You have completed Module Four of your Security Operation Centre Analyst training. You have learned about MySQL โ a powerful language for managing data. You learned how to create tables, insert data, read data, update data, and delete data. You also learned how to use WHERE to filter and ORDER BY to sort. You now have the skills to search for clues in data โ a vital skill for any SOC Analyst!
Match the command to its action:
| Command | Action |
|---|---|
| CREATE TABLE | Creates a new table |
| INSERT | Adds data |
| SELECT | Reads data |
| UPDATE | Changes data |
| DELETE | Removes data |
Scenario 1: You work at a school and need to store student data. Create a table called 'students' with columns for name, age, and grade. Insert three students and then select all students who are 10 years old.
Scenario 2: A company has a table of employees. One employee has left the company. Write a command to delete their record.
Scenario 3: A bank has a table of customer accounts. One customer's address has changed. Write a command to update their address.
MySQL Challenge: In groups of 4, design a simple database for a school. Create a table for students, a table for teachers, and a table for classes. Insert sample data and write queries to find specific information. Present your database to the class.
My SQL Practice: Create a table with your favourite movies (title, genre, rating). Insert 5 movies. Write a query to find all movies with a rating of 5. Write a query to sort movies by rating. Write a query to update a movie's rating. Write a query to delete a movie.
Task: Create a database to store security logs. The table should have columns: log_id, timestamp, user, action, success. Insert 10 sample logs. Write queries to find all failed logins, all actions after a certain time, and all actions by a specific user.
Assignment: Write a report on how MySQL is used in a Nigerian company or organisation. Include examples of how they use it, what data they store, and how they protect it.
Challenge: Write a MySQL query that finds all suspicious login attempts. Use a table called 'login_logs' with columns: id, username, login_time, success. Find all failed logins after 10 PM, and sort them by time.
Fill-in-the-Blank Answers: 1. database, 2. MySQL, 3. table, 4. CREATE TABLE, 5. INSERT, 6. SELECT, 7. UPDATE, 8. DELETE, 9. WHERE, 10. ORDER BY, 11. SOC, 12. changes, 13. WHERE, 14. Practice, 15. Nigerian.
True or False: 1T, 2F, 3T, 4F, 5F, 6T, 7T, 8T, 9T, 10F.
Multiple Choice Answers: 1B, 2B, 3A, 4B, 5A, 6B, 7A, 8B, 9A, 10B, 11A, 12A, 13B, 14B, 15A.
In Module Five, we will dive deeper into threat detection and analysis. You will learn how to use MySQL and other tools to identify and investigate security incidents. We will also learn about advanced SQL techniques and how to use them in real-world scenarios.
Before next class: Review the commands you learned in this module. Think about how you could use them to find suspicious activities in a log database.
๐๏ธ You have completed Module Four โ keep up the great work! ๐๏ธ