• 1. Which of the following is a correct SQL statement to select all records from a table named ‘Customers’?

    EXTRACT * FROM Customers;

    SELECT ALL RECORDS Customers;

    ✔ SELECT * FROM Customers;

    2. Which comparison operator checks if text matches a pattern?

    IN

    ✔ LIKE

    BETWEEN

    3. Which comparison operator is used to check for one value being greater than the other value?

    <>

    ✔ >

    ==

    4. Which SQL keyword is used to create an alias for a column or table?

    ✔ AS

    ALIAS

    ALIAS COLUMN

    +
  • Session 3: Working with Data – Part 1

     Selecting & Retrieving Data

     SELECT Statements

    • The SELECT statement is used to retrieve data from a database.

    Basic Syntax:


    SELECT column_name FROM table_name;

    Example: Selecting student names and IDs from a students table:


    SELECT student_id, name FROM students;

    To select all columns, use *:


    SELECT * FROM students;

    Using Aliases (AS)

    • Aliases provide temporary names for columns or tables to improve readability.

    Syntax:

    SELECT column_name AS alias_name FROM table_name;

    Example: Renaming columns in the result set:


    SELECT product_name AS Product, price AS “Price (USD)” FROM products;

    Table Aliases:

    SELECT s.name FROM students AS s;

    Filtering Data with Comparison Operators

     Boolean Data Types & Comparison Operators

    • Boolean values (TRUE or FALSE) are used in conditions.
    • Comparison operators return boolean results and are used in WHERE clauses to filter data.
    OperatorDescriptionExample
    =Equal toWHERE age = 30
    != or <>Not equal toWHERE city != ‘London’
    >Greater thanWHERE salary > 50000
    <Less thanWHERE age < 40
    >=Greater than or equal toWHERE score >= 90
    <=Less than or equal toWHERE height <= 5.5
    BETWEENWithin a range (inclusive)WHERE age BETWEEN 20 AND 30
    INMatches multiple valuesWHERE department IN (‘HR’, ‘Finance’)
    LIKEPattern matchingWHERE name LIKE ‘J%’

    Using WHERE to Filter Data

    Filter by a specific condition:


    SELECT * FROM employees WHERE age = 30;

    Exclude certain values:


    SELECT * FROM employees WHERE age != 30;

    Filter using ranges (BETWEEN):


    SELECT * FROM employees WHERE age BETWEEN 30 AND 40;

    Check if a value exists in a set (IN):


    SELECT * FROM employees WHERE name IN (‘Alice’, ‘Bob’);

     Using LIKE for Pattern Matching

    Find names that start with “J”:


    SELECT * FROM students WHERE name LIKE ‘J%’;

    Find names that end with “s”:


    SELECT * FROM students WHERE name LIKE ‘%s’;

    Find names that contain “ar” anywhere in them:


    SELECT * FROM students WHERE name LIKE ‘%ar%’;

    Key Takeaways

    SELECT retrieves data from a database.
    Aliases (AS) make query results more readable.
    Comparison operators allow filtering specific data.
    LIKE is used for pattern-based searches.
    BETWEEN, IN, and other conditions help refine queries.

    +
  • 1. What is a database schema?

    Defines a type of software used for database management. Data is structured and stored by relationships, through tables.

    ✔ Defines how data is structured, stored and related. It describes the tables, fields, data types and relationships in the database.

    Defines how  unstructured data is stored without the use of  the tables or fields. There are the same data types in the database

    .

    2. Which SQL statement is used to create a new table called “Products” with a column “ProductID” of type integer?

    ✔ CREATE TABLE Products (ProductID int);

    USE TABLE Products (ProductID int);

    CREATE TABLE Products (ProductID integar);

    3. True or False: A Primary Key is a unique identifier

    ✔ True

    False

    4. What is the correct SQL command to insert the values into the “Orders” table?

    INSERT Orders NEW (value1, value2);

    ✔ INSERT INTO Orders VALUES (value1, value2);

    ADD INTO Orders VALUES (value1, value2);

    +
  • Key Concepts and Demos

    1. Introduction to Databases

    • Database: A structured collection of data.
    • Database Schema: Blueprint of how data is stored and related.
    • Tables: Store data in rows (records) and columns (attributes).
    • SQL (Structured Query Language): Used to interact with databases.

    2. Creating a Database

    • Use CREATE DATABASE database_name;
    • Activate the database using USE database_name;

    Example:

    CREATE DATABASE intro_to_data;

    USE intro_to_data;

    3. Creating Tables

    • Tables contain columns (attributes) that store specific types of data.
    • CREATE TABLE table_name with column names & data types.

    Example:


    CREATE TABLE equipment_maintenance (

        equipment_id INT,

        maintenance_cost DECIMAL(10,2),

        description VARCHAR(255),

        is_operational BOOLEAN,

        last_maintenance_date DATE

    );

    • ; (semicolon) is required at the end of SQL statements.

    4. Inserting Data

    • Use INSERT INTO table_name VALUES (…);
    • Must match the order of columns.

    Example:


    INSERT INTO equipment_maintenance VALUES 

    (101, 2500.75, ‘Engine maintenance’, TRUE, ‘2024-01-01’),

    (102, 500.00, ‘Aircon maintenance’, FALSE, ‘2023-12-15’);

    Constraints in SQL

    • Constraints are rules that enforce data integrity.
    ConstraintFunction
    NULLAllows empty values
    NOT NULLPrevents empty values
    UNIQUEEnsures unique values in a column
    PRIMARY KEYUniquely identifies a row (combination of NOT NULL & UNIQUE)
    FOREIGN KEYLinks a column to another table’s primary key

    Example: Adding constraints while creating a table
    sql

    CREATE TABLE equipment (

        equipment_id INT PRIMARY KEY,

        name VARCHAR(255) NOT NULL,

        type VARCHAR(255) NOT NULL

    );

    • If constraints are not met, SQL will return an error.

    Primary Keys

    • Unique Identifier for each row.
    • Must be Unique & Not Null.

    Example:
    sql

    CREATE TABLE customers (

        customer_id INT PRIMARY KEY,

        first_name VARCHAR(50),

        last_name VARCHAR(50),

        email VARCHAR(100)

    );

    • Best practices:
      • Keep primary keys constant.
      • Use integer (auto-incrementing) IDs.

    Foreign Keys (Linking Tables)

    • Links a column in one table to the primary key in another.
    • Enforces Referential Integrity.

    Example:
    sql

    CREATE TABLE maintenance_log (

        log_id INT PRIMARY KEY,

        equipment_id INT NOT NULL,

        maintenance_date DATE,

        FOREIGN KEY (equipment_id) REFERENCES equipment (equipment_id)

    );

    • This ensures that equipment_id in maintenance_log must exist in equipment.

    Checking Tables & Debugging

    • View all tables: SHOW TABLES;
    • Check table structure: DESCRIBE table_name;
    • Delete table: DROP TABLE table_name;
    • Delete database: DROP DATABASE database_name;

    Common Errors & Solutions

    ErrorPossible Fix
    Missing semicolon (;)Ensure statements end with ;
    Reserved word errorCheck SQL syntax and keywords
    Connection issues in DBeaverEnsure MySQL is installed & configured correctly
    Error inserting dataCheck constraints (e.g., NOT NULL, UNIQUE)
    +
  • 1.5 Cyber Warfare

    1.5.1 Sign of the Times (Stuxnet)

    Cyberwarfare involves using technology to attack a nation’s computer systems, causing disruption or physical damage. One major example is the Stuxnet malware, a sophisticated cyberweapon used to target Iran’s nuclear enrichment program.

    Key Features of Stuxnet:

    • Spread primarily via USB drives to target air-gapped systems.
    • Used zero-day exploits to escalate privileges and install malware.
    • Installed drivers with stolen legitimate certificates.
    • Had modular coding, enabling updates while active.
    • Targeted Programmable Logic Controllers (PLCs) to manipulate industrial processes.
    • Focused on sabotage rather than data theft.

    1.5.2 The Purpose of Cyberwarfare

    Cyberwarfare is used to gain a strategic advantage over adversaries by disrupting critical infrastructure or stealing sensitive information.

    1. Gaining Compromised Information and Defense Secrets

    • Nations engage in cyberwarfare to steal classified defense secrets and technological research.
    • Stolen sensitive data can be used for espionage or blackmailing government personnel.

    2. Disrupting Infrastructure

    • Cyber attacks can target essential services like power grids, financial systems, or communication networks.
    • A power grid shutdown could lead to traffic congestion, halted commerce, emergency service failures, and loss of internet access.
    • Infrastructure attacks can destabilize a nation, causing economic harm and lowering public trust in the government.

    Cyberwarfare represents a growing threat in modern conflicts, where attackers can cause significant disruption without physically entering a targeted country.

    +
  • 1.4 Cyber Attackers

    1.4.1 Types of Attackers

    Attackers exploit vulnerabilities for personal or financial gain. They are categorized into white hat, gray hat, and black hat attackers.

    • Amateurs (Script Kiddies): Inexperienced hackers who use existing tools to launch attacks, sometimes for fun or to cause harm.
    • Hackers:
      • White Hat: Ethical hackers who identify security flaws with permission.
      • Gray Hat: Hackers who find vulnerabilities but disclose them only when it aligns with their agenda.
      • Black Hat: Criminal hackers exploiting vulnerabilities for illegal gain.
    • Organized Hackers: Groups such as cybercriminals, hacktivists, terrorists, and state-sponsored attackers.
      • Hacktivists: Use hacking for political or social statements.
      • State-Sponsored Attackers: Gather intelligence or conduct cyber sabotage for governments.

    1.4.2 What Color Is My Hat?

    • Gray Hat: An attacker hacks ATM systems, then works with manufacturers to fix security flaws.
    • Black Hat: A hacker transfers $10 million using stolen customer credentials.
    • White Hat: A cybersecurity expert identifies weaknesses in a company’s system.
    • Black Hat: A hacker uses malware to steal and sell credit card information.
    • White Hat: A researcher discovers a security flaw in an authorized network.

    1.4.3 Internal and External Threats

    Cyber attacks originate from both inside and outside an organization.

    • Internal Threats: Employees, contractors, or partners can:
      • Mishandle confidential data.
      • Introduce malware through infected USB devices.
      • Click on malicious emails or links, leading to cyber intrusions.
      • Disrupt internal servers or network infrastructure.
    • External Threats: Skilled attackers outside the organization can:
      • Exploit vulnerabilities in the network.
      • Gain unauthorized access to systems.
      • Use social engineering to manipulate employees into revealing sensitive information.
    +
  • 1.2 Organisational Data

    1.2.1 Types of Organisational Data

    1.2.1.1 Traditional Data

    Traditional data is generated and maintained by organizations and includes:

    • Transactional Data: Buying/selling details, production activities, employment decisions.
    • Intellectual Property: Patents, trademarks, and trade secrets crucial for economic advantage.
    • Financial Data: Income statements, balance sheets, and cash flow statements.

    1.2.1.2 Internet of Things (IoT) and Big Data

    IoT refers to a network of connected devices that collect and share data. With the growth of IoT, Big Data has become a significant technological and business focus.

    1.2.2 The Cube

    The McCumber Cube is a cybersecurity model that evaluates security initiatives using three dimensions:

    1. Foundational Principles:
      • Confidentiality: Prevents unauthorized access using encryption and authentication.
      • Integrity: Protects data from modifications using hash functions.
      • Availability: Ensures data access through maintenance, updates, and backups.
    2. Data Protection in Different States:
      • Processing: Active use of data (e.g., database updates).
      • Storage: Data stored in memory or devices (e.g., hard drives).
      • Transmission: Data being transferred across networks.
    3. Security Measures:
      • Awareness & Training: Educating users on security risks.
      • Technology: Firewalls, encryption, and security software.
      • Policies & Procedures: Incident response plans and security guidelines.

    1.2.4 Is This for Real?

    Phishing is a common cyber threat. Example:

    • In 2020, Razer experienced a data breach exposing 100,000 customer records due to a misconfigured cloud server.
    • Cybercriminals exploited this exposure for fraud and social engineering attacks.

    1.2.5 Data Security Breaches

    Persirai Botnet (2017)

    • Targeted over 1,000 IoT cameras.
    • Installed malware that ran undetected in memory.
    • Used hijacked cameras for DDoS attacks.

    Equifax Breach (2017)

    • Attackers exploited a software vulnerability, exposing millions of customer records.
    • Fraudulent websites tricked customers into providing personal data.
    • Identity theft risks increased significantly.

    1.2.6 Consequences of a Security Breach

    • Reputational Damage: Customers may lose trust and seek alternatives.
    • Vandalism: Hackers may alter websites or manipulate business information.
    • Theft: Stolen sensitive data can lead to identity fraud.
    • Loss of Revenue: Businesses may face operational shutdowns and financial penalties.
    • Intellectual Property Damage: Leaks of confidential documents and trade secrets can harm competitiveness.
    +
  • 1.1 The World of Cybersecurity

    1.1.1 What Is Cybersecurity?

    Cybersecurity is the practice of protecting individuals, organizations, and governments from digital attacks by safeguarding networked systems and data from unauthorized use or harm.

    • Personal: Protect your identity, data, and devices.
    • Organisational: Everyone is responsible for protecting the organization’s reputation, data, and customers.
    • Government: Protection of digital information is critical for national security, economic stability, and citizen safety.

    1.1.2 Protecting Your Personal Data

    Personal data includes any information that can identify you and exists both online and offline.

    • Offline Identity: Information shared in daily life (name, age, address). Identity thieves can steal this data in person.
    • Online Identity: Includes usernames, aliases, and social profiles. Limit the amount of personal information shared online.

    1.1.3 Your Online Identity

    Choosing a secure username is crucial. Recommended examples: ✔ jdoe
    ✔ j.doe12
    Avoid including full names, job roles, or birth years to protect privacy.

    1.1.4 Your Data

    Personal data includes names, social security numbers, birth details, and private messages. Cybercriminals use this information for fraud and impersonation.

    • Medical Records: Contain sensitive health data, including information from wearable fitness devices.
    • Education Records: Store academic details, contact info, and disciplinary records.
    • Employment & Financial Records: Include income, tax records, and banking details, which are valuable to hackers.

    1.1.5 Where Is Your Data?

    Once shared, data can be copied, stored, and distributed without control.

    • Photos shared with friends can be downloaded and re-shared globally.
    • Medical records may be accessed by insurance companies.
    • Store loyalty programs track purchasing behavior for targeted advertising.

    1.1.6 Importance of Data Security

    Every time personal data is collected or shared, security risks arise.

    • Laws exist to protect privacy, but it is essential to know where your data is stored and who has access.

    1.1.7 Smart Devices

    Computing devices not only store personal data but also generate new data about users.

    • Wearable Technology: Smartwatches and fitness trackers collect health data.
    • Online Services: Social media platforms monetise user data by sharing it with advertisers.

    1.1.8 What Do Hackers Want?

    Cybercriminals target personal data for financial gain.

    • Scams: Hackers impersonate family members to trick victims into sending money.
    • Frequent Flyer Theft: Cybercriminals have hacked airline accounts to book flights using stolen credentials.

    1.1.9 Identity Theft

    Cybercriminals use stolen data for long-term financial and personal exploitation.

    • Medical Theft: Stolen insurance details can be used for unauthorized medical procedures.
    • Banking Fraud: Identity thieves can file fake tax returns, take out loans, or damage credit scores.

    1.1.10 Who Else Wants My Data?

    It’s not just criminals who seek personal data:

    • Internet Service Providers (ISPs): Track and sometimes sell user data.
    • Advertisers: Monitor online activities for targeted ads.
    • Search Engines & Social Media: Collect and sell data, including search history, geolocation, and personal interests.

    Key Takeaways:

    • Be cautious about sharing personal data online and offline.
    • Secure accounts with strong, anonymous usernames.
    • Understand how smart devices and online services collect and use personal data.
    • Recognise cybersecurity threats, including identity theft and financial fraud.
    • Stay informed about privacy laws and who has access to your data.

    +
  • Currency Exchange Project (Intro blog coming soon!) is a small project created by a group of junior programmers aiming to build a Python application that integrates APIs, frameworks, and potentially other technologies. The goal here is to gain a better understanding of workflows commonly used in the ‘developer world’.

    This project serves as a great learning opportunity for our future, including GitHub repositories and blog posts.

    Before diving into our code, let’s first explain some key terminology. ʕっ•ᴥ•ʔっ

    What is an API?

    An API (Application Programming Interface) is a way for different software or services to communicate. It works like a waiter in a restaurant, taking requests, delivering them to the system, and returning a response. 

    For example, when using Google Maps, the app sends a request to Google’s API, which retrieves the necessary data and sends it back for display.

    APIs exist in many forms, some follow established standards like HTTP, while others extend or build upon these, such as REST. Creating an API can involve anything from defining custom protocols and data structures to developing simple interfaces for utility libraries. In web applications, APIs commonly serve as the connection points between various underlying services.

    In basic terms is API broadly refers to the code used to interact with a library or service.  Typically, users only need to know how to use it, not how it operates internally

    How do we import it? 

    First, let’s check what version of python we have, we do this by (in bash)

    ‘py –version’

    We can see the output being ‘python 3.13.1’, basically meaning python3. Now knowing that we can do the next step

    Since we are using python we have to ensure that we have installed some API tools within our systems. The command we do this is the following (this would depend on your device):

    ‘Py -m pip install requests’

    You know it would work through a lot of output of ‘downloading’ stuff. If it doesn’t, you already have it, or your command is a little different due to a different system/ terminal. Google is your best friend there. 

    Now we need to create a virtual environment for our project. We do this by typing:

    ‘py -m venv venv’

    The reason we do this is to ensure that each project has its own virtual environment, keeping it separate from other projects. Without a virtual environment, all dependencies would be installed globally, which can lead to conflicts if different projects require different versions of the same package. This can cause interference and potentially break everything.

    With  Linux users, installing packages globally can be risky because the operating system relies on Python internally. Modifying system-wide Python packages could disrupt essential system functions.

    As a best practice, always create a virtual environment for every project, whether it’s a personal or group project. This keeps dependencies organised, prevents conflicts, and ensures a stable development environment.

    Next let’s import the library at the top of the page. We do this by typing:

    ‘Import requests’

    For our project, we would be importing JSON, making it easy to parse and extract the required currency rates. We do this by:

    ‘Import json’

    Importing API

    Now, we need to store the API in a variable so that we can call it easily instead of pasting that long link everywhere it’s needed. Since the project heavily relies on this API, it would be used everywhere!

    • currency_value_API – Stores the URL of an API that provides real-time currency exchange rates (in JSON format. In this case, it fetches exchange rates for EUR (Euro) against other currencies.)

    Printing API

    Now, let’s print the contents. First, I will fetch the data from the API, then convert it into JSON format, and finally print it to the console. Easy, innit!

     This is what i have come up with:

    ‘all_currencies_response = requests.get(currency_value_API)’

    • This sends a request to the API to get the latest currency exchange rates.
    • The response is stored in all_currencies_response.

    ‘currency_data = all_currencies_response.json()’

    • The API sends data in text format, so .json() converts it into a Python dictionary.
    • This makes it easier to use and process in the program.

    ‘print(json.dumps(currency_data, indent=4))’

    • The data is formatted nicely using json.dumps(), adding indentation (spaces) for better readability.
    • print() then displays the currency exchange rates clearly.

    This is the result:

    We can see that using the json has formatted the code quite nicely and in a readable manner. And it wasn’t so hard to do it. 

    Next we might learn how to print/ search for specific currencies and have a better understanding of the first pull request of the project . Now let’s code ‘em all! ʕ -ᴥ•ʔ♡

    Credits 

    Resources

    +
  • 1. Which description best defines data?

        Data is strictly numerical information used in science.

    ✔ A collection of recorded information that can be analysed to make decisions.

        Information that is only useful for technology experts

    2. What is the difference between structured and unstructured data?

        Unstructured data is organised and searchable, whereas structured data isn’t searchable.

    ✔ Structured data is highly organised and easily searchable, whereas unstructured data is not easily searchable and lacks a predefined format.

         Structured data cannot be stored in databases, but unstructured data can.

    3. What is SQL?

        A tool for extracting and analysing data

    ✔ SQL is a programming language used specifically for communicating with RDBMs.

        A database management system

    4. Which of the following is an example of structured data?

        A video file uploaded to a streaming platform

    ✔ A database table with customer names, addresses, and phone numbers

         A collection of PDF documents

    +