Author: Amjad Izhar

  • Linux System Administration: Permissions, Partitions, and Security

    Linux System Administration: Permissions, Partitions, and Security

    This resource is a guide to Linux system administration, covering essential topics for the Linux+ certification. It thoroughly explains system architecture, including the file system hierarchy and key directories, as well as boot processes. The text also discusses partition management, detailing file system types, mount points, and commands for manipulating disk partitions. User and group management, file permissions, and special permissions are all explained. Finally, the document explains monitoring system performance and managing processes via command line tools.

    Linux Study Guide

    Quiz

    Instructions: Answer each question in 2-3 sentences.

    1. What is the role of Linus Torvalds in the Linux operating system, and what title was given to him?
    2. Explain the difference between the Linux kernel and a Linux distribution (distro). Provide two examples of popular Linux distros.
    3. Name three common uses for Linux operating systems, beyond desktop computing.
    4. Describe the purpose of the /bin and /sbin directories. What is the key distinction between them regarding user access?
    5. What is the purpose of /dev/null and /dev/zero?
    6. Briefly explain the function of journaling in file systems like EXT4 and XFS.
    7. What are the key differences between the FAT32 and NTFS file systems? What are the common use cases of each file system?
    8. Explain the roles of the kernel, the shell, and the user space in the Linux system architecture.
    9. What is the purpose of the /etc/fstab file?
    10. Explain the difference between a hard link and a symbolic link (soft link) in Linux.

    Quiz Answer Key

    1. Linus Torvalds is the creator of the Linux kernel and maintains ultimate authority over its development. He is known as the “benevolent dictator of Planet Linux,” as his approval is needed for incorporating code into the kernel.
    2. The Linux kernel is the core of the operating system, while a Linux distribution (distro) is a complete OS that bundles the kernel with other software, utilities, and a desktop environment. Ubuntu and Kali Linux are two examples of popular Linux distributions.
    3. Linux operating systems are used in servers (web, database), embedded systems (IoT devices, routers), and cloud computing platforms (AWS, Google Cloud).
    4. The /bin directory contains essential binary executables accessible to all users, while the /sbin directory holds system binaries used for administration, which typically require root privileges.
    5. /dev/null is a “black hole” that discards any data written to it, often used to suppress output. /dev/zero produces an infinite stream of null characters, useful for initializing storage or testing memory.
    6. Journaling is a feature that records file system changes in a journal before they are applied. This improves data integrity and recoverability in case of a system crash or power failure.
    7. FAT32 is an older file system with limited file size support, primarily used for USB drives. NTFS is a modern file system used by Windows, offering security features, compression, and large file support, but typically only accessible by Windows.
    8. The kernel manages system resources and communication between hardware and software. The shell is a command-line interpreter allowing users to interact with the kernel. The user space is where user-level applications execute, isolated from the kernel for stability and security.
    9. The /etc/fstab file contains a list of file systems that should be automatically mounted at boot time, along with their mount points and options.
    10. A hard link is a direct reference to a file’s data, creating a duplicate entry. A symbolic link (soft link) is a file that stores the path to another file acting as a shortcut.

    Essay Questions

    1. Discuss the advantages and disadvantages of using Linux in an enterprise environment compared to other operating systems. Consider factors like cost, stability, security, and the availability of support.
    2. Explain the importance of file permissions in Linux. How do traditional file permissions (user, group, other) and special permissions (SUID, GUID, sticky bit) contribute to system security and access control?
    3. Compare and contrast the systemd and SysVinit initialization systems. What are the key benefits of systemd over SysVinit, and why has it become the standard in modern Linux distributions?
    4. Describe the process of partitioning a hard drive in Linux. What are the differences between primary, extended, and logical partitions, and how are they used to organize a file system?
    5. Explain how shell scripting can be used to automate system administration tasks in Linux. Provide examples of common scripting tasks and discuss the advantages of using scripts over manual commands.

    Glossary of Key Terms

    • Binaries: Executable files containing compiled code.
    • BIOS (Basic Input/Output System): Firmware used to perform hardware initialization during the booting process on older systems.
    • Bootloader: Software that loads the operating system kernel.
    • CLI (Command Line Interface): A text-based interface for interacting with the operating system.
    • Daemon: A background process that runs without direct user interaction.
    • Dev: Directory containing device files, providing a virtual interface to hardware.
    • Distro (Distribution): A complete Linux operating system that includes the kernel and additional software.
    • EXT4 (Fourth Extended Filesystem): A journaling file system commonly used in Linux.
    • FHS (Filesystem Hierarchy Standard): A standard that defines the directory structure and contents in Linux.
    • File System: A method of organizing and storing files on a storage device.
    • GPT (GUID Partition Table): A partitioning scheme that supports larger disk sizes and more partitions than MBR.
    • GNU: An open-source, Unix-like operating system.
    • GUI (Graphical User Interface): A visual interface for interacting with the operating system.
    • Kernel: The core of the Linux operating system.
    • Linux: An open-source operating system kernel.
    • Mount Point: A directory where a file system is attached to the directory tree.
    • MBR (Master Boot Record): A traditional partitioning scheme that limits the number of partitions on a disk.
    • Nas (Network Attached Storage): A server that attaches to a network and enables other users to access the same data.
    • NTFS (New Technology File System): The file system used by modern Windows operating systems.
    • Open Source: Software with source code that is freely available and can be modified and distributed.
    • Partition: A section of a hard drive or other storage device.
    • Process: An instance of a program that is running in memory.
    • Root: The top-level directory in the Linux file system, represented by /.
    • Sbin: System binaries; executables used for system administration.
    • Shell: A command-line interpreter that allows users to interact with the kernel.
    • SUID (Set User ID): A special permission that allows a program to be executed with the privileges of its owner.
    • Swap Space: Disk space used as virtual memory when RAM is full.
    • Symbolic Link (Soft Link): A file that stores the path to another file acting as a shortcut.
    • Systemd: A system and service manager for Linux.
    • UEFI (Unified Extensible Firmware Interface): A modern firmware interface used to initialize hardware during the booting process.
    • User Space: The environment where user-level applications execute, isolated from the kernel.
    • XFS: A high-performance journaling file system commonly used in enterprise environments.

    Linux Fundamentals and System Administration Training

    Okay, here’s a detailed briefing document summarizing the main themes and important ideas from the provided excerpts.

    Briefing Document: Linux Fundamentals and Administration

    Overview:

    This document summarizes a comprehensive training on Linux fundamentals and system administration. The training covers a wide range of topics, from the history of Linux and its various distributions to file system management, process management, user authentication, and scripting. The primary focus is on equipping users with the knowledge and practical skills necessary to effectively navigate, manage, and secure Linux systems. The training utilizes a lecture format coupled with practical command-line exercises. Access to supplemental materials, including a detailed Google Document and an extensive slide presentation, is offered as part of a membership program.

    Main Themes & Key Ideas:

    1. Linux History and Distributions:
    • Linux was created as a free and open-source alternative to Minix/Unix, spearheaded by Linus Torvalds and Richard Stallman. “the goals for this were to make it free make it open source alternative to Minix uh which was based on Unix and that’s the guy lonus tals he’s still around and he’s still the the father of Linux.”
    • Linux Distributions (Distros) bundle the Linux kernel with other software, each tailored for specific purposes.
    • Popular Distros include:
    • Ubuntu: User-friendly, for general users and desktop environments. “Ubuntu which is the most commonly used uh it’s popular for General users beginners and people who want to use Linux in the desktop environment”
    • CentOS/Red Hat Enterprise Linux (RHEL): Stable, supported, for enterprise environments. “sent OS AKA Red Hat Enterprise Linux or real and these things are used in Enterprise environments so they’re mainly for stability and support”
    • Debian: Servers and advanced users, often command-line focused. “Debian is known for servers and advanced users mostly because the fact that you’re not going to get a graphic user interface”
    • Fedora: Cutting-edge, for developers. “Fedora which is great for developers and it’s more Cutting Edge and it has a lot of Innovations and utilities that are pre-installed on it”
    • Kali Linux: Cyber security and ethical hacking. “Cali Linux and it’s for cyber security and ethical hackers which is US everybody that comes on this channel”
    • Linux has Common Uses in servers, embedded systems/IoT devices, software development, cyber security, cloud and data centers. “servers embedded systems and iot devices iot devices are internet of things”
    1. File System Hierarchy and Navigation:
    • The File System Hierarchy Standard (FHS) defines a consistent directory structure across Linux distributions. Key directories include / (root), /bin (binaries), /sbin (system binaries), /etc (configuration files), /home (user directories), /var (variable data), /tmp (temporary files), and /dev (device files). ” the the home of everything is the root and it’s represented by this singular forward slash”
    • The /bin directory contains essential binary executables, accessible to all users. “the bin or the binaries directory contains essential binary executables that are needed during the boot process or in single user mode”
    • The /sbin directory contains binary executables for system administration, requiring root privileges. “the sbin is known as the system binaries folder and this is the binary executables that are used for system administration it typically requires root privileges to execute this”
    • The /dev directory provides a virtual interface to physical devices. “the dev folder important uh device abstraction by treating devices as files Linux provides a consistent interface for interacting with various Hardware devices”
    • Common commands for navigation: pwd (print working directory), ls (list files), cd (change directory).
    • Commands for file manipulation: cp (copy), mv (move/rename), rm (remove), mkdir (make directory), rmdir (remove directory).
    1. File Systems:
    • ext4: A widely used file system balancing performance and reliability. “xt4 which is balanced performance reliability and is known to be compatible with all different versions of the OS”
    • xfs: Designed for performance and scalability, popular in enterprise environments and large databases. “xfs the xfs file system uh it’s for performance and scalability it’s a very popular choice in Enterprise environment”
    • NTFS: Used in modern Windows operating systems, requires consideration for cross-platform compatibility. “NTFS the new technology file system is actually a file system that’s been used in modern Windows operating systems it’s reliable it’s secure performs well”
    • FAT32: Commonly used for USB flash drives and external hard drives (max 2TB), compatible with various OSes. “fat 32 for the most part is being used by one individual person for like a home computer or something like that or maybe a USB drive or an external hard drive that is maxed out at 2 terabytes”
    • Formatting tools: mkfs (make file system) can format partitions in different file systems, and requires backing up data as formatting wipes the data. “mkfs is used to format partitions with different file systems”
    1. System Architecture: Kernel, Shell, User Space
    • Kernel: The core component, acting as the bridge between hardware and software. It manages system resources. “the kernel um it’s the core component of a Linux based operating system it’s basically the bridge between the hardware and the software layers”
    • Shell: A command-line interpreter that allows users to interact with the kernel. “the shell is a command line interpreter that facilitates communication with the kernel”
    • User Space: The environment where user-level applications execute, separated from the kernel for stability and security. “user space is the environment where the user level applications actually execute”
    1. Boot Process:
    • BIOS/UEFI: Initializes hardware and passes control to the bootloader.
    • Bootloader (e.g., GRUB): Loads the operating system kernel.
    • Init System (e.g., systemd, SysVinit): Starts system services and processes. “init is actually the traditional initialization system that was used in Linux dros to start system services and processes during brute”
    • systemd is faster, flexible, feature rich, current version of the init system.
    1. Package Management and Installation:
    • Selecting a Linux distribution is based on the task to accomplish. There are desktop versions, server versions, and security versions, etc.
    • The process of flashing an ISO image to a USB drive using tools like Etcher is covered.
    • The presenter demonstrates how to find the assigned drive to the USB device before flashing the ISO image.
    1. Partitions and Mounting:
    • Understanding the concept of primary, extended, and logical partitions. The function of partitioning is creating containers to contain the files.
    • Mounting file systems: Attaching a file system to a directory to make it accessible. “when you mount something you’re attaching the file system to a directory so that it’s accessible within the larger directory tree”
    • /etc/fstab: Configuration file defining file systems to be automatically mounted at boot. “ETFs tab uh configuration file that defines all the file systems that should be automatically mounted when you start your system”
    1. Swap Space:
    • Swap space acts as virtual memory when physical RAM is exhausted, preventing out-of-memory errors. “swap a buffer to prevent out of memory errors meaning that the system can’t run because the physical memory has been maxed out”
    • Creating swap partitions or swap files is covered.
    1. Process and Service Management:
    • Processes, daemons, and services and the relationship between them.
    • Daemons are background processes.
    • Services group daemons to provide specific functionality. “service the higher level concept meaning that they group one or more Damons together and that provides a specific functionality”
    • Managing services using systemctl (enable, disable, start, stop, status).
    1. User Authentication and Permissions:
    • /etc/passwd: Stores user account information (usernames, user IDs, etc.). “the Etsy password file stores all of the user names so the user accounts themselves there is no uh password doc uh hashes or any PL text or anything like that that’s inside of this file”
    • /etc/shadow: Stores password hashes (sensitive file, access must be restricted).
    • File permissions (read, write, execute) for owner, group, and others. The acronyms are R, W, and X. “permissions are designed they go by read write and execute and they have acronyms for them so R would be for read W would be for write and then X would be to execute”
    • Special permissions: SUID, SGID, sticky bit. “sticky bit on a directory only the file owner or directory owner can delete or modify the files within it regardless of the group or other right permissions or anything else”
    • sudo and user authentication.
    1. Shell Scripting:
    • Shell scripts are text files containing a series of commands. “shell scripting is a an extension of Shell’s uh interactions and commands that essentially allows you to create a document put a bunch of commands inside of it”
    • Used for automation and repetitive tasks.
    • Key concepts: Shebang line (#!/bin/bash), comments (#), variables, conditional statements (if, else), loops (for, while).

    Quotes of Importance:

    • “toal uh tals posted the source code for free on the web inviting other programs to improve it making Linux a collaborative project and the foundation for open- Source software and to this day it is still open source meaning you can get access to it for free and you can even make modifications to it”
    • “without that guy’s permission you cannot make any incorporations to the Linux kernel uh or at least not publicly shared you could probably make the modifications your yourself but you won’t be able to make it as one of the dros that are available uh to everybody else”
    • “every time that you request a video to be loaded from YouTube you’re requesting a packet of data to be delivered to you and that’s done through your network”

    Recommendations:

    • Reinforce learning with practical exercises and command-line practice.
    • Explore different Linux distributions to understand their specific strengths and use cases.
    • Prioritize understanding file permissions and security concepts to maintain a secure Linux environment.
    • Utilize scripting to automate common tasks and improve efficiency.

    This briefing document provides a comprehensive overview of the Linux training material. By focusing on the main themes and key ideas, it enables individuals to quickly grasp the essential concepts and apply them effectively in real-world scenarios.

    Linux Essentials: Concepts and Architecture

    1. What is Linux and who are some key figures in its development?

    Linux is a free and open-source operating system kernel. Linus Torvalds created it as an alternative to Minix, drawing inspiration from Unix. Richard Stallman and the Free Software Foundation contributed the GNU utilities to the Linux kernel, creating GNU/Linux, the modern version of Linux. Torvalds remains the ultimate authority on the Linux kernel, often referred to as the “benevolent dictator” of Planet Linux.

    2. What are Linux distributions (distros) and what are some popular examples?

    Linux distributions, or distros, are different versions of the Linux OS that bundle the Linux kernel with other software. Popular examples include Ubuntu (user-friendly, for general users), CentOS/Red Hat Enterprise Linux (stable, for enterprise environments), Debian (for servers and advanced users), Fedora (for developers, cutting-edge), and Kali Linux (for cyber security and ethical hacking).

    3. What are some common uses of Linux?

    Linux is used in a variety of environments, including servers, embedded systems/IoT devices, software development, cyber security, cloud computing (AWS, Google Cloud), and data centers. Its versatility and open-source nature make it suitable for a wide range of applications.

    4. What are some important directories in the Linux file system hierarchy?

    Some key directories include:

    • / (root): The top-level directory, the home of everything
    • /bin (binaries): Essential binary executables needed during the boot process or in single-user mode, accessible to all users.
    • /sbin (system binaries): Binary executables for system administration, requiring root privileges.
    • /dev (devices): Represents device files that provide an interface to hardware devices.
    • /home: Contains personal directories for individual users.

    5. What is the /dev directory and why is it important?

    The /dev directory contains device files, which provide an interface for interacting with hardware devices as if they were files. This allows for consistent interaction with various hardware through commands. When you connect a USB drive, for example, a file or folder corresponding to that device appears in /dev, allowing command-line interaction.

    6. How do I determine file system type?

    To determine the file system type the command lsblk -f will display file system type along with UUID and label.

    7. What is shell scripting and why is it useful?

    Shell scripting involves creating text files containing a series of commands that can be executed sequentially. It’s a powerful tool for automation, allowing users to automate repetitive tasks. Shell scripts start with a shebang line (#!) indicating the interpreter to use. The rest of the script contains commands, often with comments (lines starting with #) explaining the code. Control flow structures (if/else, while loops) and variables are essential components of shell scripts.

    8. What are the three key components of the Linux system architecture?

    The Linux system architecture consists of three main components:

    • Kernel: The core component that acts as the bridge between hardware and software, managing system resources.
    • Shell: A command-line interpreter that allows users to interact with the kernel and execute commands.
    • User Space: The environment where user-level applications execute, separate from the kernel for stability and security.

    Linux System Administration Essentials

    Linux administration involves several key aspects, including system architecture, installation, package management, file management, user and group management, process and service management, and job scheduling.

    System Architecture and Boot Process

    • Understanding the Linux system architecture is crucial, including the kernel, shell, user space, basic input/output system (BIOS), Unified Extensible Firmware Interface (UEFI), GRand Unified Bootloader (GRUB), and init system.
    • The file system hierarchy standard (FHS) defines the directory structure, ensuring consistency across distributions. Key directories include root, bin, sbin, etc, home, var, and tmp.
    • The kernel is the core, bridging hardware and software by managing resources.
    • The shell is a command-line interpreter for interacting with the kernel.
    • The boot process involves BIOS/UEFI initializing hardware, the bootloader loading the OS, and the init system starting system services.

    Installation and Package Management

    • Installing Linux involves choosing a distribution based on specific needs, such as Ubuntu, CentOS, Debian, Fedora, or Kali Linux.
    • The installation process includes downloading an ISO image, creating bootable media, and configuring partitions.
    • Package managers are used to update, remove, and troubleshoot software packages.

    File Management

    • File management includes creating partitions and understanding primary, extended, and logical partitions.
    • File systems like ext4 and XFS are also important, as well as understanding mount points.
    • Commands such as mkfs (make file system) are needed for formatting partitions.

    User and Group Management

    • User management involves creating, modifying, and deleting user accounts. Commands such as useradd, usermod, and userdel are used for these tasks.
    • Group management involves creating and managing groups to organize users. Commands such as groupadd and groupdel are used to manage groups.

    Process and Service Management

    • Process management involves understanding daemons, services, and process management commands.
    • Important commands include ps for viewing processes and systemctl for managing services.
    • Job scheduling can be achieved using cron jobs for recurring tasks and the at command for one-time tasks.

    Linux File System Administration: Types, FHS, and Management

    File systems are a critical component of Linux administration, involving how data is stored, accessed, and managed. Key aspects include file system types, the file system hierarchy standard (FHS), mount points, and various management tools.

    File System Hierarchy Standard (FHS)

    • The FHS defines the directory structure in Linux, ensuring consistency across different distributions.
    • Key directories include:
    • Root directory Top-level directory for the entire system. All other directories are extensions of the root.
    • /bin Contains essential user commands.
    • /sbin System binaries, typically for administration, requiring root privileges.
    • /etc Houses configuration files for services and applications. It is known as the control center.
    • /home Houses user directories.
    • /var Stores variable data such as system logs.
    • /tmp Houses temporary data, often wiped on reboot.

    File System Types

    • ext4: The fourth extended file system, is a journaling file system and the default in many Linux distributions. It supports large files and is reliable.
    • XFS: A high-performance journaling file system often used in enterprise environments for its scalability and reliability. It is optimized for sequential read and write operations.
    • NTFS: (New Technology File System) Used in Windows, it’s included because of the need for interoperability between Linux and Windows systems.
    • FAT32: Known for its simplicity and broad compatibility; though older, it is still used due to its cross-platform compatibility. It has a limited file size of 4GB and a partition size limit of 2TB.

    Mount Points

    • Mounting attaches a file system to a directory, making it accessible within the larger directory tree. The mount command is used for this purpose.
    • Automatic mounting is configured in the /etc/fstab file, which defines file systems to be automatically mounted at boot. Each line in /etc/fstab represents a file system and its mount options.
    • Unmounting a file system is done using the umount command, preventing data loss or corruption.

    Partitioning

    • Partitions are logical divisions of a physical storage device, allowing the operating system to manage data in isolated areas.
    • Common primary partitions include the root partition, boot partition, home partition, and swap partition. Most Linux devices break down to a max of four primary partitions.
    • Extended partitions can contain multiple logical partitions.

    Tools and Commands for File System Management

    • mkfs (make file system): Used to format a partition with a specified file system type.
    • lsblk: Lists block devices (disks and partitions) in a tree-like format.
    • fdisk: A command-line utility for creating, modifying, and deleting partitions.
    • fsck (file system check): A utility for checking and repairing file system consistency.
    • parted: A versatile command-line tool supporting both MBR and GPT partition schemes, ideal for resizing and modifying partitions.

    Swap Space

    • Swap space is virtual memory on the hard drive, used when physical RAM is exhausted. It can be a partition or a file.
    • Commands like mkswap (make swap) initialize a partition for use as swap, while swapon and swapoff activate and deactivate swap spaces, respectively.

    Linux Permissions Management: A Concise Guide

    Permissions management in Linux is a fundamental aspect of system administration, focused on controlling access to files and directories. It ensures that only authorized users can read, write, or execute files, maintaining system security and data integrity. The key components of permissions management include permission models, commands for modifying permissions, and special permissions.

    Permission Models

    • Levels of Access: There are three levels of access: owner, group, and others.
    • Owner: Typically the user who created the file or directory, possessing the highest level of control.
    • Group: A collection of users who are assigned specific permissions.
    • Others: All users who are neither the owner nor members of the group.
    • Types of Permissions: Permissions are categorized into read, write, and execute.
    • Read (r): Allows viewing the contents of a file or listing the contents of a directory.
    • Write (w): Permits modifying or deleting a file or directory.
    • Execute (x): Enables running a program or script, or accessing a directory.

    File Permission Representation

    • When viewing file permissions, the output typically looks like this: -rwxr-xr–.
    • The first character indicates the file type: – for a regular file, d for a directory.
    • The next three characters represent the owner’s permissions.
    • The following three characters represent the group’s permissions.
    • The last three characters represent the permissions for others.
    • Example: -rwxr-xr– indicates a regular file. The owner has read, write, and execute permissions; the group has read and execute permissions; and others have only read permissions.

    Commands for Modifying Permissions

    • chmod (change mode): Used to change the permissions of a file or directory.
    • Symbolic Method: Uses symbols to add or remove permissions. For example, chmod u+x file adds execute permission to the owner of the file.
    • Numeric (Octal) Method: Uses numeric values to set permissions. Each permission has a value: read=4, write=2, execute=1. The sum of these values represents the permissions. For example, chmod 755 file gives the owner read, write, and execute permissions (4+2+1=7), and the group and others read and execute permissions (4+1=5).
    • chown (change owner): Used to change the owner of a file or directory.
    • chgrp (change group): Used to change the group associated with a file or directory.

    Special Permissions

    • SUID (Set User ID): When set on an executable file, it allows the file to be executed with the privileges of the owner, not the user running it. It is represented by an “s” in the owner’s execute permission slot.
    • SGID (Set Group ID): Similar to SUID, but it applies to the group. When set on a directory, any files created within that directory inherit the group ownership of the directory.
    • Sticky Bit: When set on a directory, only the file owner or directory owner can delete or modify files within it, regardless of group or other write permissions.

    User Authentication

    • /etc/passwd: Stores user account information, including usernames, but no password hashes.
    • /etc/shadow: Stores encrypted password hashes and other security information. Should only be readable by the root user.

    Managing Pseudo Permissions

    • Granting users the ability to execute commands with root privileges via sudo is a critical aspect of system administration.
    • This involves adding users to the sudo group and configuring the /etc/sudoers file to define command restrictions.
    • The visudo command is used to safely edit the /etc/sudoers file, checking for syntax errors before saving.
    • Within the /etc/sudoers file, you can specify which commands a user can run with sudo. For example: username ALL=(ALL:ALL) /path/to/command. This setup ensures users have the necessary permissions to perform administrative tasks while maintaining security.

    Linux User Management: A System Administration Guide

    User management in Linux is a critical aspect of system administration. It involves creating, modifying, and deleting user accounts to control access to the system and its resources. Effective user management ensures system security and integrity by granting appropriate permissions and privileges to different users.

    Key aspects of user management include:

    • Creating Users: User accounts can be created using the useradd or adduser command, depending on the Linux distribution.
    • The basic syntax is sudo useradd username or sudo adduser username.
    • Additional options can be used to specify the home directory, login shell, and supplementary groups for the user.
    • For example, sudo useradd -m -d /data/users/alice -s /bin/bash -G developers,admins alice creates a user named “alice”, assigns the home directory to /data/users/alice, sets the login shell to /bin/bash, and adds the user to the “developers” and “admins” groups.
    • Setting Passwords: After creating a user, a password must be set using the passwd command.
    • The syntax is sudo passwd username.
    • It is common practice to expire the initial password, forcing the user to set a new password upon their first login. This can be done using a specific command to expire the password immediately after it’s been created.
    • Modifying Users: Existing user accounts can be modified using the usermod command.
    • This command can change the username, lock or unlock an account, and modify group memberships.
    • For example, sudo usermod -l newusername oldusername changes the username from “oldusername” to “newusername”.
    • The -L option locks an account, and the -U option unlocks it.
    • Deleting Users: User accounts can be deleted using the userdel command.
    • The syntax is sudo userdel username.
    • The -r option removes the user’s home directory and all its contents. For example: sudo userdel -r username.
    • Groups:
    • Groups are managed using commands such as groupadd to create groups and groupdel to delete them.
    • A primary group is the main group associated with a user. When a user creates a file, the group ownership of that file is set to the user’s primary group.
    • Supplementary groups are additional groups that a user is a member of, granting them access to resources associated with those groups.
    • A user can be added to a supplementary group using the usermod command with the -aG option. For example: sudo usermod -aG groupname username.
    • File Permissions and Ownership:
    • Every file and directory in Linux has associated permissions that determine who can read, write, or execute the file.
    • Permissions are defined for the owner, the group, and others.
    • The chmod command is used to modify permissions, chown to change the owner, and chgrp to change the group.
    • Special Permissions:
    • Special permissions like SUID, SGID, and the sticky bit can be set to modify how files are executed or accessed.
    • SUID allows a file to be executed with the privileges of the owner.
    • SGID, when set on a directory, causes new files and subdirectories to inherit the group ownership of the parent directory.
    • The sticky bit, when set on a directory, restricts file deletion and modification to the owner of the file, the directory owner, and the root user.
    • User Authentication Files:
    • The /etc/passwd file stores basic user account information, such as usernames, user IDs, group IDs, home directories, and login shells. However, it does not store password hashes.
    • The /etc/shadow file stores encrypted password hashes and other password-related information. It should be readable only by the root user.
    • Managing Sudo Permissions:
    • Granting users the ability to execute commands with root privileges via sudo is a critical aspect of system administration.
    • This involves adding users to the sudo group and configuring the /etc/sudoers file to define command restrictions.
    • The visudo command is used to safely edit the /etc/sudoers file, checking for syntax errors before saving.
    • Within the /etc/sudoers file, you can specify which commands a user can run with sudo. For example: username ALL=(ALL:ALL) /path/to/command. This setup ensures users have the necessary permissions to perform administrative tasks while maintaining security.

    Linux System Boot Process: BIOS, Bootloader, and Initialization

    The system boot process in Linux involves several stages, starting from the hardware initialization to the loading of the operating system. Key components and processes include BIOS/UEFI, bootloaders, and initialization systems.

    • BIOS/UEFI:
    • BIOS (Basic Input/Output System) is a firmware used in older systems to initialize hardware and pass control to the bootloader.
    • BIOS initializes the hardware and conducts a Power-On Self-Test (POST) to check hardware.
    • It issues beeps to indicate test outcomes and initializes essential hardware like the keyboard, mouse, and disk drives.
    • UEFI (Unified Extensible Firmware Interface) is a modern interface replacing BIOS, offering a more flexible, faster, and secure boot process.
    • UEFI can boot systems faster and supports a user-friendly graphical interface.
    • It enhances security with features like secure boot, protecting the system from malicious software attacks, and supports larger disk drives.
    • UEFI also allows booting from network resources, facilitating remote system deployment and management.
    • Both BIOS and UEFI perform POST, execute the bootloader, and initiate the operating system boot.
    • Bootloader (GRUB):
    • The bootloader acts as an intermediary between the BIOS/UEFI and the operating system.
    • GRUB (Grand Unified Bootloader) is commonly used in Linux distributions.
    • It takes control of the system after BIOS/UEFI and completes the boot process.
    • GRUB loads the kernel and initial RAM disk into memory and transfers control to the kernel.
    • It presents a boot menu, allowing users to choose an operating system in dual-boot or multi-boot systems.
    • GRUB supports multiple OSs, customization of the boot menu, secure boot options, and advanced features like chain loading and network booting.
    • Initialization Systems (SysVinit, systemd):
    • After the bootloader, the system uses an initialization system to start system services and processes.
    • SysVinit is a traditional init system using a sequence of scripts to bring up the system, but it can be complex to configure and is relatively slow due to its sequential processing.
    • It runs scripts located in /etc/init.d to start and stop services.
    • SysVinit uses run levels, each representing a specific system state.
    • systemd is a modern init system that is faster, more flexible, and more feature-rich than SysVinit.
    • It manages the lifecycle of system services, ensures services start in the correct order based on dependencies, and logs system events.
    • systemd starts services in parallel, reducing boot time, and manages dependencies automatically.
    • It provides a unified framework for managing system services and includes features like socket activation, journaling, timers, scheduling, and device management.
    • systemd uses boot targets, which are groups of services that should be started or stopped together, allowing efficient management of system behavior under different circumstances.
    • Run Levels and Boot Targets:
    • Run levels (used in SysVinit) represent specific states of the system, with the system transitioning through them during the boot process.
    • Common run levels include halt (0), single-user mode (1), multi-user mode without NFS (2), multi-user mode without GUI (3), full multi-user mode with GUI (5), and reboot (6).
    • Boot targets (used in systemd) replace run levels and represent groups of services to be started or stopped together.
    • Common targets include multi-user.target (default multi-user mode), graphical.target (graphical services), rescue.target (system recovery), and emergency.target (minimal services for system maintenance).
    • Service Management:
    • In systemd, services are managed using systemctl commands.
    • Common commands include sudo systemctl start service, sudo systemctl stop service, sudo systemctl enable service, sudo systemctl disable service, and systemctl status service.
    • In SysVinit, the service command is used with similar options but a slightly different syntax.
    Full Linux+ (XK0-005 – 2024) Course Pt. 1 | Linux+ Training

    The Original Text

    Tesla cars the Google search engine and Gmail the astroe robots from NASA PlayStation and Xbox the trading systems at the New York Stock Exchange as well as many other popular services around the world run on Linux this means that there’s a lot of benefit to you learning Linux and the base certification for Linux is the Comas Linux plus even if you don’t plan on getting your Linux plus certification this video will help you to develop your Linux skill set and being that this channel is all about cyber security and hacking learning Linux will make you a much more capable security pro and a force to be reckoned with that being said here’s the outline of what we’ll be covering in this tutorial this training series is sponsored by hackaholic Anonymous to get the supporting materials for this series like the 900 page slideshow the 200 Page notes document and all of the pre-made shell scripts consider joining the agent tier of hack holic Anonymous you’ll also get monthly python automation exclusive content and direct access to me via Discord join hack alic Anonymous today are a couple of quick notes the format of the training series is going to be half lecture and half practical commands that we actually run inside of Linux on the command line um as you can see over here we have a bunch of content so it goes up to chapter 11 as far as the lecture portion itself is concerned and we’ll be covering essentially everything that you see inside of this notes document this uh Google doc as well as these 800 something slides that I have here for you in the Google Slides presentation so that’s going to be the part about of the lecture of this particular training series there is going to be a section on chapter 3 where we actually go through the installation of Linux and it’s something that I want to go through with you so you actually have a lab environment just in case you don’t have Linux on your computer and uh you don’t have Mac OS and Mac OS can be kind of similar to Linux but I want you to actually practice inside of a Linux environment so we’re going to go through the installation portion of it and that’ll be similar to a practical uh example that I’ll give you so that we can just go Click by click so you can see how to download an ISO file and uh go ahead and install it for yourself and essentially set yourself up to run all of the commands that we’re going to end up running when we actually do get to the Practical portion of this but for the most part it’s going to be broken down into a lecture and then at the very end of it when we get to chapter 12 we’re going to get to all of the commands that we have and then for chapter 12 there’s individual sections as well that has all of the uh the individual commands that we’re going to run that will just break down into multiple sections under chapter 12 so there’s actually 12 subsections inside of chapter 12 that goes everything from getting system information all the way to getting scripting and learning about how to create shell scripts so that’s going to be the outline that we have or the format of the outline that we have over here the second note that I want to give give you is that you can actually get this document this Google document with all of its notes and all of the commands and everything that’s for the lecture as well as this Google Slides presentation and it’s 800 something slides you can get access to both of these things by being a member of our hackaholic synonymous membership community so if you’re actually an agent tier member or above you will get access to this as a part of your membership and in my opinion it’s actually very very valuable um the video is obviously available to you for free um most likely it’s going to be broken down to two videos because when we get actually get to the Practical section I think I have to break it down into its own series of videos or at least its own separate video because uh Google Maxes us or Google YouTube Maxes us out at the uh 12-hour Mark so just in case we go over 12 hours for this training series I’m going to break it down into two uh separate videos but you will get access to those videos absolutely for free if you wanted to get the docs uh notes as well as the slides it would be part of the hack Anonymous membership and just to give you an idea of what that looks like as far as the the price comparison of what you can expect if you want to com Tia to try to get their Linux plus uh education just for the exam voucher itself it’s $369 but everything else so for example if you wanted to do the the labs and their education uh videos as well as the notes that they would give you and everything else that would be 1165 and then you have these various bundles as well so you’re looking at at least several hundred uh if you wanted to get it through Linux plus uh from CompTIA or really anything that would be comparable to this particular education uh what I’m giving you in these notes as well as the slideshow is based on the exact outline that they have in the CompTIA Linux plus education so that you can be ensured that you’re getting everything that you need for your examination but you literally get it at a fraction of the price probably less than on10th of the price so that’s really the entire plug that I have over here is that if you actually wanted to get these notes as well as the slides you can get it by being a member of the hackaholic anonymous membership community and the link to that is below in the description now that being said let’s actually jump into this outline so you know what to expect okay so first and foremost the timestamps that are going to be attached for this presentation are going to be in the description below as well as the very first comment that will be pinned to the top of the comment section and I’m going to try to give you as many time stamps as possible without making it ridiculous and being too specific so um the time Stamps will be brok broken down and then this is the the outline of this uh course so number one obviously we’re going to go into the intro to Linux and then Linux plus certification which means you’ll get the overview of the history of Linux the distributions that are available and the Linux plus certification itself what the benefits would be for you and more importantly the structure of the Linux plus examination which means the categories that are going to be covered and the format of the exam and any prerequisites that would be required to make sure that you do very well on this training series as well as if you decide to go take the certification exam so that you can do well on the examination uh the second chapter second section is going to be all of the system architecture and the brute process property so this is very similar to what happens if you got an education in comp plus but of course we’re not going to go into the nitty-gritty the super in-depth stuff it’s going to be all the things that you would need to understand Linux as well as the kernel and the shell and the user space and the basic input output system and ufv and Grub and the init system so on and so forth so you’re going to get a good understanding of what these things are and how they relate to Linux then we’re going to go into the actual installation of Linux and you’ll learn how to install Linux on a USB drive so you can have a live boot as well as a full installation if you wanted to install it on a computer to have as a secate second operating system or if you just want to start installing Linux on a variety of machines if you got hired to be a Linux administrator that’s essentially what they might ask you to do is to install Linux on actual computer so that the computer runs on Linux so you’ll learn that entire uh installation process and then we’re going to go through the partitions and the file systems so you know how you can create partitions and what primary partitions are and what extensions are so on and so forth we’ll go through the package managers and of course updating removing and troubleshooting packages then we’re going to go through the basics of the command line now this is just going to be again a part of the lecture itself all of the commands that you’re going to learn in every other section that we talk about will be covered inside of the the Practical portion of this training series and we’re going to go in depth and you’re going to try so many different versions of the commands and you’ll get a really really good training on it and a good understanding of it so I don’t want you to think that just because we’re going to skim them and you know introduce you to the commands for these various sections that we’re not going to actually go and practice them when we get to the Practical section so this is going to be the basics of the command line as well as the text editors and manipulating files and creating basic uh basic shell scripts and what the the various portions or the various elements of a shell script are then we’re going to go into user and group management how to create and manage users and groups the file permissions and ownerships and access control list and things like that special permissions and of course authentication and pseudo permissions that will come to that specific section and then we have the file management and file system so this is actually going deeper into the file systems we had the introduction to file systems when we were over here but over here we’re actually going to go in depth for the file systems and how to mount and unmount a file system how to actually create a file system using uh Fisk or the M mkfs the make file system commands and how to create partitions configuring in those things uh of course and managing the swap spaces as well because that’s actually a separate partition as well so you you’ll get all the understanding that you need for file management and the file systems and how to create file systems and partitions so on and so forth uh we’re going to go into process and service management so so this is also very important as a Linux administrator all of this stuff is actually really important as a linuxis admin so um we’re going to go into the process and service management portion uh understanding what a Damon is what services are uh Process Management commands service management commands and of course scheduling jobs and then we’re going to go into networking so this is not going to be a replacement of the network plus training that you can get but we will go into enough that you will be dangerous so you’ll learn enough about networking that you will know exactly how to navigate the network infrastructure and how to set up the IP addressing and the DNS and dynamic host configuration protocols and how to actually uh create the network manager CLI or how to use the network manager CLI and how to troubleshoot uh network issues and of course managing the firewalls with the basic firewall which is the uncomplicated firewall as well as the IP tables so we’ll go into a good amount of stuff so that you you know enough to be dangerous right but we’re not it’s this is not going to subst intitute the network plus education cuz that’s a whole other Beast by itself and then we have security and access management so this is another very important element uh this is a channel about cyber security and hacking so security is a very very big deal to me so this is going to be something that I’m very interested in sharing with you and file system security C trud file permissions Access Control lists network security user authentication methods and configuring secure shell data encryption and secure file transfer and a lot of other things that would fall under the category of security and access management and then we’re going to go through troubleshooting and system maintenance and these are all the different elements so analyzing interpreting log files dis usage analysis backup and restoration strategies and of course system performance monitoring and then there’s virtualization and Cloud Concepts now this was not listed as an actual uh category under Linux plus but I think this is very important for you to learn because most likely if you’re going to get a job as a Dev ops manager or somebody who will go into Dev Ops or somebody who’s going to become a linuxis admin you are most likely going to deal with a cloud environment because companies these days aren’t really setting up physical servers anymore they’re most likely going to go and buy a virtual server with uh let’s say aw or with Google cloud or something like that and you’re going to need to learn how to uh essentially just navigate those things it’s not really complicated to understand and the command line and everything that’s associated with this isn’t really complicated but I just want you to understand and I want you to know how these things work and you know what is a virtual machine and what is a container for example and how do you use Virtual box or Docker these various tools that are associated with Cloud Concepts and cloud computing so it’s not uh required for Linux plus but I think you will be more powerful as a Linux administrator and if in case it does show up because by the time that you watch this video they’ve added it to the most updated version of the Linux examination in case it does show up you’ll know what you’re talking about and you’ll be ready for that as well and then finally we’re actually going to get into the practice command portion which is a massive portion all by itself and of course exam preparation tips so there will be the key commands for the Linux plus exam there’s going to be exam preparation resources like practice labs in addition to everything we’re going to talk about mock exams study guides I’ll give you a bunch of mock questions that you will need to kind of review just to prepare yourself for the examination and of course uh the exam day tips and how to just prepare yourself for that day and the final wrapup that we’ll go through so this is going to be a comprehensive training course I really wanted to be very useful for you whether or not you take the examination so whether or not you decide to become certified should not matter because by the end of this thing you should be so functional and you should be so competent with Linux that even if you’re not certified you can do all of the requirements of any Linux sis admin job and then you can confidently put that on your resume and even on your portfolio and say look at all of the stuff all of these shell scripts that I created and all of the various things that I can do inside of Linux so that you can just prove that you’re competent and you’re actually proficient in Linux so I’m really excited for you I’m glad that you’re here I hope you go through the entire thing but in case you want to skip around and find individual sections that would be relevant to you the time stamps are all going to be below and that’s about it so I feel like I was talking a mile a minute minute cuz I’m trying to get through this whole thing so quickly to be able to save on time you probably don’t need to speed up this presentation cuz I’m going to try to talk really really fast to just just try to get as much content uh crammed into this video as humanly possible so uh I’m excited for you I hope you’re excited too let’s jump into the very first section okay here we go so introduction to Linux and the Linux plus certification uh overview of the history dros and of course the common uses so I was created in 19 1991 by lonus tals who developed Linux as a hobby while studying at the University of Helsinki I don’t know what you do as a hobby but this guy created an entire operating system um the goals for this were to make it free make it open source alternative to Minix uh which was based on Unix and that’s the guy lonus tals he’s still around and he’s still the the father of Linux um inspired by Unix which was created by Maurice Bach uh version 02 of Linux kernel was released in 91 and then 1.0 was released in ’94 toal uh tals posted the source code for free on the web inviting other programs to improve it making Linux a collaborative project and the foundation for open- Source software and to this day it is still open source meaning you can get access to it for free and you can even make modifications to it so long as your modifications get approved by the father of Linux uh richel stalman uh who’s an American and the the free software Foundation created the gnu which was the open source Unix like OS and then they added the gnu utilities to the Linux kernel to create the gnu Linux or the modern version of Linux that you see uh when you interact with Linux or uh when any of these companies that we mentioned at the beginning of the video when they create it or they use it uh that’s the version of Linux that they’re using so it’s the most updated version of Linux and that’s the guy Richard stalman he definitely that’s like the best picture that I found of him all of the other pictures are not flattering at all and he looks like a mountain man pretty much in every single one of these pictures and it’s interesting to see that like this is one of the guys that’s like the a tech uh nerd that was like the one of the founding uh people of Linux so it’s actually it’s really interesting to see the different types of people that you see inside of the tech world so yeah this is Richard stalman so then what happened was Linux became a complete Unix clone now it’s used everywhere as you saw uh torval Remains the ultimate Authority on what new code is incorporated into the Linux kernel and AKA he is known as the benevolent dictator of Planet Linux and the best picture that I could find to bought you know exemplify that to embody that was that picture right there so without that guy’s permission you cannot make any incorporations to the Linux kernel uh or at least not publicly shared you could probably make the modifications your yourself but you won’t be able to make it as one of the dros that are available uh to everybody else so uh that is what we got for the history of Linux now these are the popular Linux distributions and the various purposes that they hold Linux distributions AKA dros are different versions of Linux OS that bundled the Linux kernel with other software so you have the Linux kernel as the base and then you have a variety of different additions to it that create various distributions so for example we have Ubuntu which is the most commonly used uh it’s popular for General users beginners and people who want to use Linux in the desktop environment and it’s used or it’s known for user friendliness right so it actually has a GU and you get point and click and a lot of cool things that come pre-installed with it uh but Ubuntu is the most popular in my opinion and it was like the first introduction when I uh heard about Linux and I was looking at the software that was installed the OS that was installed it was Ubuntu Dro that was installed and then we have sent OS AKA Red Hat Enterprise Linux or real and these things are used in Enterprise environments so they’re mainly for stability and support so there’s actually a support team there’s a dedicated support team that the company can hit up and get their questions answered and it’s very very stable and it’s good for large environments so Enterprise environments use Cent OS and then Red Hat Enterprise Linux and then we have Debian and Debian is known for servers and advanced users mostly because the fact that you’re not going to get a graphic user interface there are some installments that do have it but for the most part it’s just a black screen with a bunch of command line comments that are on it and this is used for Server so this is a very very big one in the server environment and then we have Fedora which is great for developers and it’s more Cutting Edge and it has a lot of Innovations and utilities that are pre-installed on it and this is again for people who want to go into development and coding and software development etc etc that would be Fedora and then finally last but not least is my favorite which is Cali Linux and that logo is just absolutely amazing I love C Linux and it’s for cyber security and ethical hackers which is US everybody that comes on this channel we are all cyber security people and ethical hackers and we use C Linux and Cali Linux also has auntu installed on it but it comes pre-installed preconfigured with a bunch bunch of cyber security tools and a bunch of ethical hacking tools and Pen testing tools and it is my favorite version of Linux I’m biased obviously I love all of Linux I think it’s an amazing OS but this is definitely mine this is my favorite one and uh that is it for the the majority of the popular dros there are some other dros as well that you will see as we go into uh some of the links for being able to download these things but these are the most popular and uh you can just do a Google search to see what all different distributions are as far as the common uses of Linux we already kind of touched on them through the disos but you have you know servers embedded systems and iot devices iot devices are internet of things so it could be a smart Appliance like a microwave or something or a fridge or something it could be a router it could be cars like the Tesla cars it could be the aobi robots it could be uh so many different things that would be considered an embedded system or an iot device and then you have software development and cyber security obviously and then we have cloud and data center so AWS and Google Cloud actually use Linux uh devops and Cloud architecture all of those things are centered around Linux actually the only uh platform that I don’t think uses Linux for cloud computing is Microsoft Azure uh but they even have uh kind of like a integration with Linux that you can actually use to go into it as well so um for the most part Linux is the the primary OS uh that is used for a lot of these things it’s believe it or not it’s massive there’s so many different entities and so many different platforms and software and equipment and systems that use Linux so uh you’re in a good place by studying this you are adding a very important skill set that I think is going to be very relevant uh for many many years to come for decades to come probably uh assuming that the human race is still around so a very very good skill set to have just so you know what the benefits are by this certification for it professionals even if you don’t get the certification and you just get really good at Linux and you can put on your resume and on your portfolio that these are all the different things that you can do and uh for the the exercises that we run you’re going to get some output results so you can develop scripts and you can do a lot of different things that will demonstrate your skill set on this um but there are a lot of benefits to it so obviously there’s industry recognition obviously there is career advancement opportunities so it’s recognized Glo so Linux plus is actually a globally recognized certification and it’s very valued in it roles as a system admin as somebody in devops or cyber security and cloud computing uh it’s an entryway so it’s a Gateway it’s uh getting your foot in the door for professionals who are seeking to specialize in linux-based systems it validates your skills it has a lot of Versatility to it so system configuration troubleshooting security as we’ve just touched on employers really appreciate app people who actually have certifications or at the very least understand fundamentals and practical uses of Linux and in my opinion it’s the Practical side of everything that is the most important I know a lot of people who don’t have the degrees who don’t have the certifications but are very very capable and really good at these things that are getting hired in very big roles andc it’s mainly because of the fact that if you put on your resume that you can do something as a part of the application process they’re going to have you go through some kind of an assessment and the assessment is going to test your skills in Linux and if you actually know what you’re doing they don’t care whether or not you have the certification they just want to know that you know what you’re doing and you know how to navigate these types of environments so it’s very very important in validating those skills and of course there’s competitive advancement and salary potential so if you actually if you know what you’re doing and if you know Linux versus somebody who doesn’t know know Linux you will get paid a higher rate you can find some really nice salaries for people who know how to interact with Linux and Linux plus certification just kind of is that seal of approval to make sure that you actually know it but you know there’s this really great quote that says uh you know what do you call somebody who got a D in med school you call him doctor and so even if somebody got a Linux plus certification it doesn’t mean that they scored super high on that certification exam it just means that they got at least the bare minimum score to be able to pass it and then they got that search so you could for the most part A lot of people again could just be self-taught and without the certification but they know a lot of Linux uh interactions and environments and fundamentals and advanced scripting and so on and so forth that they actually are more knowledgeable than people who got theer so just kind of keep that in mind okay so here is the structure of the Linux plus exam the exam format uh currently the xk5 as of 20 24 so uh the time of this recording is November 2024 uh it consists of approximately 90 questions including multiple choice and performance-based questions and the candidates that uh take this exam they have 90 minutes to complete the examination and the passing score typically varies depending on the version but it’s around 720 out of 900 720 out of 900 is 80% so this is not something that you can get a c around or something like that so if you get 721 1 you pass if you get 720 you pass but it’s Approximately 80% is what you’re trying to accomplish here the main domains that are covered our system management so how to install configure and manage Linux systems security which is implementing security best practices and understanding the Linux system security requirements there’s scripting and automation for Shell scripting to automate tasks and manage resources which actually whether or not you take this it’s so powerful to be able to automate uh activities on Linux and just in general learning how to automate things is very very it’s good for you it’s good for your life um networking and storage management configuring troubleshooting the network the storage as well as share resources and performance and monitoring so monitoring the system performance and implementing logging these are going to be the main domains the main categories that are covered when you are going through uh the Linux plus certification and under this false troubleshooting under this false system administration so on and so so forth so uh these things we’re going to go through all of that stuff so that you have a very very good fundamental good foundation and then you actually get into the intermediate and advanced things as well the prerequisites are none actually there are no strict prerequisites but uh prior experience in Linux is actually very useful in this um although we will go through all of the introductory and intermediate stuff as well so all the beginner level stuff we are going to cover as well there’s actually a series of videos that I’ve done on Linux fundamentals and Linux Basics on this channel and they’re relatively short compared to what this video is going to end up being so if you want to go check those out just to kind of give you a you know a foot in the water dipping your toe in the water so to speak that would be useful if you get uh the CompTIA A Plus or network plus that’s also super useful but there are no actual strict requirements or prerequisites to get into this uh mostly because the fact that we’re going to be touching a lot of the fundamentals for all those requirements anyways but uh the better introduced you are to this the more familiar you are with this uh you’re going to have an easier time for the rest of it and you’re just going to get a lot of the information reing grained in your mind and reaffirmed and you’ll get a really strong understanding of everything that goes on all right so let’s get into the system architecture and the boot process and first in that regard is going to be understanding the directory structure and the file system hierarchy of Linux one of the common things that you’re going to to hear a lot as we go through this tutorial is going to be the FHS the file system hierarchy standard and we’re going to be referring to this frequently so the FHS defines the Linux hierarchy structure and what each folder is commonly used for and so the key directories that you see on your screen right here these are the big directories for Linux installations and for the most part these things always come pre-installed every time that you install Linux uh there’s going to be a difference between primary and extensions and log logic type of directories but these things are all falling under the key directory so you have the root the bin or also known as the binary and then you have the spin which is s uh system binary you have the ETC which is typically used for configuration files you have the home that houses all of the users you have the ver log the variable log that houses a lot of actual logs and variable Dynamic data you have the user folder that also houses user data you have the optional stuff and then you have the development uh directory that has a lot of the source uh as well as the virtual environments as well and then you have a temp folder that houses temporary data that typically gets wiped on reboot and these are our main key directories now the root directory is the top level directory the root is literally the root for the entire system so all of the other directories in FHS are inside of the root directory and they are technically all just extended ions of the root directory they’re organized hierarchically under the root subdirectories Branch out and then more under them and so on and so forth so they just keep getting more and more uh subcategorized under the root the root directory is owned by the root user who has complete control over the root directory and by extension the entire machine the structure and contents are crucial for a system stability and security meaning that you don’t want to mess with this unless like you really know what you’re doing you don’t want to mess with any of it because most likely if you do anything if you delete something accidentally if you modify something accidentally you’re going to mess the entire thing up and then you have to reinstall Linux and then there’s the software packages that are installed and their files and specific directories under the root directory CIS admins often work directly with the root directory to configure and maintain the system so this is the the mother right this is like the basic the very very main directory the the home of everything is the root and it’s represented by this singular forward slash the bin or the binaries directory contains essential binary executables that are needed during the boot process or in single user mode so it’s generally accessible to all the users and it houses all of the basic uh binaries so for example the ls command also known as the ls binary the cat command the CP the MV RM so LS is listing all the files and directories cat concatenates and displays the contents of a file onto your terminal CP copies files and directories MV moves or renames Co files and directories RM removes files and direct and these are just a few of them there’s many there are dozens of binaries that are included inside of the bin folder the binaries folder the sbin is known as the system binaries folder and this is the binary executables that are used for system administration it typically requires root privileges to execute this so it’s not accessible by everybody and since they involve system level changes it’s very very important that you know what you’re doing uh for the most part you’re probably going to be using your own version of Linux on your home computer to go through all of this so you’re not going to be in an Enterprise environment to do this so even you are going to be the root user that gets access to the system binaries you don’t want to mess with these things right so the the Fisk binary for creating partitions and the fs check for file system check um for in it initializing the system rebooting shut these are very very important binaries you don’t want to mess with these these are not things that you should even try to open or manipulate or unless you are super Advanced which if you’re watching this you aren’t so just be very very careful with the binaries just leave these alone you know uh for the most part as long as your your intrusion detection system or your antivirus or uh any of those security appliances don’t give you any kind of an error or an alert that has to do with this for the most part you’re not going to be interacting with the system binaries it’s just good to know what it houses and it is the part that uh primarily houses the system administration the binary executables that are relevant to your system and this is not accessible by anybody other than the root user that’s what you need to mainly keep in mind then we have the the variance the difference between these two right so you have the binaries folder that typically all users get access to the system binaries folder is only accessible by the root user the purpose of the binaries is essential user commands like LS and CP so on and so forth the system binaries are for system administration the execution timing so early boot process or single user mode is when binaries are actually launched and executed the system binaries are for system maintenance and administration so they actually manually are booted and uh used or activated executed and they’re not done automatically by the system so for example uh creating partitions is is going to be done manually by the root user as they try to create partitions or when you go through the primary installation and you’re assigning the various partitions that you want that’s when those things are going to be executed apart from that unless you do need any of those binaries they’re not going to be activated or executed so these are the main differences between binaries and system binaries so that you have a good understanding of what they actually are the Etsy so the configuration binary or not binary sorry folder the Etsy folder folder directory uh houses configuration files for a lot of different services and applications and these could be the things that you also install manually uh this is known as the control center and the contents of etsy can vary depending on the Linux distribution that you got and the software that’s installed so uh it again houses the stuff that comes preconfigured inside of the system as well as the stuff that you download and install into your system etsy’s containers or etsy’s directories are things like the Etsy pass password that actually houses all of the user account information but it doesn’t show you anything for password hashes so it’ll show you just an X for that the Etsy Shadow file is going to show the uh user password hashes so this is these two are very very important in the concept of cyber security and ethical hacking these are very very important files and then you have the Etsy group that has the group information the Etsy host for example the host name and the IP address mappings the host name itself which is the system host name you have the edsy res configuration file that has the DNS resolver configurations and you have the Etsy network interfaces that has the network interface configuration and you’ll see what that means when we actually run a couple of these networking commands just so you can see what those things mean and then we have the Etsy system control configuration that has the system kernel parameters and again you’re not going to be messing with this uh maybe at some point you might be messing with the DNS resolver configuration maybe you might be messing with the network interface configuration for the most part you’re not going to be messing with any of these things directly uh unless you’re doing pen testing or ethical hacking exercises where you would manually try to add a user uh to the Etsy Shadow file or the Etsy password file something like that but the interaction that you’ll have with all of these files will be through individual commands that will add or remove uh entries from some of these files and that’s how you will interact with them it’s very rare that you’ll actually open these files directly and interact with the file directly you’ll probably use one of those binaries that we talked about earlier to interact with these files the service configurations are like such so if you have an Apachi web server that’s installed that would also be inside of the Etsy folder and it’ll be Etsy Apachi and then if it’s in Jinx it’ll be Etsy in Jinx uh if you have a mySQL database installed that’s what it’s going to look like if you have the postresql installed that’s what it’s going to look like so these are the configurations for Individual Services right so uh it houses configuration files for the system Sy Services as well as anything that was installed on the the machine itself so MySQL may not necessarily come installed on your system you may install it and then when you do that configuration drive or uh directory that configuration directory as well as its individual configuration files are going to be installed inside of the Etsy directory and of course package manager so very similar to the previous uh slide that we were on apt the AP package manager resources or the Yum package manager resources these are uh dependent on the type of Linux that you’re running um so app typically comes with Ubuntu yum typically comes with uh Centos or red hat but these are the package managers that come that you can use to uh install various uh packages as well as software and applications and we’ll get deeper into that when we actually get to that slide but typically again these things are all included inside of the Etsy folder so as a final note why is the Etsy folder important well there’s system Behavior so all the configuration files directly influence your actual systems Behavior the security is very important as we talked about the Etsy password and the Etsy Shadow files specifically are really really import important so um if there’s misconfigurations that are done to any of these configuration files that poses a security risk but then there’s actual data that is inside of these configuration files that if mishandled or accessed by somebody that shouldn’t have access to is going to pose a massive security risk um there’s customization so you can customize the system by editing these particular files if you want to append to them you could use it uh doing various binaries or you could just open some some of these things up and directly uh append or uh manipulate the data that’s inside of them I wouldn’t do it against the actual system important stuff so if we go and talk about those individual softwares that were installed you can customize those by opening them inside a text editor but for the system uh related uh configuration files I would only use specific binaries unless I know exactly what I’m doing I would not open those files directly I would use the system binaries because the system binaries also give you the messages if you made an error in something or uh with the syntax of something they’ll tell you exactly what you need to do so you’ll get a lot of help with the terminal itself when you use the binaries instead of opening the document or opening the file and trying to configure it manually and of course troubleshooting so any system problems that can be resolved by modifying configuration files so at the same time vice versa of that a lot of system problems can be caused by incorrectly modifying configuration files so again just notes take notes be you know be warned I gave you the disclosure right so just be careful as you manipulate those data points and again so we have an individual slide for the caution so always back up the configuration files uh be mindful of the file permissions incorrect permissions can lead to system instability or incorrect permissions can lead to hacking that takes place um ensure that the configuration has the correct syntax to avoid any errors and of course test these things in a controlled environment before deploying them to a production system this is more relevant to somebody who’s actually working inside of some kind of a company and is hired as the system administrator so before launching it to the 500 or 5,000 employees inside of the company before deploying it to a production system that’s what that means before you actually deploy it to the entire company you need to test it on one machine in a controlled environment to make sure everything is all good and there are no glitches or errors or security vulnerabilities and once that’s been approved and everything’s taken care of then you deploy it to the rest of the company so that’s what that means you got to test it before you submit it and deploy it to the entire system to the entire production environment the home directory is where user accounts are stored and an individual user account so for example if you have user one this would be the directory for user one and then inside of that directory is going to be a bunch of information that’s just relevant to user one and typically it’s only accessible by user one or at least somebody who has user one’s password so user accounts are housed inside of the home primary location for files documents settings configuration Etc uh the key directories inside of it are going to be these and you’ve probably seen these so this also is very similar to what happens in a Microsoft uh environment where each user has their own documents folder and a downloads folder they have a music folder pictures public videos so on and so forth for the most part all of these things are only accessible to that user except the public folder the public folder is used to share files with other users and typically it’s accessible by everybody else that’s on that system as well but all of these individual folders right here are usually only accessible by that specific user uh user ownership has to do with their home directory and everything that’s inside of that home directory is owned by that user by default only that user and the root user have full access to the home directory as well as the stuff that’s for that specific user so it ensures privacy it ensures security um a user can customize their home directory to essentially do whatever they want um so long as they don’t install anything or do anything that would ruin the entire system itself they can essentially do whatever they want inside of their directory they can store whatever they want inside of their directory as long as they don’t pass their storage limits which typically if they do they just get notified and they have to remove some stuff and delete some stuff so that they open up some more storage space and by default the home directories are protected from unauthorized access um by anybody who does not have root permissions or is not on the sudo’s list or does not have the username and password for that specific user the notable notes here are that you want to back up these things regularly uh to just make sure in case anything happens with a system crash or something you can just recover all of that stuff um the file permissions are again very important so file permissions is another one of those things that is going to come up very regularly as we go through the rest of these videos and it’s Mo it falls under security so file permissions um have to do with if somebody is supposed to access this should access it if somebody’s not supposed to access it they should not be able to access it very simple it’s not it’s not a complicated process it’s just something that needs to be kept in mind and as you navigate and administer administer a Linux machine or a Linux environment this is some of the stuff that you really need to be uh be uh considered for or consider uh to just make sure that none of these things uh happen and nobody accesses these things when they’re not supposed to and we’re going to go through those individual file permission commands and how to set file permissions so on and so forth uh storage limits as we already talked there is going to be definitely storage limits and uh the users uh are supposed to maintain their own storage limits and not or not maintain them but they’re supposed to keep their storage limits in mind so that if they ever hit a storage limit they can delete data and make some more room but each user is going to get a storage limit so that the overall system and the overall environment doesn’t get maxed out and of course I mean keep it organized if you can but I know some people that have a really really freaking overwhelming like scary looking desktop because it’s just a bunch of files on the desktop there is zero organization and it’s like how do you find anything here and they’re like no no no I know where everything is at yeah I’m like all right bro if you know where it’s at then fine but if I am your manager I’m going to be like you need to learn how to organize all your stuff so that’s basically it so V or variable data I call it Devar it’s just it’s weird I don’t know the pronunciation is weird to me but whatever the VAR directory the VAR folder uh it stores variable data so this could be the system logs because system logs are constantly updated with new activity it could be temp files it could be mail spools it’s essentially Dynamic data that changes frequently or uh variable data as the name implies um these are some of the key directories inside of the VAR directory so you have the log directory that houses all of the system and application logs and it can be very very important that’s another one of those locations where we refer to regularly when we’re doing incident response in cyber security or when we want to do troubleshooting if a system crash happens or unexpectedly so it’s a very very important directory the VAR log directory is very important the our mail directory stores all the incoming mail for the users the spool directory contains various services including print jobs mail and news the lib has the state information for various services and applications and then you have the temp that is inside of the V directory which should not be confused with the actual temp directory which we’re going to cover in a few slides so it stores temporary files created by various applications that will be inside of this specific directory so inside of thear directory there is a temp directory that stores temporary files by various applications then we have the importance of this thing so as you can imagine Health monitoring by looking at the log files inside of that directory is very very important so it gives you the data that’s necessary to uh reverse engineer or backtrack what happened for system performance and any potential issues or attacks or anything that may have happened security analysis again same thing service operations so spool directories in the spool are very uh crucial to services like Printing and mail so if there’s some kind of an issue that is with your printer that isn’t the actual Hardware itself and there’s no connection with the wires or anything anything like that you may want to go over here to try to find out what is going on with uh the service itself why the operation of that printing is not working accordingly uh application States so the lib stores information needed for applications to maintain their state so whether or not they are enabled or disabled or if they have issues or glitching whatever it may be most likely it’s going to be inside of this specific directory for the application state so so the VAR lib directory is going to store information needed for applications to maintain their State uh important considerations would be regular cleanup of the temp directory to make sure that you don’t uh overload your storage uh rotate the files uh the log files regularly because log files can get massive if they are designed or if they’ve been configured to store data for a long period of time and I don’t care what the system is like uh for the most part any system can overload their log directory or the log contents very quickly if you don’t uh set it up to clean up so if you don’t set it up to wipe the log data or if you don’t back up the log Data before it’s wiped so on and so forth those log files can get very very large if the system is being used regularly log files can get really big uh permissions uh are very crucial again so right files and directories the permissions of those files and direct to protect system security somebody can get into your log directory and they can go into the authentication log and erase their tracks of being in your system that’s not good so they can actually get into your system they can do whatever they need to they put some kind of a root kit or something some kind of a Trojan or a worm something that they can connect to a C2 connection some kind of a shell something right they can get in your system house some kind of a connection where they can come in as they please and then they erase their tracks from your logs that’s not a good thing that is very very very bad and that should not happen because the permissions to those logs should be kept at a root level and uh a pseudo level so that people who are only an administrator should be able to access them and their password should be super complex so that somebody can’t just hack in their password by using a password cracking tool or something like that so permissions again as I’ve mentioned this is going to happen frequently so permissions to certain log files and just certain directories should not be accessible by anybody other than the root user and the administrators and of course backup whatever is necessary so not everything needs to be backed up but the important things should be backed up for example log files should be backed up and configuration files should be backed up that is all important stuff we have the user directory the user directory has user programs and libraries so anything that has to do with the programs of that user the libraries of data and any documentation typically stored here um they have the user bin so user binaries right the user sbin system binaries you have the user Library you have the local for locally installed software often outside of the actual package manager that we’ll be talking about the user share that has share data files like documentation icons and configuration files and of course the source code for various system utilities the binaries are accessible to all the users the system binaries are typically for system administration requiring root privileges so this same thing applies here so even the inside of the user folder the system binaries are typically only accessible by the root user the shared libraries used by programs the locally installed software often outside of the package manager these things are very similar to what you saw previously it’s just it happens to be for the individual user the root user will have their own directory so it’s not going to be something that you’ll see inside of the user directory it’s going to be forroot just by itself but the the user directory itself will have individual users other than the roots that will have all of that information stored in here so why is this important the program execution so in the binary and the system binary are essential for running programs uh shared libraries are used by multiple programs to reduce disk space and improve performance so if there’s been something that’s been installed that’s accessible to all the users it’s going to be inside of that directory so that it’s not duplicated across every single user taking up space so you have one installation but that’s now available inside of the lib the lib the library so that all of the users can get access to it instead of having multiple installations of the same thing uh software install packages install uh for the users are actually inside of the subdirectories of the user and a system documentation could be inside of the shared doc directory that contains documentation for system utilities installed software so on and so forth and what we’re talking about here is actual manuals for example how to use a specific uh software or utility the documentation for that is going to be inside of this system documentation so the user share Doc is going to house typically documentation and instruction manuals for the various utilities and so key points here there should be certain things that are readon so the user directory is mounted as a read only to prevent accidental modifications by somebody who should not be accessing it or should not have uh root privileges uh package management like AP and RPM they manage the installation and removal of software often modifying files within that user directory so instead of going and manually removing files or folders you would use one of the package managers and the the unin uninstall uh command that comes along with it that would be uh removing all of the software packages and all of the dependencies that comes with that software so uh rarely are you going to be accessing these things directly and trying to remove them directly which is why it says that there should only be readon permission so you should not have the permission to modify the contents inside of this it’s typically done by the various binaries that are inside of the system and some files in the user are accessible to all the users others may require root privileges to modify and that falls under file permissions and user access so again common themes you’re going to see this a lot so the reason why I keep saying them is because I wanted to like really embed in your brain as we go across this information so that you really really understand certain Concepts and then when you see the repeated themes you start understanding how all of these things actually connect to each other because CU it’s not complicated it’s most of this stuff is common sense you just need to know where certain things are housed and what the rules are for accessing them and giving permissions and so on and so forth so that is what we got there now we have the opt the optional software it stores additional software packages that are not part of the base system so optional software installations from third-party sources so uh let’s say OBS for example which is the software that I’m using to record this presentation that’s something that came from a thirdparty so software Third Party Source and that was installed so the contents of that the optional uh require all of that stuff is going to be inside of the opt folder for this particular software right there is a screen recording software that comes pre-installed with my machine but that’s not the one that I’m using so that uh content the content for that specific software are not going to be inside of this particular directory this is for the optional software that is coming from a thirdparty source so just keep that in mind it’s the optional configuration files or software installations or anything else that has to do with stuff that comes from a third party source and I I’m actually going to correct myself it’s not the configuration file so as we mentioned earlier configuration files would actually be inside the Etsy folder this is just the additional software packages that have been installed so it would be the packages the actual uh the use f uh packages of that particular software that are going to be in here the configuration file for that software would be inside of the Etsy directory why would you use this so it keeps the optional software separate from the base system which makes it easier to manage and remove um it prevents conflicts between different software packages that’s why we isolate them and it’s flexible so it allows for easy installation it allows for easy removal of the optional software and you can technically come in here and manually remove them but even if you have installed something uh and it ended up in here I would highly recommend just using the same package installer to remove it unless there was some kind of an install file that you downloaded from a place and then you used uh a package uh manager I mean I it I feel like it always comes down to the package manager so there especially in a Linux environment that doesn’t have a GUI a graphic user interface if it’s like a Linux server or something something you’re not going to get a install file that you would double click on and then you open the double you open the install file with the double click and then it goes through the installation Wizard and then you just click next or something it doesn’t work like that if you’re using the command line interface you’re typically using the package manager to install something which means that you would most likely use the package manager to remove something so this is uh more so for the system itself but again you just need to know uh what purpose this serves the optional software the opt has to do with thirdparty software that’s been downloaded therefore it keeps all of that stuff separate from the base system the system binaries and the base installations which makes it easier to manage and remove and it isolates everything so if there’s something wrong you can backtrack and try to find exactly where that problem came from and of course it’s flexible for easy installation and removal of that stuff the typical structure uh like looks like this so if you actually install something in the opt uh it typically creates a directory named after the software so for example MySQL so there would be a MySQL directory for the MySQL software and then it will house the software’s binaries libraries and configuration files and data and for the most part most likely there’s going to be also something that would be inside of the Etsy folder so you’ll actually have MySQL inside of the opt as well as the Etsy folder that would have to do with the configuration files of that however in this particular location it also houses the libraries it also houses the data it also houses the software binaries as well as the configuration files whereas inside of the Etsy folder it just has the configuration files so keep that in mind inside of the opt MySQL it has everything including config files inside of the Etsy MySQL it only has the config files so just keep that in mind key points here ownership and permission the ownership and permission files and directories within opt can vary depending on the software so if the user installed it versus if the root installed it that could determine the the direction of the permissions and the ownership uh package management software packages can be installed using the system package manager others may require manual installation that’s typically in some kind of a uh gu environment based on what I’ve experienced so far sometimes you use another command line tool that is not the actual package manager itself so for example it’s not a or apt it’s not that so there is some other kind of command line tool if you’re only in a command line environment um so sometimes that may be the case but for the most part I’ve actually only used the package manager to install packages and the dependencies for those uh tools and utilities um uh unless I was inside of a GU environment where there was some kind of a you know uh you double click it and you extract the files and then you click on the install file inside of that extraction and then it runs through the installation so on and so forth um then there’s a configuration for software installed in opt it’s often located within the software’s directory and then cleanup so when you remove software installed in opt it’s important to remove all the files and directories associated with that software so basically just just delete the entire directory instead of going inside of the directory and then in uh manually uninstalling things just uninstall everything that has to do with it if there’s data that you need to back up save and back up that data and then just wipe that entire directory that is the extension of opt so opt MySQL for example you would delete the entire MySQL directory to make sure that everything inside of that thing have also been deleted the dev directory houses the virtual device interface so a virtual ual file system that represents Hardware devices as files so it allows the OS to interact with Hardware devices using standard file operations so this could be like a printer for example so there would be the dev SDA or sdb that represents the hard disk drives so SD stands for standard dis and then it could be uh if you have multiple hard diss installed a would represent the first one B would represent the second one C Etc and it would just continue on from there there would be the CD ROM there is the USB drives right so it could be the external drives as well null is actually something that discards anything that’s written to it so when we run certain uh commands that we know they’re going to give us a lot of error messages we point those error messages to the dev null directory because it immediately just deletes those error messages because they’re unnecessary they do nothing to you and it’s mostly like permission denied to such and such resource when you do a find command this is actually what I use this for that that’s the only only time that I’ve used this specific directory for I’ll run a fine command and I know that from the results of the fine command there’s going to be a lot of data that’s going to pollute my screen and it’s going to hide the important data so it’s going to be like noise right and typically that data is permission denied to this permission denied to that and it’s all permission denied messages and then within a 100 permission denied messages there’s going to be two messages that have the data that I want and so I point all of that denied messages those error messages to the devn folder and then from there I can only look at the actual results so instead of seeing a 100 results I only see the two that apply to me because all the error messages go to the Devol folder um and then you have Dev zero which is a special file that produces an infinite stream of zeros and so far I have never used this thing I think it’s important from what I understand I mean it’s listed so I know that it’s important but I’ve never had a chance to actually use it so I’m very curious as to what that’s even for um but we just know that it does exist and so it’s a special file that produces an infinite stream of zeros and we can uh I mean I can I’m I’m actually going to pause the presentation real quick and I’m just going to do a Google search just to find out what the dev zero uh file is for all right so here’s what we got uh in Linux Dev zero is a special file located within the dev directory that essentially acts as a source of infinite null characters like asky value zero meaning when you read from it you will continuously receive zeros making it useful for initializing data storage with blank values which is why if it’s a blank value why do you need to store it whatever okay so key points about Dev zero the function is that it provides a stream of zeros whenever you try to read from it um the disk initial initialization would be the use case uh creating a completely blank dis by writing data from Dev zero to it okay that makes sense so if you want to initialize a dis creating a completely blank dis by writing data to it so you just pull a bunch of zeros from this thing and you write it to the disk memory allocation checking if a specific amount of memory can be allocated by attempting to read a certain number of bytes from Dev zero and then generating blank files creating a file with Zer is by redirecting output from Dev zero to a new file so it’s basically a storage of Z and then you you you pull that storage of zeros to either allocate testing or generate a blank file or initialize a dis that’s very interesting that’s like such a nerdy thing I didn’t even know that something like this existed but okay now we know very interesting so why is the dev folder important uh device abstraction by treating devices as files Linux provides a consistent interface for interacting with various Hardware devices so for example the file that is been assigned to a USB drive for example when you plug in the USB drive you now have a folder dedicated to the file system for that USB drive and then when you go inside of that folder you get to interact with the contents of the USB drive and this is more important in a command line environment because if you’re inside of a gue environment a graphic environment you just click on it and you get to see inside of the file browser that okay these are the contents of the USB drive but when you’re inside a command line environment only it turns it into a file system so that you can actually interact with the contents of it um device drivers which are software components that control Hardware devices create device files inside of Dev so the device driver which is the software components that control a hardware device so for example your printer has a driver that you need to install to be able to interact with that printer if you’ve ever insted inst a new printer it says hey you need to go download this the driver for this printer from our website and that’s how you get to interact with the the printer itself so that is housed inside of the dev folder the user interaction can access uh a user can access and control devices through these device files often using commands like dis duplicate or HD parm so on and so forth to be able to interact with the various uh extensions of the dev Direct directory and that is why this is actually important so it’s the virtual interface of a physical device typically so a USB drive a printer a hard disk on the computer so on and so forth this would be the virtual interface to interact with that physical device key points here are that the device files are often created dynamically when a device is plugged in or when the system boots so when you plug in your USB all of a sudden a little folder or file pops up that has to do with that USB uh access to device files may be restricted to rout or specific users depending on that specific device and the correct device driver might must be installed and loaded for a device to be accessible in Dev for example your printer USB drives typically don’t require device drivers but printers usually do so something that does something in the physical world typically has to have its own driver that comes installed and then that will be inside of the dev folder then we have the temp folder so the temporary file system it’s used to store temporary files created by various applications and system processes the files are typically deleted when the application or process finishes or when the system is restarted or rebooted the temp has write and execute permissions it’s a very popular Target for hackers most of the pen testing exercises that I have done have been they’ve had to do with you know creating a shell or some kind of a script that does some malicious activity creating it outside of the machine that I’m targeting and then taking that specific file and using something like w get or some kind of a python server to transfer it from my machine to the Target machine and then I put that file inside of the temp folder because the temp folder has right and execute permissions and I I can have no access to any of the other folders that we just talked about so the root folder obviously the home I can have literally no access to anything else but typically there is always access to the temp folder so if I drag and drop it or transfer my binary or the the the payload that I have inside of the temp folder then I can execute it from the temp folder so this is a very popular Target for hackers because of the fact that it has these permissions that typically come preconfigured you can obviously change this but for the most part it has right and execute permissions U mostly because the fact that it usually just deletes everything uh once the system has been rebooted so it’s not there’s nothing in here that’s permanent it’s a temporary file system so that’s why uh it has those permissions and that’s why it is such an attractive Target uh temporary storage is a convenient location for applications to store temporary files without cluttering the user’s home directory or other permanent locations and when you close the software those files get wiped from the temp folder when you restart the system those files get wiped uh system processes often use the temp folder to store temporary files during operations such as package installations or system updates and then they get wiped user applications such as web browsers and text editors also use the temp folder to store temporary files and then they get wiped so that’s why it’s like it’s probably one of the most volatile uh folders here because it’s just constantly changing based on the software that you’re using and the activity that you’re having so you don’t really uh you just none of these things are permanent It’s All Temporary some key points here there are automatic cleanup so many systems automatically clean up the temp directory on reboot or at regular intervals or when you close the software down or something like that security uh you got to be aware of potential security risk associated with the temp files because they contain sensitive information sometimes or that specific directory can be accessible fairly easily if necessary you can manually clean up the temp directory using commands like remove or remove RF meaning to reformat um however be cautious not to delete important files so again just be aware of certain things when you’re doing automatic cleanup or automatic wiping of something make sure there’s nothing in there that is important that you should have backed up before you wiped everything inside before you like digitally naal the entire thing and just wipe everything and so these are some of our other important directories the boot directory stores boot loader files Dev we’ve already talked about lid we’ve already talked about the mount directory uh houses the mount point for removable media um the proc is the virtual file system providing information about system processes and then the SRV contains data for services provided by the system and then there’s the system the CIS which is the virtual file system that has info about the systems Hardware so for example the CPU or the GPU so on and so forth so these are other important directories um however uh what we talked about is most likely going to be talked about very frequently you do need to know what is inside of these things you don’t have to know uh the nitty-gritty you don’t have to know all the finer details but you should be aware of these individual directories as well that are all a part of the file system hierarchy standard okay so now going into the file system types and mount points so these are our common file system types you have the xt4 xfs NTFS and fat 32 the xt4 is the fourth extended file system which is designed as the successor to xt3 and xt2 it’s a journaling file system for Linux and what that means is that it you it houses a journaling file system that basically it records everything that happens inside of the file system in in case the system crashes or there’s some kind of a power failure or something and it needs to pick up where it left off it maintains a journal so it supports large files um for example 16 terabytes in size which is freaking massive um it makes it suitable for storing large media files and databases it has the large file system support that can handle file systems of up to one exabyte in size accommodating massive storage needs enhances performance so improved performance especially for the large file systems and it can be extended so it’s designed to be extensible allowing for future enhancements and features and hopefully you can actually see the bottom part of this I’m not sure exactly if you can see that inside of the video but the bottom piece right here says extensibility the xt4 file system is designed to be extensible allowing for future enhancements and features so these are the key features that we have of the xt4 file system then there is the xfs file system the xfs file system also has journaling for high performance scalability and reliability it’s used for large file systems and high performance workload so this is typically for an Enterprise type of an environment uh it’s optimized for sequential read and write operations making it ideal for file servers and databases um it can handle file signs uh up to 8 exabytes in size so it’s pretty freaking massive um the xd4 very similar to the xt4 it uses journaling to ensure data in Integrity in case of crashes it can be scaled so it can handle a large number of files and directories that is really good for file servers with a lot of users so typically this is used for a central file server that a lot of remote users can access and it makes it very easy to scale up and house more files as well as give access to more users then there’s flexibility which has online file system res resizing and real time def fragmentation which makes the file system very flexible so you can actually make certain edits without removing uh permissions or without removing accessibility to it you can make certain modifications to the xfs file system so it’s typically used for large databases or data centers with many users the common use cases here are often used in high performance servers like the web server or the database server and file servers so server essentially it’s serves the data and other people can take the data from it so it can be one central location for example it would be the web server and then M multiple users can access that website it could be a database and multiple users can access that database it has the nas devices so network attached storage devices often use xfs to storage large amounts of data and then you have virtual machines like the xfs uh that can be used as the file system for virtual machine dis image images and just a quick note a network attached storage device is essentially a fancy name for a server so it it’s the physical uh server itself that uses the xfs file system to serve that data so it it stores a bunch of data that other people can access and it’s attached to a network meaning that is accessible via a network connection so that’s what an Nas device is and then it typically uses the xfs file system to be able to house that data to store that data so that other people people can get access to it the NTFS the new technology file system is actually a file system that’s been used in modern Windows operating systems it’s reliable it’s secure performs well the reason why you need to know this is that most often you’re going to need to format a drive that can interact with the NTFS system or at the very least you need to know what it is so that in the context of your interaction between Windows machines and Linux machines you need to know how to format a a file system or some kind of amount so that it can be accessed by both of these file system types right so if somebody is using a Linux machine and another person is using a Windows machine they both should be able to get access to your overall server they should be able to get access to your xfs file system for example so that they can pull whatever data they need from it so this is one of the reasons why we’re actually even talking about the NTFS the new technology file system um you know it’s secure it offers robust security features like Access Control list that allow granular control over the file and folder permissions it uses journaling very similar to everything else we’ve talked about to improve the integrity and recoverability of data uh it’s optimize for performance especially on Modern Hardware and it can can handle large file systems and large file support so it’s a very it’s a solid file system and it’s been used on the modern Windows machine so obviously this is a very very solid good file system it typically is only available so if something has been formatted for NTFS typically it can’t be accessed by a Linux machine that’s based on my experience at least so what you want is dual formatting and typically when you do something that can handle both of them it is not just NTFS just keep that in mind so NTFS is uh typically uh inherent to uh Windows right it’s uh very much so dedicated to Windows uh compression is one of the uh other features here um it can support file and folder compression to save disk space it allows you to encrypt files and folders to protect sensitive data meaning you use password protect files and folders and it has hard links and uh symbolic links it provides flexibility in file management a hard link is a direct reference to a file system essentially creating a duplicate entry for the same file data while a symbolic link link also called a soft link is a file that stores the path to another file acting like a shortcut that points to the original files location meaning with a hard link multiple file names can access the same data a symbolic link just points to the original files path on the system so for example a symbolic link could just be the desktop shortcut for example so that would be the main difference the hard link is a direct reference to a file on a system essentially creating a duplicate entry for the same data symbolic link is just a shortcut to that file right so a hard link duplicates the same exact thing puts it somewhere else a symbolic link or soft link is the shortcut that points to that file the common uses of NTFS would be the Windows operating system so it’s the default system for Windows nt2000 XP Vista 7 8 10 and 11 so the more recent versions of Windows uh many external hard drives are formatted with NTFS especially those that are designed designed for Windows system again so we’re referencing being able to use it by Windows um a lot of external hard drives are formatted as such so you want to make it uh formatted to access both types of machines so for example Mac OS as well as Windows so you need to reformat the hard drive uh USB drives can be formatted with NTFS to storage large files and folders and you can also reformat them to house both types of files so on and so forth so NTFS new technology file system some common use cases we have the fat 32 file system this is by far my favorite name for a file system so the fat 32 file allocation table 32 file system uh it was used in the early days of personal Computing it’s not as featur rich like NTFS or xt4 but it remains popular due to its Simplicity and Broad compatibility and it’s still used in a lot of environments um the key features is that it’s relatively simple which makes it easy to implement it’s compatible with a wide range of operating systems including Windows Mac OS various Linux distributions so it is cross formattable uh it has read and write access uh allowing you to create modify and delete files it does have a limited file size so it has a maximum file size that’s limited of 4 GB and a limited partition size for fat 32 meaning it’s 2 terab it’s still fairly big so 2 tbte file system or a 2 tab extension partition is not bad especially if you’re dealing with with just one person one user but most likely you’re not going to be using that inside of an Enterprise environment with a bunch of different users and a lot of different data so fat 32 for the most part is being used by one individual person for like a home computer or something like that or maybe a USB drive or an external hard drive that is maxed out at 2 terabytes the common use cases is the USB flash drive so commonly used for USB flash drives memory cards like digital cameras or other devices and external hard drives that only have a maximum of two terabytes typically use fat 32 and that’s actually what I did for uh most of my external drives cuz I don’t have external drives that go past 2 tabt so uh when I can I do go ahead and um format it for the fat 32 so that I can use it on both my Windows machine as well as my Mac OS and Linux machines all right now we can go into the system architecture which would be the kernel the shell and the user space so the kernel um it’s the core component of a Linux based operating system it’s basically the bridge between the hardware and the software layers managing system resources facilitating communication meaning that if you have you know if you put a request or we call it a call to the system if you send a call to your uh CPU to perform a certain action the kernel is that middle ground between whatever the software was that made that call and the actual CPU operating that call so it’s the middle ground it’s the bridge as it says between the hardware which is the CPU the GPU the motherboard so on and so forth and the software layers meaning your text editor for example when a text editor makes a certain call the kernel translates that call it transfers that call to the actual hardware and it’s the bridge that does that communication the key roles of the kernel are resource management and several other management types as well so you have memory management Process Management device management and file system management so allocates and deallocates memory to processes as needed and we’re talking we’re not talking about storage here we’re talking about the random access memory the processing memory you have the process management to create schedule and terminate processes it controls access to Hardware devices like the dis drives the network cards and the printers and then you have the managing of the file system and providing access to files and direct so memory management specifically it all allocates memory to processes as needed dividing physical memory into virtual memory segments page fault handling so a page fault or a page in general is just a a certain amount of data and the handling of the faults that happen with pages is typically done within the kernel so if a process tries to access a memory page that’s not currently in physical memory the kernel triggers a page fault and then loads the missing page from the disk then it swaps So Physical memory is scarce so and typically it’s in a computer that’s a little bit older or maybe it doesn’t have as much physical RAM you know let’s say 4 gbt of Ram or less so if the physical memory is scarce if there isn’t enough physical memory the kernel swaps the interactive pages to the dis to free up memory for active processes we also refer to this as the swap space and we’re going to be talking about this a lot later on but if there isn’t enough physical memory the kernel is responsible for swapping between virtual memory as well as the physical memory to make sure that the system doesn’t crash and you get access to uh the amount of processing power that you need to be able to run your active processes so this is what we mean by memory management you can allocate memory you can handle any uh data loading so if there’s any data pages that aren’t loading the kernel is responsible for retrieving that data and then it’s also responsible for managing the actual swap space managing the processing power between the physical memory and any virtual memory pages that have been designed we also known as the swap spaces so that the proc the computer doesn’t crash and you can still actually run the processes that you need to process then we have the process management so we went from memory management to process management and process creation and termination is one of the big things so the kernel creates new processes it assigns them unique identifiers uid and then terminates them when they’re no longer needed so when you close it down it terminates it and the uid goes away process scheduling so if you have anything that should run a certain amount of time on boot for example when you start up your computer or every day or every 5 minutes whatever those things are done inside of the kernel that process scheduling is done inside of the kernel and then the CPU time efficiently is allocated via the kernal uh context switching so between different processes saving their state and restoring the state state of the process to the to be executed so for example if you go from Google Chrome to your text editor you’re technically switching the context and then if you come from the text editor back to Google Chrome you should be able to pick up where you left off where you were on Google and so that is considered a context switch and the kernel switches between those processes saving whatever their state was and then restoring it when you go back to it so that you can just continue with business as usual uh interprocess communication is also facilitated by the kernel meaning that they can share information and synchronize their activities with each other and interprocess communication could be something like copy paste for example you take something from one thing and you paste it to the other one or if you have two uh processes that are integrated with each other that rely on each other those things can be done via the kernel as well so the whatever the processes are whether it’s a background process or a foreground process meaning something that you can visibly see versus something that you don’t see that’s just running in the background there are certain communication that takes place between those processes to make sure that the computer is running properly your system is all good and that’s all done through the kernel so the conversations that happen between processes the conversations that happen between physical hard drives as well as uh the physical CPU and your software on the computer all of those conversations are handled via the kernel and finally we have the device management here or I think there’s actually one more one more role here but device management is one of the other ones as well uh which would be the loading and unloading device drivers uh software components that interact with specific Hardware it loads and unloads those specific things so you can interact and communicate with the physical Hardware you can have the input output operations so when you click something on your mouse that’s considered an input your mouse is considered an input device when you type in to something on your keyboard that’s considered an input device or the input that’s being received by the computer and then the reaction from the computer would be considered the output so if I click on something it needs to open that’s an output if I type something in the keyboard and it prints onto my screen that’s the output so the kernel handles the input and output transferring data between devices and the memory which would be considered all the processing that’s being done on the computer and then the kernel also responds to interrupts generated by the hardware devices like the dis drives and network cards and if there is any kind of interruption happening within the processes of those it’s also handled by the kernel itself Hardware abstraction layer also known as Hal so this is the consistent interface for software to interact with Hardware hiding the complexities of different architectures uh this abstraction allows software to run on various Hardware platforms without requiring significant modifications so the hell the hardware extraction layer it allows it’s all done by the kernel so this is another rule that’s done by the kernel and it’s consider the interface for a software to interact with Hardware so various Hardware platforms have different functionalities so a 4 GB Ram is different than a 16 GB Ram a CPU that is one brand is different from a CPU that’s Nvidia or something like this so these are various types of Hardware or Hardware platforms and this specific H this specific abstraction allows the computer the the software that you’re using to interact with these different types of Hardware without requiring any kind of modification right so that’s what the purpose of this is for you don’t need to modify this software to interact with a 4 GB Ram although it might run a little bit slower you don’t need to modify it because the kernel will handle all of that translation for you same thing if it’s a 32 GB Ram you don’t need to modify it the kernel will handle that for you specifically how within kernel will handle that for you and then we have the system call so this is another one of those things that I’ve already kind of touched on a little bit but a user level program interacting with the kernel and requesting Services is called a system call so you make a call to the system to do something for you you make a call to your calculator to process a uh calculation for you and then the kernel translates that call it translates that request to the CPU the CPU processes that and then feeds it back to you so you put your input into the calculator the kernel translated that input or transferred that input to the CPU the CPU processed it and then the results came to the calculator as an output for you that’s called a system call system calls enable programs to perform tasks like creating files reading and writing data making network connections doing calcul ations playing a video yada yada yada all of these things are considered a system call then we have security so this is this is one of the big things for our community the cyber security and hacking community so security mechanisms to protect the system from unauthorized access and malicious attacks is done via the colonel it includes user authentication Access Control list and network security feature so user authentication meaning the colonel verifies the user identities and grants access access to some resources based on their privileges that’s all done by the colonel so when somebody logs in first of all it verifies that okay this login is actually correct and once you’re logged in the colonel processes your actual permissions and says okay based on what Hank has privileges to he can access these various resources and that’s all done by the colonel all behind the scenes so as soon as you log in the colonel says okay you have permission to it’s not going to declare it to you onto the screen but it’s just going to process that internally and it’s going to say okay okay this user has permission to access all of these things based on there are password and username and permissions that have been assigned to them their privileges that have been assigned to them then there’s access control so it enforces Access Control mechanisms to protect system files and directories so if you actually can’t if you shouldn’t have permission to access a certain file the kernel is the one that says hey user uh access denied right you don’t have access to this thing because of your privileges for your user and then there’s the network security feature like firewalls and packet filtering to protect the system from Network attacks to detect a fishing link that’s been clicked or to detect that you’re visiting a malicious website or to detect that somebody is trying to access your system and they’ve been denied access through the firewall all of this is done by the kernel the kernel processes all all of those uh commands and all of those requests aka the system calls and now we have the shell so the shell is probably the most basic vers of your interaction with the kernel so it’s a command line interpreter that allows you to interact with a computer system and it’s text based so it’s a you you you probably have seen a version of a shell when you see any kind of a movie or a show about hacking it’s that black screen that has a bunch of white text on it and it looks like gibberish but to the hacker they hopefully they know what the hell they’re doing um that person interacts with the system through the shell so when when we want to make a system call for example we want to run a program when we want to access something inside of the file system or manage the resources of the system the shell is our way to interact with the computer system and this is how you interact with the kernel you’re not you’re not technically directly interacting with the kernel but when you input something into the shell the kernel takes that input and processes it and goes and calls on the system some resources and the file system does everything else that you want it to do and this is how you directly communicate with the kernel there’s a lot of different ways to communicate with the kernel for example your calculator or your text editor but at the most basic level when you’re interacting with the a Linux server that only has a command line the shell is how you interact and how you process your commands to the system the shell works like this you provide your input right so you type in a command into the shell the command gets parsed so meaning the let’s say there are four different pieces to that command you say pseudo which is one portion of the command you say Nano which is another portion of the command and then you say the name of the file so let’s say that’s three different commands right so it gets parsed the command gets broken down into its individual sections or its individual tokens and then it gets executed so pseudo says that you have root level privileges and the shell will process that first and it’ll say okay if you have root level privileges enter enter your password so I can verify that you’re actually root and then when you do it say okay so you’re all good or it’ll say you actually don’t have access to this then once it has processed that then it’ll execute Nano and Nano is a text editor so it’ll just open up the file name which will be the third piece of that command it’ll open up that file name inside of the Nano text editor meaning that it’s executing the full command that you’ve given to it and then once you do that it opens the file and you get to see the contents of the file which is considered the output shell scripting is a an extension of Shell’s uh interactions and commands that essentially allows you to create a document put a bunch of commands inside of it and then when you run that one document when you run that one shell script then it runs all of the commands inside of that shell script without you having to manually input all of those commands so this is a very powerful Concept in automation so if you have a repetitive task like looking at a log file and doing it daily and you need to make sure that there’s nothing fishy inside of the log file you create a script that checks that log file every single day and it checks for certain strings or certain pieces of data to make sure that it’s not in there and if it’s is in there it’ll give you an alert that says hey there’s something to worry about if it’s not it just says hey everything’s all good system check everything’s fine and that’s a very very simple but powerful use of a shell script so you can create a bunch of different repetitive tasks or automate a bunch of different repetitive tasks using shell scripts and these are essentially text files like we also mentioned and they just have a sequence of commands that can be executed by the shell uh why we use the shell script is as you can imagine when you think about automating it does a lot of different things for you so number one it’s efficient so instead of you having to do it every single day you can just schedule a task via one of the tools that we already talked about and go through that task scheduling with a shell script so you say hey system run this shell script every single day at 9:00 a.m. or every single time that I start this computer run this shell script so it automates that for you okay the second part of this is that it’s very consistent so sometimes the human makes an error when they run a shell script or not even a shell script so let’s say you want to run one of the commands and you mistype something that’s considered human error or you forget a part of your series of commands that you’re supposed to run that’s a human error so instead of relying on the human you just write it once make sure that it’s written really well and there are no errors in it and now every single time that you need to perform that single task it’s done consistently exactly how it’s supposed to be every single time that’s great flexibility is that if you wanted to do the same task but you want to do it with a variety of different files or with a variety of different users you can just modify that script and then now it’ll do the same exact series of actions now I’ll just do it with this user and then the next user and so on so so it’s flexible you can modify it and then of course you can reuse it to death you can just keep running the same script over and over and over again and it’ll never complain it’ll never you know uh waver it’ll never uh water itself down it’ll run exactly the same way over and over and over again and will’ll have no problem no matter what version of Linux you’re running no matter how old it is so on and so forth is super reusable and it’s just very useful so some of the system administ ation use cases you can backup system files you can monitor system resources you can install in configure software you can automate user account management uh you can parse log files you can extract data from those files you can convert file formats uh you can deploy web application you can run tests again those applications you can compile and Minify code which is actually very useful and then there’s just general stuff so renaming the files in bulk moving and copying files scheduling tasks all of these things can be done through the creation of shell scripts so we’re going to get into the nitty-gritty of this when we actually start creating shell script so you don’t necessarily need to memorize all of this right now because you’re going to run this over and over and over again to practice these things and create them but when you open a shell file when you create a shell file that essentially could be file. sh that would be a shell file you open that the very first line needs to be the shebang line that calls to the path of your your specific shell bash or zsh or whatever it is that would be The Interpreter that you use to write the rest of the code so when you put that at top of the text document the computer then knows okay this is what I’m going to run first this is the very first thing that I’m going to run and this is going to interpret the rest of the commands in this document so then it knows that it’s supposed to run a script and then you can start usually the very next line is a comment so notice how this has a uh hashtag right here but there’s a uh exclamation at the second part of it and then you have the path to the the file The Bash file what this is is very different by having a singular uh hashtag the singular hashtag is just a comment meaning that this is not being processed it’s just something for somebody else who opens this file that wants to see what these individual lines of code represent so you have a #and then you explain what the next block of code does or at the very top of the file you’ll have one hashtag right under your shebang line that will explain okay the purpose of this script is to do X Y and Z and then for each block of code or for even sometimes even each line of code you will have a comment right above it that says this is what this line of code is going to do and then you’ll have the line of code that doesn’t have this so if there’s no comment uh hashtag in front of it that line of code is actually going to be executed which means if you don’t want the script to execute that line of code you put a comment in front of it and then all of a sudden that specific line of code has been neutralized and deactivated and this is actually something you’ll find a lot in configuration files where a lot of the commands that have already been pre-written there’s a comment uh sign in front of them there’s a hashtag in front of them which means that that specific line of code isn’t being run but if you want to configure that software to do that specific activity you just remove that #and now that line of code has been activated and then there are structures for actual flows so there would be the if else commands so if this happens do this otherwise meaning else if this happens do this else do this other thing or don’t do anything for XYZ do ABC uh while this is true then I want you to do this other thing if it’s not true then stop doing it these are types of the control flows and then you have variables so it could be you know name is equal to Hank that would be a variable and then you can use values inside of variables and variables are very very useful but essentially these are kind of like the main points of a script you can create variables within those V or you can uh call on the elements of those variables inside of an IFL statement you can have inside of the IFL statement you can have multiple variables and just recycle all of these things over and over and over again to create complex bits of code but for the most part this is the basic super super basic structure of a shell script and then we have the user space so the user space is the environment where the user level applications actually execute so it’s the separate space from the kernel obviously but it’s the the front-facing uh environment where the user actually interacts with the system so it’s an isolated environment for applications to run without directly interacting with the hardware so it goes from the user space to the kernel and then to the hardware um technically the shell is a part of the user space um this is a crucial separation for system St stability and security because the you don’t want the average user that doesn’t know what the hell they’re doing they don’t know their head from their butt for for a lack of a better word you don’t want the average user to start interacting with the kernel directly because they’ll mess up the system so you give them a user space and a user space has its own series of filters and software that interacts with the kernal and then if there’s something wrong the user space typically is the output that dis plays whatever the error message is to the user that says hey this is what you did wrong and this is what you need to fix uh the key characteristics of the user space are that the processes are isolated from each other and from the kernel preventing one process from affecting the other so for example the video uh viewer so your video player shouldn’t be interacting with a text editor right it just isolates these processes from each other and they also get isolated from the kernel itself the user space contains a wide range of applications including text editors web browsers games system utilities and then there’s limited privileges that have been applied so preventing uh the user space or from these actual uh users or these softwares from accessing Hardware or accessing Hardware directly or modifying system level settings so you can’t use a basic text editor to modify the kernel it just doesn’t allow you to do it because there there’s the limit of the authentication that takes place and the Privileges that are verified by the colonel that say Hey you can’t modify me you don’t have the Privileges to modify me and this is where a lot of these things come in from right so for each user their user space has limited privileges according to whatever the system administrator said they could or could not do the user space is separate from the kernel but they actually interact with each other right so the user space is how the user communicates with the colonel whether or not they know that they’re doing it the colonel provides system calls that allow userspace processes to request services from the kernel services that are requested by the userspace from the kernel are the file as file system access network communication process management memory allocation so uh reading and writing files right sending and receiving Network packets meaning you send uh Gmail to somebody or try to connect with gmail through your internet uh or connected with YouTube through your internet those are all considered sending and receiving Network packets it doesn’t seem very fancy when you think about it like this but every time that you request a video to be loaded from YouTube you’re requesting a packet of data to be delivered to you and that’s done through your network creating and terminating and managing processes and memory allocations so requesting and releasing memory um by using the calls to the system so system calls as we mentioned earlier the user space processes interact with the hardware devices and other resources through the kernel ensuring a secure and controlled environment so when you when you think about the kernel and then the shell and then the user space when you think about these three things you can see how they kind of layer on top of each other the kernel is the bridge between the user talking to the hardware but they need some way to talk to the kernel so they use the various tools and software and resources from the user space to talk to the kernel and then the kernel talks to the hardware and that’s basically how you interact with a system in general and now we need to know how the computer boots how does a machine boot what is the boot process so there’s something called bios and then the updated version which is UF bios is the basic input output system and it’s common onto older systems um you may have actually I don’t know how old you are but I remember bios on my very first computers when I would boot the computer it would say you know bios is initiating right so it initializes the hardware and passes control to the bootloader so it actually turns on the hard Ware the CPU the motherboard Etc and then it passes the control to the boot loader meaning it’s going to boot or load the rest of the system right to access bio setup you typically need to press this a specific key uh depending on the computer it would be delete F2 or escape again this is very old most likely your computer does not have bios and it has UF and that you do that during the boot process so as soon as you turn the computer on you start tapping F2 for example until you actually get to the BIOS menu and allows you to very uh configure the various system settings like the boot uh order the clock speed and the hardware settings and the way that looks is like this so This is actually when you get to the boot menu again I don’t know if you recognize this most likely you don’t recognize this because this is ancient um for the most part um some people I know that we have a few viewers that uh are a little bit uh there’re around my age or maybe a little bit older than me that would definitely recognize this and this is something that would be done in you know really old computers but this is basically the the BIOS menu right so this is when you actually get into BIOS and then you can do things like you know the boot priority of the hard disk quick boot first boot device second boot device third boot device checking of the password and etc etc etc uh this is not interacted with the mouse this is interacted strictly with the keyboard um I don’t know how much of this is completely relevant but this is basically what you need to know is that bios is on the older systems it’s considered the basic input output system and this is the piece of the boot process that initializes the hardware and then after the BIOS is done it passes the control of the hardware to the boot loader key functions is to power on and self test it’s called post so it cond and conducts a series of tests to check if the hardware is all good and then it issues a series of beeps to indicate the outcome of the test so this is very nostalgic for me I can I can recall those beep sounds every time I turn on my computer and if there’s an issue the beep sounds are different and once the post is done Hardware initial initialization happens so it initializes the essential Hardware like the keyboard the mouse the dis drives then it transfers the control to the boot loader which loads the operating system um which then loads the system itself so it it it loads it passes the control to the operating system bootloader and then it goes from the boot boot loader to the operating system itself so it goes from bios to post initializes The Mouse and the drive so on and so forth and then it initialize the boot loader to process the rest of the boot process and then it transfers the control of everything to the actual operating system and then you have the basic input output services so that’s the rest of these things uh for the operating system like the keyboard and mouse and display output those are the things so the keyboard and mouse would be your input display output would be the monitor and that’s your basic input output UF the unified extensible firmware interface which is just a big mouthful compared to basic input output system um the UF is the modern interface designed to replace bios it offers more flexible faster secured boating process compared to bios and this is what this looks like so you just from the get when you look at it you’re like oh this is this seems more modern right it typically does the same things though so it can actually have the same boot or tool or password or prioritization all of those things still can happen with the ufy it just happens to be quicker it happens to be a little bit more secure in this particular screenshot we see that there’s an AI tweaker wow super fancy so it allows you to have the overclock tuner the CPU the selection the filter of the pl yada yada yada these are all of the things that fall under the CompTIA A+ category to understand what all of these things actually mean and you don’t need like you really don’t need to master this for Linux it’s just that you need to understand that there was initially bios and then there was UF and then the process of the or the purpose of these things is to interact with the hardware make sure that the hardware is initialized make sure that all of the system checks are good so everything is running smoothly and then it transfers the control to the boot loader which does the rest of the loading of the boot process and then ultimately trans transfers the control to the operating system itself which means that it transfers it to Windows operating system or Linux operating system or Macos operating system they usually all have the same type of process it first calls on the hard devices the hardware and then the hardware is all good then it transfers the control to the operating system key advantages of UF over bios UF can boot systems faster um the graphic user interface so it’s actually point and click instead of just being uh keyboard navigated and it’s nicer so it’s a userfriendly graphic user interface uh secure boot so it enhance security features like secure boot which helps protect system from malicious software attacks uh large dis drives are supported through this it can support the largest dis drives or larger dis drives than bios could and then there’s Network boot that allows you to boot from a network resource making it easier to deploy and manage systems remotely so you can actually run something from a different location which was not previously available through bios um very similar to what bios was right so it still has the post the post power on self test it still has the bootloader execution and it still has the operating system boot so all of those things still happen with UF um it’s doing literally the same thing it’s just a little bit more advanced more flexible than what the standard was uh with bios and it’s faster more secure more futurer boot process that’s basically what it is it’s it does essentially the same exact thing it just does it faster it’s a little bit more flexible it allows you to do it from a remote location it’s more secure so on and so forth then you have the actual boot loader so the bootloader is the middle ground between bios UF and the actual operating system so once you uh start the BIOS or once you start UF the grand unified boot loader or grub is the bootloader that’s in Linux distributions and it takes control of the system and finishes the initial boot process then the inter so again it’s the middle ground right it’s the intermediary between the hardware and the operating system and ensures that the correct operating system is loaded and it provides a userfriendly way to choose between different boot options so for example when we go through the installation portion of this and you see as I go through the install process of Linux we’re going to be using uh the bootloader of my machine and we’re going to see oh you know what it’s actually choosing us to choose Cali or the Windows installation it’s it’s allowing us to choose the OS that we want to load and that’s where that goes right so the BIOS and UF make sure that the hardware is all good and there are no glitches and then it goes to the boot loader and the bootloader says okay which one of these os’s do you want me to load and that’s essentially the whole process between this thing and this is kind of what literally this is actually what it looks like uh just a much kind of a more modern version on the computer that I had but you see right here it actually has two different operating systems it has Linux Mint and it has Ubuntu and it has advanced options for Linux Mint and advanced options for Ubuntu so it has two different operating systems that you can choose from and then it loads it right so it’s flexible it can support multiple operating systems making it versatile for dual boot and multi- boot uh it it allows customization of the boot menu timeout settings default boot options through a configuration file so you can develop that we’re not going to talk about that um it can be configured to provide secure boot options protecting the system from malicious bootloaders and it supports Advanced features like the chain loading Network booting and kernel parameters which again are beyond the scope of this particular training but what you need to know bios UF checks the hardware passes control to the bootloader which allows you to check which operating system you want to run and then from there it transfers the control to the actual operating system so the boot menu presents a boot menu that allows you to choose which operating system you want which you already saw uh if you have dual boot which was what the example was you can choose whichever one that you want to boot whichever OS you want to boot then once you’ve selected it grub loads the actual kernel and initial Ram dis into the memory and then it transfers the control to the loaded kernel which then takes over the boot process dual boot is literally what you saw so this is just a breakdown of it when you install the operating system alongside an existing one so for example that Linux Mint could have been the primary and Ubuntu could have been the secondary the installer software modifies grubs configuration to include the newly installed OS as a boot option creating the boot menu generates a boot menu uh user selection allows you to choose the desired operating system from the menu and then loading the selected OS and then transferring the control to that OS once it loads the OS it loads the kernel for that OS and then the initial Ram the random access memory for that and then it it allows you to actually start processing or allows the computer to start processing all of those things and then the control is sent to those things so it transfers the control to that kernel and that uh RAM initial Ram dis and then those things essentially take over the control from the grub and then you’re actually in the operating system and it in initializes the operating system and that’s when you actually get into Linux right so the benefits of this is that it’s flexible you can have multiple loads uh experimentation you can test new operating systems it’s uh specifies task optimization for the specific OS that you want so if you want uh one that’s in inherent to gaming uh or one that’s intuitive or just better with gaming uh software development system administration all those things you can actually CH choose based on your goal so you can choose the OS that matches your goal and any data that’s stored on partitions that would be formatted with different file systems you can actually go access those individual ones so for example if you have data that’s only available to the NTFS which is a Windows thing you can go and recover that data because you have dual boot and then once you’ve got gotten that you can switch to Linux right so it allows you to deal with different formattings of data as well as different goals like gaming software development so on and so forth so it’s flexible it’s it’s very beneficial if you can do it then do it if you just want to run uh Linux from a USB drive and have a live boot then do that if you don’t want to mess with your overall Hardware installation or the the storage capacity of your hard disk then you can just load everything from a live USB which is good as well so dual boot is more when you install it to the actual hard drive itself to the actual physical computer you install Linux and now you have Windows and Linux on your file system then it goes from grub to CIS vinet so it’s the CIS vinet is actually the traditional initialization system that was used in Linux dros to start system services and processes during brute so uh CIS vinet or the next one the systemd that we’re going to talk about those two are the step right after grub and the bootloader so it’s basically a sequence of scripts that run in a specific order to bring up the system um the it runs those scripts so the if you are running cisv it which is again kind of like the Legacy the older version of it it runs the scripts that are located inside of the Etsy in itd uh folder and they’re responsible for starting and stopping the system Services um it has different run levels so for example run level zero is the halt state run level one is the single user mode run level five is is the default multi-user mode and it can uh choose those based on whatever the configuration was and then during the boot process it transitions through various run levels starting from a low level gradually moving to the higher level and then as it moves through those it executes the corresponding initialization scripts for each one of those run levels that are all located inside of this right the limitations here are that it’s pretty complex to configure this and difficult to understand if you don’t know coding or development language or uh syntax it can be relatively slow especially on systems that have a lot of services or they don’t they have physical limitations like the the ram is small or the CPU is old so it can be fairly slow to boot and it’s limited on parallelism meaning that it can only start the services one after the other which is sequentially uh which is inefficient right you you typically want to start everything at the same time if you just have to wait for this one to load and then move to the next one and then move to the next one it’ll take a long time especially if the system itself if the hard uh Hardware on the system is actually slow and old then this process can actually be fairly lengthy so then you want to go into system D which is the more current version of it it’s sophisticated and it essentially does what CIS vinet did but it does it better it’s faster more flexible more feature Rich and it’s the it does the same thing right so where where UF did the same thing that bios did systemd does the same thing that CIS vinet did and the way that it works is that during the boot process it takes control and starts essential Services it manages the life cycle of system services including starting staring and restarting them it ensures that the services are started in the correct order and based on their dependencies and then it logs system advents and applications to a central Journal so this was not previously provided by CIS vinet right so it goes through the boot process it runs all the services that it needs to if there’s any dependencies that are required by those Services it’ll make sure that all of those are also started and then it journals the entire process and logs them in case there’s any kind of uh troubleshooting that needs to take place that you can backtrack and find out what happened um it’s faster obviously as we’ve already talked about it runs those systems in parallel so as we talked about where it doesn’t provide parallel options in CIS vinet this can actually optimize everything by running everything at the same time and starting them at the same time time which reduces the boot time significantly as you can imagine um if there are any dependencies by those services so if a service requires something else to run it manages those dependencies automatically and just makes sure that everything is all good so that all of these things load simultaneously some things have dependencies that are required and we’ll talk about the installation of dependencies later but the you want all these things to load simultaneously you want them to load automatically without you having to worry about about it without the average user having to worry about it cuz they don’t know what they’re doing so it provides a unified framework for managing system services including starting stopping restarting and enabling disabling services that is system d uh it activates sockets uh Serv uh services that can only uh needed for further improving system performance um it can be activated through the sockets and sockets are actually also very useful for networking as well but that’s beyond the scope of what we’re talking about so system can activate Services only when they are needed further improving system performance so if you don’t need it it’s not going to be activated journaling we already talked about it in case there’s a crash or analyzing system logs timers and scheduling so precise scheduling of tasks and device management managing devices like disk network interfaces and USB devices all of this is done through systemd which is very awesome and most likely hopefully the thing that you will have to deal with when you go through your actual responsibilities as a Linux administrator um most likely you will not have to actually deal with this in the real world at all meaning you won’t have to deal with CIS vinet most likely unless you’re really dealing with like an old school system um if you do then just remember that they’re they run uh all of everything is run based on those run levels that are associated with each one of those scripts that are inside of the Etsy folder and the stuff is done not in parallel meaning it’s done one after another another it doesn’t deal with uh dependencies very well it’s fairly slow these are the key features that you need to keep in mind about CIS vinet and where CIS vinet falls short systemd takes all of those things and then some and just fills in all of those gaps and you just saw how it did all of those things and this is where we actually get to look at those run levels and boot targets so run levels would be relevant to CIS vinet right so these are the specific uh boot processes that is done through those various scripts uh each run level represents a specific state in the system and then the system transitions through these things during the boot process so you have these run levels so halt the system basically means stop the system uh one would be the single user mode two is multi-user mode without the file system the NFS um then there’s three which is the multi-user mode without the graphic user interface four is not used five would be full multi-user mode with the graphic user interface and which is this is typically the default that loads and then six would be the rebooting of the system so these are the various run levels that come in CIS vinit and these are associated with those scripts that we talked about that are inside of that Etsy init D configuration so boot processes when a system boots it starts in a low run level and it works its way up as it initializes it moves to higher run levels starting whatever service is associated with that run level for each of those run levels the scripts are inside the Etsy in the directory and these are defined they Define the actions that need to be taken when entering or exiting a particular run level and then the init process which is responsible for managing the Run levels can be instructed to switch to a different run level using the tell init command or by issuing a specific signal and this is an example of That So when you say tell in it one you’re asking it to run level one right so tell in it five would be asking it to run level five and you start the system in single user mode which is what run level one is so it causes to transition to that stopping most of the services and going only to the environment that is associated with run level one and then you have boot Targets in system D which replaces run level so cvin it had run levels system D has boot targets powerful mechanism for managing the system State they represent groups of services that should be started or stopped altogether they uh Define and control the targets and by doing that you can efficiently manage the system’s Behavior under different circumstances so the target works like this you have the dependency management the activation of the Target and a deactivation of the target so it automatically determines what dependencies between services are required and then starts them in the correct order for whatever the services are that you need to have and when a Target is activated it si the system D starts all of those Services associated with that including the dependencies for all of those services and then when you deactivate it it stops all the services that are associated with it so fairly simple the common targets would be this right so you have the multi- user. target it’s the default Target it starts multi-user mode or multi- user Target and it start Services required for multi-user environments including networking file systems basic system Services graphical Target starts graphical services like the display manager and desktop environment rescue Target that start Services necessary for system recovery like a minimal shell and network access which typically does not happen unless you’re actually troubleshooting and there’s the emergency Target which is the minimal Target starting only the most critical Services required for system maintenance which does not include network access for the most part you’re only dealing with that specific system and you’re trying to figure out exactly what’s going on so it is the like the lowest level and it only loads critical Services required for system maintenance so that’s essentially the various forms of this this is the highest level and graphical user Target or the graphical Target and the multi-user target load uh together because you want to have multiple users including networking file systems basic system but the graphical Target starts the graphical surfaces like the display manager and desktop environment if you have a version of Linux that actually supports a GUI this is the Target that would come with the boot inside of system d if you want the CIS vinet scripts if you want to manage them uh you have to know where they’re located which is the Etsy init d uh they’re typically named after whatever service they’re actually running so Apachi 2 if you’re running Apachi 2 MySQL secure shell Etc uh each script contains instructions for starting stopping and restarting the corresponding Service uh suspended executes these in a specific order ensuring that services are started in the correct sequence and the dependency are met so for example if you are running an Apachi 2 server you would need to load the Apachi 2 server before you can load any other uh software or service that requires Apachi to be running if you try to load the software service but you don’t have aachi running then that doesn’t work right so it needs to run in order so it does that in the correct sequence to make sure that whatever needs the previous thing already has that thing so that it can run it system D enables a service and this is uh very very uh similar right here so instead of doing these scripts that would be running sequentially the way that they are you can do it manually uh through enabling disabling starting stopping checking restarting and reloading and this is all very the the pattern here is very very simple the syntax is very simple so if you want to enable a service you would use enable if you want to disable it disable start it stop it uh check the status of something restart something reload something it’s very very intuitive so pseudo system CTL system control enable service name disable service name start service name stop service name and if you can probably put two and two together you would need to enable the service first before you can start the service and then you would have to stop the service before you can disable the service so that’s the the order of these things that come in once you’ve enabled it you can check the service and it says oh it’s been enabled but it’s not going to be active because you haven’t started it once you start it you check that service status and you’re like oh this is active it’s currently running so you get that uh the status of that thing and then if you need to restart it you can just do restart the service you can’t restart it if it hasn’t been enabled common sense right and if you need to reload the service configuration after you’ve done certain modifications to the config file you would just reload the configuration or reload the service and it will just reload it it has to be running obviously actually it probably doesn’t need to be running but if it is already running and you modify the configuration and you want that configuration to apply you would need to reload it you don’t necessarily need to restart it okay so let’s talk about the installation and package management portion of this whole thing um specifically the preparing and installing distributions now selecting a Linux distribution really has a lot to do with what you are trying to accomplish um so there are a variety of different versions of these dros um so we have the desktop version for Ubuntu Fedora and mint we have the server version Cent OS the Ubuntu Server Debian and then there’s actually this one that I kind of forgot to put in the title here which is the red hat Enterprise Linux and of course there’s security and Pen testing for Cali Linux so it just depending on what it is that you’re trying to do uh these are the various uh locations that you can download your ISO images so this is what’s very important to consider so if I go to the Cali uh website here this is what it would look like and so we have the the various installer images virtual machines Cloud mobile arm devices containers live boots and so on and so forth for the Intensive purposes of this particular uh portion of this uh tutorial I’m going to be using a live boot ISO image which means we want to install something that we can load from a USB drive that’s the the whole purpose here and you can have it in like one of those mini kind of USB drive drives or you can actually have a an external drive that is attached via a wire that’s what I’m going to be using and mostly because the fact that I’m also going to be using it as a storage container so typically a small USB plugin uh that is like a the size of your thumb for example a thumb drive is what they call it uh um a small USB thumb drive does not have that much memory on it so it won’t go into the terabytes at least not that I have looked for recently I’m pretty sure they have them that can go into a significant portion of storage but I’m going to be using something that has a significant portion of storage because uh for the rest of these tutorial recording I have to record the videos on that specific drive and make it so that it actually has enough uh storage for me to store video files right so uh but essentially this can be installed on any kind of USB plug-in which is called a live installation it’s a live boot or live installation so we can choose anything that we want from this particular website depending on the type of service or the type of purpose that we have for that specific installation and then same thing applies to all of these other ones as well right so you want an ISO image for the uh the specific Dr that you’ve chosen so that you can have that installed either through your computer itself a hypervisor where it’s like a cloud computing virtualization or you want to install it as a live image that to boot from a USB drive so in in either one of those cases you would get your ISO images from these links I’m going to put these links inside of the description below so you can get access to them directly and I highly recommend that you don’t get them from any kind of a torrent website just get them directly from the actual website for these individual distributions so that you can be sure that there hasn’t been any manipulation done with the iso and you’re not downloading anything that you shouldn’t be downloading or anything that has been tampered with that’s the that’s a really big important piece right here you don’t want to download something that has been modified even if the developer says oh this is going to be really really helpful or whatever learn how to make those modifications yourself don’t download something that’s been pre-modified especially from a torrent website because you just you you never know what you’re going to be downloading and if there’s some kind of a malware or ransomware or something that’s installed on it the Trojan warm whatever you you just don’t want to deal with that kind of stuff so again one last final notice download directly from the websites that you see here so that you get the actual ISO images that have been verified and uh you know that they’re they’re good to go now as far as the installation process itself is concerned I’m just going to kind of give you an overview of this but I’m going to demonstrate what this looks like when you want to use uh one of these ISO images to install a uh uh limit Linux version for yourself so in this particular case now as far as the installation process is concerned I’m just going to give you like a step-by-step breakdown and then we’ll go into an actual live installation of Cali Linux cuz I love Cali Linux and we’re going to install it on an external USB drive and then you can just see what that entire process looks like so first and foremost you want to prepare your external drive I always format it especially if it’s just a fresh drive and you’re uh making you want to make sure that it runs on all of the uh major operating system so for example a Windows Mac OS and Linux operating system system you want your drive to be able to adjust to whatever that OS is and actually run on all of them if it’s formatted in one particular format and won’t run on Mac OS or Linux then you’re going to be hindered and limited so even it’s a brand if it’s a brand new drive that you’ve gotten you can use something like the Mac OS dis utility or the equivalent version on Windows to just format the the drive so that it can run on all of the different os’s and I’ll show you what that looks like in a bit so you want to prepare the drive and then make sure that it actually has enough storage space for Cali Linux it’s not a big file so the installation and the iso image is not large but the recommended size is to have at least 4 GB on the drive just to make sure that you’re all good um then you want to download the Linux from one of the official links that I gave you and get the iso image of the drro that matches your system architecture and your needs whatever you actually want to do and then we have the creating of the bootable media so this this is where etcher which is a tool it’s a free tool so is Rufus they’re both free tools etcher is for Mac OS Rufus is for Windows and it essentially turns uh the iso image it makes it creates a live image uh on that USB drive so that that USB can now be a bootable device and once you connect it to a Windows machine or anything that allows you to do that you can go ahead and load that Cali Linux image from the the device so technically you’re just literally going to be walking around with essentially a computer on a USB drive that’s kind of what it feels like right so you want to turn the USB drive into a bootable media and we’ll be doing that live as well and then we’re going to boot from the USB drive so when you actually go through this process uh this one is kind of uh fairly simple straightforward you’re just going to be going through the wizard itself there are a few elements that once I boot from the USB drive I’m going to be uh recording so I can show you what specific options you need to choose to make sure that it loads uh most likely in every case that I’ve gone through you need to get to the BIOS or UF settings which is the the very base settings of the computer so that it allows you to choose uh a boot from either the internal memory or from an external file and what we’re going to be doing is loading from an external file and then we have the Linux installation itself so this typically this is done uh using rofus Rufus or etcher but sometimes it’s actually also done uh from your computer when you’re going through the boot process where you would you do your Linux installation now if we’re running from a USB drive you don’t necessarily do any kind of a Linux installation it just loads from that USB drive so that that’s kind of one of those uh optional portions and same thing here this can this is most likely done in etcher or roof this and sometimes maybe it’ll be done while you’re booting from the computer where you you know choose your language and the location keyboard layout etc etc um then we have the external SSD portion of this where you choose this as the installation Target and again this is done through etcher or Rufus where you choose the external SSD which is when you choose the USB drive to uh be as your installation Target and then it’ll install the live version of Linux onto that external SSD and then you just go through the the Motions you may be prompted to set up a username and password if you aren’t the basic username and password is C Cali so C would be the username Cali would be the password and then once you’re logged in you can modify those and then you just start it you you restart the computer you boot into Linux uh from the external SSD from the file inside of the SSD and then from there you actually have your boot running and your operating system will load and you’ll be inside of Kelly Linux so this is what the step-by-step looks like so what I’m going to do now is I’m going to actually go through all of those steps and just show you what that looks like okay so this is my dis utility on Mac and so what we can see here is that I have my primary 2 tbte drive and I have the Linux drive that’s right here and then there’s actually a balena etcher uh dis image as well that’s been uh activated because that’s what we’re going to be using to do our installation of the Cali Linux ISO so in this particular case I’ve already formatted this drive I just want to show you what that process would look like so that you can make it uh usable by all of the operating systems so I’ve clicked on the actual drive itself up here I’m going to go through erase and then you know the name is fine it’s Linux the format is the big piece right here so MS DOS as you can imagine is Microsoft Mac OS extended and journaled these two are going to be Mac OS specific what we want to do is we want xat xat is the uh multi-os version of this where you can just make sure that this thing will run on uh essentially any operating system that it runs on now if your options for this formatting aren’t exactly the formatting that you see right here then just a simple Google search or conversation with Gemini or GPT will allow you to find the specific formatting option that will allow you to go through uh a boot from any kind of a machine Mac OS windows so on and so forth and then Security Options this portion is I’ve specifically actually had information that was on this drive previously so I left it at fastest because it would be possible to recover the data that was on this uh drive if I leave it as fast as because it’s not the most secure meaning it’s not going to wipe it and make it unrecoverable when you take it all the way to the end right here it makes it absolutely unrecoverable you won’t be able to take any data from it and it essentially overwrites the the drive with a multiple series of zeros and ones and literally just making it unrecoverable you won’t be able to boot anything from it so uh that one’s up to you if you’re getting a brand new drive it doesn’t really matter but if you’re wiping something that you previously had you might want to keep it so that you can potentially at some point reboot it and then once that’s once you’ve selected your options you just click erase right here and then it’ll just erase the whole thing and make it a brand new drive so that you can use it for your installation process and then this is what it’ll look like it’ll just be you know 1 tbyte free and then you have 12 megabytes that are still used which I presume would be all of that data that I previously erased that’s still kind of sitting somehow in storage back there so that’s pretty much it that’s all we got and then the dis itself the USB drive will actually be ready for installation using either Rufus or etcher and now that my drive is ready what I’m going to do is I’m going to choose the version of these isos that is most applicable to me and in this particular case it’s the live boot that’s available over here so it’s literally unaltered host system meaning your main computer won’t be changed in any way you get access to the hardware of the host system so if you have a 16 GB Ram the live boot will use the 16 GB RAM and then the customized Cali kernel of course performance decrease when heavy in andout is not a uh input output is what that essentially stands for um it won’t be affected in any way because again it just is doing a live boot from this piece and you’re using the main system so very quick very easy you get a full Cali installation or Linux installation and then you can do this with all of the different versions of Linux as well this is not limited just to Cali so you can run all of the other ones from a USB drive as well so I’m going to click uh the uh live Boot and then from here I’m going to pick 64bit because my machine is actually it can handle a 64-bit so I’m going to do 64-bit and from here on out I’m going to be using a Windows machine and I just have verified on there as well that it is all good and then the piece right here that you see that it says torrent and then the sum value this is the piece that you can verify what the hash of this particular ISO image is and for security purposes if you don’t get your ISO image from the Cali website directly if you get it from some kind of a torrent website you need to run the Sha 256 sum and find whether or not that value is exactly this value if the value has been altered even by one letter then don’t do it because the official installation shop 256 hash value is this which means that this is what C has actually confirmed therefore it’s something that you can trust right that’s essentially how I’m going to go about trying to explain this as best as I can the installation itself is 4.3 GB so we’re going to just click download and it’ll start to download right here for me and once that has has been downloaded we will go through etcher and we will install it on our USB drive okay so our ISO has officially downloaded and I have etcher open and as you can see it’s very very simple it’s not it’s not a complicated uh interface so what we’re going to do in this case we’re going to flash from the file the file that we’ve downloaded the iso image uh you can also Flash from a URL or you can clone a specific Drive that you have so I’m just going to do flash from file and then from here I have to choose the iso image and in this particular case it’s literally right here in my uh Cali Linux in my downloads folder so I’m just going to click that ISO image it has the iso at the end of it we’re going to click open and then we’re going to select the target onto which we want to write this specific thing and in this case I have my Cate beup slim BK this is the one with the one terab that’s the one that I know that I want there’s the Apple SSD and all these various things I don’t want to mess with these in any way this is the one that I want which is the one TB Drive uh the CATE 2 uh portable media the 2 terb drive that’s the one that I uh don’t want to mess with now there is a way that we can just make sure which one these are cuz I’ve actually renamed these and I’m not seeing the renamed version of this so there’s a way that I can find out which Drive it is that has been assigned to dis 5 and dis 4 Etc and we’re going to do that inside of our terminal okay I have loaded my terminal very very simply um the command itself is very simple so it’s disk util for the dis utility and we’re just going to do list and you press enter and it brings up a bunch of data um including all of these partitioned drives that we have over here and these partition drives should actually have their name that we’ve assigned to them as well so in my particular case we already saw on uh the eter that we had Dev dis 4 and Dev disk 5 were the two drives that it uh noticed that it said it has a lot of information or a lot of por a lot of the size data storage data on it um the 2 tbte one is the one that is named right here which is the primary 2 terb that’s the actual name that I gave it not the name that it came pre-installed with inside of the uh when like when I bought the CATE drive that those are the names are the ones that you see like those original names is what we see uh the next one is the one that I’ve named Linux and that’s the drive that I’m most interested in and we can see that it has the 1 tab size and the availability in this particular case we have the two terab size but the availability is not that much cuz I’ve St I’ve stored so much data on it um so it’s not really that good as far as the availabilities of us concerned I definitely want this one that I named Linux and I can see that it is inside of the dev dis 5 partition right here so that’s what is most interesting to me and most useful to me so now I’ve confirmed that data I’ve confirmed that information I know that I want the drive that’s on dev disk 5 so I can continue with my installation on etcher and here it is I already had it installed cuz that’s pretty much what I figured because I knew it was the one TB drive so this is it the seate buff Slim K media etc etc I’m going to select this one as my drive and that’s it once that’s done you just click Flash and it says hey you’re about to erase an unusually large Drive do you are you sure that you don’t want uh are you sure that the selected drive is not a storage drive and I’m just going to say yes I’m sure because what I know is that I can go ahead and uh use that as a storage drive when I do launch Cali Linux uh in front of my or from my other computer you will also get notified to enter your password because it is a privileged access type of a uh thing that it needs to run so uh I haven’t pressed enter so it actually stopped but uh we’re going to retry this one more time because I just want to make sure that uh I do run it correctly so we’re going to run it all over again and I’m just going to enter my password at the very end real quick just to give it permission to do what it needs to do and then it’ll it’ll create the drive for us okay so there you go the password went through I got a permission request for eter to uh access this particular drive and I gave it the request and you can see it’s working and it works very quickly cuz it’s not a massive ISO image or anything like that so it’s going to take maybe another 30 seconds or so and then the installation of Cali Linux will be done on this external USB drive and then we can go ahead and boot it and talk about the rest of the stuff about partitions and package managers so on and so forth all right so when I reboot my computer and I just keep pressing F12 this is on a Windows machine it’ll take me to the boot menu and then when I get to the boot menu uh the option that I want is to actually get to the boot screen which is F9 for me and then I choose a live boot from a file and then I choose the Cali image that I had and then I go to EFI and then I go to boot and then I choose the uh 6 4bit version of it and then this is what we land on this is the actual menu for Cali from uh any kind of a USB drive or even a CD ROM if you actually had a CD ROM and then you see that we have all these options to boot from live from the USB itself and then we have the installation portion and what I’m going to do for this section is I’m going to boot it from the uh the USB live image and we’re going to boot it with USB persistence and as soon as you pick that image it basically brings you to the the loading screen here so uh it usually takes about maybe like 20 to 30 seconds for this to actually load and then when it loads we have the operating system running ready to go with all of the utilities installed and uh essentially that’s it so it’s that quick to just boot from a USB drive uh without going through the full installation process so you’ll see here in a couple of seconds that it’ll actually load and I have to actually record the screen with myself cell phone so that’s why the image quality is like this but when we start doing the screen capture once we’re inside of uh the Cali Linux machine it’s going to be much clearer and you’ll be able to see everything as I click around and here we have it this is literally the the operating system loaded ready to go we have of course the file system with all of the uh system binaries and everything like that you can open up a terminal and have that run very quickly and smoothly and I uh all of the utilities for the most part like 9 % of the utilities are already pre-installed and then if you wanted to go to your home as the user you would access it through the file system if you went through the menu you will get access to all of the utilities and the shortcuts that are available so it’s a fully functional operating system that’s available so what I’m going to do right now is I’m going to restart it and uh it’ll take me back to the very beginning of the uh computer’s boot process and then we’ll do F12 again so that we actually can get to the boot menu and then once we are inside of the boot menu we’re going to repeat the same process that we did before uh meaning we are going to go and actually uh do the boot menu Itself by F9 then we’re going to boot from a file we’re going to choose our Cali live image and then I’m going to go to the EFI option and go to boot again and then choose the 64-bit version again but this time around when we actually get to the menu here I’m going to actually click the install installation uh option so that we can go through a full install so you can actually see what it’s like to go through the installation process with Cali Linux Wizard and uh how to select your partitions and so on and so forth so pretty much just like every other operating system when you boot it for the first time it’ll ask you your preferences so your language and your country and uh I guess the version of English for me and then I’m going to just keep pressing next until it gets me to the port where I have to choose my partitions um and essentially it’s going to ask me how I want to split the memory storage of the computer that I’m on cuz I’m using a technically a type 2 hypervisor because this is being booted from my Windows machine so my Windows machine the operating system of the windows is going to be the primary portion of the the operating system and we’re running Cali Linux as an extra installation and so the main Hardware of the Windows machine is going to act as the basis for this and then we have the uh Windows machine itself and then this is going to be our dual boot option where we can if we uh whenever we restart this and we get to the boot menu we can actually choose to boot Cali Linux instead of booting the uh the Windows machine so actually technically I think this is a type one hypervisor because we’re booting live from the hard drive we’re not booting on top of the actual Windows operating system so I won’t go inside of the Windows operating system so you can see I’m I’m setting up my username here and I’m setting up a password for my installation all of these things are very very intuitive and very easy to follow the instructions and I do stand correct it so the once this installation would be finished this would actually be our dual boot option where we are running Cali on top of the hardware of my computer instead of running it on top of the window Windows OS so meaning you would log into Windows OS and then you would use some kind of a hypervisor to launch Cali Linux instead of doing that we’re booting it live from the windows OS and this is the portion that we get into where we do the selection for how we want to create our partitions and so um it essentially just gives the the recommended option if you don’t know what you’re doing you can just follow along with the options that it gives you and it creates the most basic uh partition split apart for your root directory your users home directories and all of the other primary and extended partitions that would be necessary to boot uh Cali Linux and I’m using the external drive that you can see right here it has about a terabyte of uh storage that would be used for my partitioning file system and then that’s what I’m going to use to create the rest of this uh the browser or not the browser the wizard and then it’s going to be a guided process and everything else would after that once you press accept and then you press enter it’s going to start creating the partitions and then it’s going to actually take you into the boot menu very similar to what we had from the live uh version you would restart the system and then you would select your Cali Linux installation uh Cali Linux operating system and then it would just load Cali Linux and it would look exactly what it looked like from the live boot that we did from the USB drive except that time around you would be running it directly on top of your Hardware so I’m restarting my computer and then we’re going to get back to the presentation all right let’s talk about managing partitions file systems and dis usage here are some important partitioning Concepts to consider and to keep in mind so the role of partitions in isolating systems or user data is mainly to uh preserve space uh on a physical storage device so if you can think of partitions as logical divisions of a physical storage device allowing the operating system to manage the data in separate isolated areas on the same device they’re key in organizing the data and helping with performance security and manageability and the the visual is really the big thing that I kind of wanted you to wrap your head around I work well with visuals and I feel like you may also get value from this as well so if we look at this left portion right here let’s say you have two physical storage devices right so you have piece one and piece two and piece two has been broken down into three separate pieces right here you can consider that to be partitioning and so this can be actual physical storage or it could be one of the primary partitions as we’ll talk about in the next slide it could be one of the primary partitions that has been broken down into multiple pieces but to really just kind of wrap your head around what partitioning is kind of like the name implies itself you’re breaking storage space down into parts so it could be the actual physical storage space so you could have one physical storage device that’s on your uh computer so whether it’s a server or it could be your laptop or uh the Cali Linux machine uh or really anything on a USB drive or something like that you could have an external storage device that you’ve plugged into your computer that could be the physical storage device and as you go through booting and setting up your your computer so let’s say you’re installing Linux on one of your storage devices or as a virtual computer or a virtual machine and you as you go through the installation it asks you for the drive to use for partitioning and then you select your external external drive to be your partitioning storage or your storage device that you will partition and then from there it’ll just go through its various uh options and it’ll guide you through it or you can manually select how you want to do it like we did in the the installation video or the installation portion of this video right so that’s essentially what partitioning itself is right so when you think about the uh advantages that comes along with partitioning uh there are three-fold and this is just kind of a general approach to it so the isolation of data right so they keep system files separate from user data reducing the risk of user data corrupting or the corruption of user data in the event of any kind of a system failure right so you keep system data as well as user data separate from each other you isolate those data types from each other so that in case anything happens one or the other won’t affect the other right and then you have the performance of it so when you separate frequently access files such as the stuff that’s inside the V VAR directory the variable directory from system critical files that can uh improve the performance of the machine right so frequently accessed files um can be logs they can be dynamic data email spools whatever it may be those things if they’re kept separate from the system critical files then it can actually help perform help the performance of your device it can make it run smoother and faster and then you have security and recovery and this is a really big one especially for our world on this channel we’re going to be we talk about security all the time and you’re probably going to be in incident response at some point and uh having backups and securing The crucial data is very very important so when you isolate system files inside of a partition separate from user files it makes it easier to manage the permissions and restrict access to those system files right here and it enables quicker recovery in the event of data corruption or system failure so these are some of the key advantages of going through partitioning now here are the examples of the common primary partitions most Linux devices break down to at Max four primary partitions one of the biggest and most important one is the root partition so this would be the main directory where everything is installed including the home partition and the VAR partition and everything else right it is an extension of the root partition and keep that word extension in mind so you have the root partition the home partition and the VAR partition these are typically the most common partitions and when you go through the installation of any Linux uh device you will see that as your options right you can say that you know use one specific location use that as the main partition or break it down into these three common partitions and then the swap space is a separate partition for managing memory overflow and we’ll talk about what that is in a little bit but these are the most common partitions and in a lot of cases these are also the primary partitions so this is what we’re going to be talking about right now so the primary partitions are the main partitions that can be directly used to boot the operating system so for example the root partition The Root Drive that forward slash that represents root that is a primary or I would say the primary partition the limitations um have to do with the traditional partitioning scheme that actually allow a maximum of four primary partitions per hard drive now it’s common to use primary partitions for the main operating system and important system data and then have your extensions and logical partitions go for other types of data so the root so if we go back to this real quick this is the main directory where everything of the OS is installed the home is the storing of the user specific file so for example the variety of different users if you have five users inside of the home directory here you will have five separate folders or five separate directories for each one of those users and typically it’s the username that’s assigned for each one of those directory and then you have the VAR partition which is isolating the frequently changing files like the logs that can grow ins size over time and then you’ll need to wipe them eventually to help preserve space on the overall storage of the computer right so if you’re computer has I don’t know let’s say one terabyte of storage then this specific thing will take up a lot of space because if you don’t have proper scheduling of the backups and the wipes so that you can transfer it from that main terabyte of storage into another uh storage device this can overflow very quickly and it can take up a bulk of your uh one tbte right so these are the the primary partition types now what happens is that you have these primary partitions so these are the actual primary partitions uh more often than not the root is uh I mean I would say 100% of the time the root is the primary uh system partition it’s the main partition where the Linux operating system is installed it contains all the system files the libraries binaries and everything else so we talked about those uh when we looked at the file system earlier we were talking about all of those extensions of the the root partition and that’s where all of these system uh files are uh considered to be installed and so the you know we talked about the library and the binaries and the system binaries and the the temp log and all of that stuff or the temp folder and all of these various other uh partitions or extensions of the root partition then you have the boot partition uh which contains the boot loader the kernel other files needed to boot the Linux system it’s usually a small partition and around 500 megabytes to 1 GB because it doesn’t require a lot of data space to run the to you know store the kernel and the bootloader and all those things but this is also a main primary partition because without this the system won’t be able to boot it won’t be able to start and then you have the home partition which is also another one of those primary partitions um and these are the three that have to do with the variety types of data that are stored uh let’s say permanently on the machine and then you have the swap partition that uh deal deals with the random access memory it deals with the the temporary uh data and the processing power of the machine that you’re using so it’s used as virtual memory when the physical RAM of the computer is maxed out and you need a place to uh store some of the virtual or uh the volatile uh data points that need to be stored temporarily until you don’t need them anymore and so the swap partition deals with the random access memory or data that’s similar to the stuff that’s on random access memory which is considered to be volatile data that just is uh is also uh considered to be dynamic data that goes in and out and you use it uh more in like a live environment and then typically when the system reboots and when it restarts uh this whole thing is reset and you don’t have to worry about this stuff anymore um we don’t consider hibernation to be a part of system Reboot system reboot is when the computer is actually restarted or the systems actually restarted hibernation is just when it goes to sleep and then you need to recover all of the data that that was inside of the ram inside of the hibernation file as well as the swap partition to pick up where you left off so these more so are permanent partitions with stored data that you can access after reboot after reboot after reboot and then this is volatile data that typically is reset and wiped every time you reboot the computer and of course hibernation does not count as a reboot when a computer goes to sleep it does not count as a reboot so these are our primary partitions and then we have the extended partitions so an extended partition is a container for additional logical partition so the extended partition is not the actual Storehouse of the data it’s a container for other logical partitions so it helps to bypass the four partition limit that’s dedicating one primary partition as an extended partition which typically is the root uh partition so The Root Drive the root partition ends up being that one primary partition that becomes the extended partition and then within the root drive you end up having all of these other logical partition so for example the forward SL TMP and the forward slash uh Dev and forward slash everything else that falls under a logical partition so the primary partition gets extended right so primary partitions can and often do act as extended partitions however there’s only one extended partition that can be created on a physical drive but it can contain numerous logical partitions so that means you can literally have essentially as many as you need uh within that one primary partition that has been extended so the extended partitions are commonly used on systems that need more than four partitions without using newer partitioning schemes like the GPT partitioning scheme so we’re talking about a lot of the traditional Linux which in in the modern world it’s still being used so uh it’s you’re going to most likely run across the primary or the the the we can call it the Legacy the original uh partitioning scheme that has the four primary and then within that one primary which is the root there’s a bunch of other logical partitions and you’re going to run across that a lot and you’re going to know need to know that uh as a job for a Linux administrator and then when you deal with a GPT partitioning scheme it’s just easier to deal with it uh simply because the fact that allows you to have more than four primary partitions and then you can uh Storehouse or compartmentalize your data easier so these are some extended examples so the SLV VAR log or the VAR folder this can actually be a primary partition when you’re doing your uh installation of Linux but you can also just have it be one of the logical partitions so it can be the extension of the root right so it’s the root is represented by this for slash D VAR right here would be the extension and then inside of this you’ll have the VAR log and then the VAR email or VAR whatever and you’ll have a bunch of other logical containers that will have a variety of different types of data so for example log files and databases email schools and any other Dynamic content that is being frequently used or updated so it helps manage large amounts of data that change frequently so this is one of the very common uh extended partitions which could also be considered a logical partition and then you have the for sltm the temporary files so this is also another extension of the root partition and it holds temporary files right um then you have the for slev which is a logical partition for development work or it can be the other um we can call them virtualized uh portions of your machine so this is another extension of the root partition that can act as a logical partition as well so essentially what you’re doing is you are extending the root drive and then Within These folders you will have a variety of other folders that will act as The Logical partitions that are stored inside of these extended partitions so hopefully that’s making sense a little bit and finally we have the logical partition so these are the subdivisions within an extended partition right so you can have the within the home directory within the home extended partition you can have a bunch of user partitions a bunch of user folders and all of those user folders end up being the logical partitions within the VAR directory you can have the slail SL log SL Etc and you can have a bunch of other uh folders or directories that act as the subdivisions of that specific directory and that ends up being the uh the uh logical extension The Logical partition of this extended partition so hopefully that makes sense so just going back to this image right here just to kind of give you another visual uh with the example of extended and primary and logical partition so if these two for example our are our primary partitions and then within this primary partition we have these extended partitions and then this one could be the VAR partition this one could be the Dev partition and this one could be the TMP partition or the home partition for example so these could act as anything right and so if you want to expand on this so if we bring this one right here and this ends up being the VAR partition now over here which ends up being our extended partition and within this VAR partition we would have the log and then the email and whatever else it would be that’s how it breaks down right so you have have the primary that gets broken down into these extensions and then these extensions can come and then one extension could be broken down into multiple logical partitions so that’s really how the whole thing ends up breaking down and you it’s essentially just a way to organize your data and to compartmentalize data so you can as uh the benefits that we talked about earlier you can just have better uh access to these things and you make sure that the it performs better on the actual system and in case there’s any security or backup issues you’ll be able to compartmentalize and uh access certain points uh much easier and if one thing crashes it doesn’t affect everything else so on and so forth so uh partitioning uh serves multiple purposes and it’s it’s fairly a simple concept once you kind of really get a chance to wrap your head around it you have four primary partitions within those primary partitions one of them we can be turned into an extended partition so from that root we can have multiple extensions and then each one of those extensions inside of it is going to have a variety of different uh partitions that will be the logical so there is four primaries one of those primaries is going to turn into a an extended where you can have multiple extensions inside of it and within each one of those extensions those extensions end up being containers for all of the other logical partitions right so you can think of partitions also as containers if it helps you and that’s essentially that’s what that’s all that partitioning is when you just want to understand the concept of partitioning and to give you a few examples uh as far as the the way that the file system looks so let’s say that you have the extended partition which is Dev sda4 right so this is the extended partition that’s on your disk and this is part itself doesn’t store any data directly but it actually has a contain it becomes a container for other logical partition So within this partition you can have multiple logical partitions that serve various purposes so for example within Dev SDA 4 we can have Dev SDA 5 which is allocated to data right so uh this is done inside of either the partitioning uh process as you’re doing your installation or it’s done inside of the uh the configuration file that is stored inside of our Etsy directory and within that configuration file we can make all of these assignments of these partitions and we’ll we’ll talk about that in a little bit so this logical partition is created within the extended of sda4 it’s assigned to the Mount point of data meaning that when you access data in your file system you’re actually accessing this specific logical partition that is housing all of the data inside of that it kind of seems a little bit confusing but uh if you can just wrap your head around it you’ll you’ll see what it means and I’ll show you what the tree structure of it actually looks like and how these things are connected so you have that visual as well but it’s typically uh used for storing user data documents media files Etc so that’s what the for slash dat uh file is or folder with the forward SL data folder that’s what it houses is the user data document so on and so forth and it gets mount right so it gets mounted onto this logical partition that is sitting inside of that extended partition so we can also have SDA 7 that is inside of the SDA uh 4 right so SDA 5 would be in there uh SDA 7 I think it was supposed to be SDA 6 or something and I accidentally clicked seven but it’s allocated to backup right so this is the third logical partition within this specific extension and it’s assigned to the Mount Point backup which is USIC specifically for storing backup files and system snapshots and it helps in organizing backup data separately from other system and user data and then we this is our tree visual of this so this would be our extended partition and then within this extended partition you have these multiple logical partitions and this one is mounted at data this one is mounted at the VAR uh folder and this one is mounted as the backup folder okay so you don’t need to go a really deep into this it’s beyond the scope of what’s covered inside Linux plus but you just need to understand the difference between primary extended and logical partitioning so that as you are asked questions or you uh are looking at uh potential examples you can differentiate between these various partition types A final note on this during installation uh the wizard will guide you through the partitioning and will ask you how you want to partition your hard disk even if you boot from a USB drive as a live boot you can still choose USB persistence and maintain your partitioning options and in this case you’ll likely have to manually edit your partitions uh you’ll create the partitions using the Fisk or the CF disk command and then from there you’ll Mount each of the new partitions inside of the Etsy FS tab configuration file and that’s essentially how it looks like um so the this portion of it uh I don’t know if this will be right before we go through the actual uh wizard for the installation of Linux or this portion of the lecture will be after we’ve gone through it but either before this you will have seen this entire concept or after this you will see the entire concept I’m not sure exactly how I’m going to end up uh putting the edit together but for sure you will see this uh this example of how this partitioning is actually done especially with the installation of the wizard in 99% of environments there’s going going to be a wizard that will guide you through the partitioning and will do all of these things for you so if you want to boot uh from a USB you’ll need to know how to uh configure the FST tab configuration file but more often than not you’re not going to need to worry about that because if you’re booting from a USB you’re only using it for its uh capabilities and not as a storage device and that is a completely different situation and it again it’s beyond the scope of of this particular uh training Series so that’s essentially uh how you can ensure that your partitions are run and configured during installation and uh you will have either definitely seen that prior to this or you will see this right after this right after a piece swap space uh is something that uh is disk space that’s designated to act as the Overflow for the system Ram so when the physical RAM on on your system is exhausted the system uses this swap space to temporarily hold inactive memory Pages allowing active processes to continue without crashing so let’s say you have a bunch of uh software open and a lot of them aren’t currently actually being used so what’s going to happen is that those memory pages are going to be stored in the swap space and your physical RAM is going to be dedicated towards anything that you’re actively using and and if that ends up being uh too much so if your swap space ends up getting overflowed as well as your physical RAM that’s when you start seeing the system you know uh slow down drastically and then sometimes you even see a system crash because you’re really overclocking the processing power of your computer and at that point uh it just can’t handle everything that you’re throwing at it but more often than not what happens when your physical RAM is maxed out uh it just sends everything that’s temporarily inactive so it could just be something that is minimized on your computer or uh a document or something that you’re just not using those end up going in the inactive memory pages but you can quickly call on them to bring them back to the Forefront and then once they come back to the Forefront they go from the swap space and they start using the physical RAM so the swap space is for inactive memory pages so just keep that in mind and uh that’s how it alternates back and forth between the physical Rams processing and what is being done in the background so to speak the inactive memory pages that are running in the background by doing that swap space uh extends your memory’s capacity so uh when the system hangs uh because memory demand exceeds what’s available on your physical RAM the swap space acts as a buffer to prevent crashes of the system um it takes a lot especially in modern computers cuz modern Computing is strong enough that you really don’t go uh into a system crash unless you’re really just you haven’t done a reboot in a like in years and your computer has a million different tabs open and a bunch of different software open you typically don’t see I haven’t seen a system crash on my computers in a very very long time because the swap space along with the the ram that I’ve chosen works very well and I I just like using computers or buying computers that have a a lot of physical RAM because I wanted to run fast and you know I do video editing and I do gaming and all these things and you just want a good computer that has a lot of physical RAM and the cpu’s uh gigahertz uh the hert power of the the CPU also contributes to the processing power of this so if you have a really strong CPU as well as a lot of gigabytes of RAM you’re not going to worry about this kind of crash or anything but in the event that you’re dealing with a computer that is mainly just for Linux and uh data processing it’s acting as a database and uh it can’t handle a lot of the workflow that’s being thrown at it for whatever reason uh then the swap space will kick in and it will help alleviate alleviate some of the pressure that’s being put on the physical RAM so that there is no crash that happens so it will extend the memory capacity of the physical computer and then it also facilitates hibernation so we already kind of touched on this a little bit but it’s also required for the syst system going to sleep right so when the system goes to sleep there’s a lot of stuff that uh is inactive at that point and a lot of those things go inside of those inactive Pages the data Pages memory pages that we refer to and those things are just stored in the background and when the computer uh wakes back up or it comes out of hibernation all of that stuff is recalled from the swap space so your computer can pick up where it left off and that’s another one of those things that’s really really powerful especially if like for example when you have a laptop and you don’t actually turn off the laptop you just close the screen like you pull the screen down that’s going into hibernation and when you lift the screen back up you literally are waking it up and it’s pulling all of its data from it swap space and this applies to both Linux and Windows and Mac OS so swap space is not something that is just uh uh inherent to Linux right so it applies to everything they may have different names for it or titling for it but this concept applies to everything so it’s it’s just an extension of the physical RAM capacity to make sure that the ram itself is actually all good and the computer runs smoothly and in case the computer goes to sleep you want to pick up where you left back up so it recalls all of the data and all of the the processes that were active and then went to sleep and now you need to reuse them again now some general commands that we need to just keep in mind these are very important uh partitioning commands to create a partition you can do it with either the Fisk command or the parted command and it will’ll talk about those in a little bit in depth um but these are all pseudo commands so it does require some kind of a root permission or at least for the user to be on the pseudo list but you do pseudo Fisk Dev SDA and it creates or modifies or deletes some kind of a partition in this particular case and then parted is another one of those things that in this part in with this specific command it’s creating primary partition with parted and it’s using the format of the ext4 and it’s giving it a 1 Megabyte to 512 megabyte capacity so uh these are just examples of part we’re going to go uh further in depth into uh Fisk and parted in a few slides but these are just uh some sample commands of what it looks like to create a partition or to be able to modify a partition with either parted or Fisk and parted also has a graphical user version of it that is outside of the command line that’s very very intuitive and you can use it with just point and click and it’s very easy so if you’re not using just a Linux uh command line type of a computer and you actually have access to a graphic user interface more often than not you’ll end up using gparted which is the graphic user uh version of this so uh these are just some sample commands of what it looks like to create a partition these are these sample commands to view your current partition so lsblk uh lists the block devices and the partitions that are associated with them and an Fisk L will list all the partitions and their details so these are some ways that you can view your current partitions and the how much storage they’re using and what they’re assigned to so on and so forth so these are things for viewing partitions and then these are some sample commands for dealing with swap space and managing your swap so MK swap swap on and swap off swap on and swap off are fairly intuitive you can kind of tell what they do from just their name but MK swap makes a swap space at this particular location so it in initialize a partition for use as a swap and then swap on activates a specific swap file all right now we need to look at file systems from the perspective of uh partitioning and this is uh another review of what we talked about earlier earlier we were just talking about file file systems in the context of file systems and where things are located how things are broken down now we’re going to be looking at it from the perspective of partitioning so the ext4 xt4 uh is the fourth extended file system so it’s the the most recent version of ex2 EX EX3 Etc and it’s the default in most Linux distributions it’s very reliable it supports large files and journaling uh the file system is one of the most widely used in Linux typically set as the default in many distributions like ubun 2 and davan and Cali Linux is technically an obuntu distribution and so it runs with the xt4 as well uh it builds upon the previous versions which is 2 and three and it has enhanced reliability speed support for large files etc etc so ext4 is most likely what is going to be run in a lot of desktop platforms if you’re going to be doing uh system advance Administration for Linux on desktops these are the key features of ext4 we’ve already talked about this so I’m not going to spend too much time on this slide but it provides for journaling which helps protect data Integrity um it records changes before they’re applied to the main file system making recovery easier um it provides large files uh or supports large files uh it has backward comp compatibility meaning that it can actually work with EXT2 and ext3 allowing users to mount and use those specific file systems without reformatting which is actually very convenient and has delayed allocation and extent so what that means is that it improves the dis input output performance by reducing the fragmentation the breaking down of data and better managing storage space so it’s as uh the the expected uh performance is it should be the better version of EXT2 and ext3 allowing for better performance the better management of storage so on and so forth so xt4 the most commonly used and it does journaling large file support backward compatibility with the other versions and delayed allocation and extension so that you can uh better manage your storage space and better manage your actual input output performance so the input of your uh requests and calls into the system and the output from the system to uh reply to your calls and Grant the requests that you’re making the typical use cases for xt4 uh is as we mentioned desktop systems personal laptops general purpose servers uh it’s because of the fact that it’s most commonly used and it’s one of the most uh versatile it’s used in a lot of common use cases and it’s a good option for people who prioritize data integrity and who may need backward compatibility with older types of file systems so this is for the personal computer uh you know desktop system general purpose server so on and so forth that’s what xt4 is great for and more often than not as a beginner Linux administrator you’re not going to be ma dealing with massive data centers and things like that so you’re going to be dealing with xt4 file systems more often than not as a beginner Linux administrator if you wanted to make an xt4 file system you just run pseudo M mkfs so make file system. xt4 to just make sure that it’s creating an xt4 file system and then you give it the mount point that you wanted to make the file system on and then check or repair that would be FS check file system check. xt4 and then give it the mount point that it was already installed on so these are some ways that you can create one and check or repair the status of that specific file system and then we have xfs the xfs file system uh it’s for performance and scalability it’s a very popular choice in Enterprise environment so this is where you actually go into Data Centers and high performance 64-bit file systems um that’s for Speed and scalability so it’s used in Enterprise environments meaning handling a lot of users most likely or scenarios where High data throughput throughput is critical um it was originally developed by silicon Graphics so it’s become a popular choice in Linux dros like Cent OS and red hat Enterprise Linux which are the Enterprise uh choices for Linux right so this is scalable this is the big the notable factor or the notable characteristics of xfs is that it’s fast and it’s scalable so that you can have a large environment with a lot of users or a lot of computers uh that use its data so high data throughput means that it use it provides data access to data it processes data very quickly compared to the xt4 right so this is designed for big environments the key features is that it has efficient metadata man management so uh handling metadata heavy workloads which is basically for uh requesting or requiring frequent file creation deletion or renaming and this doesn’t seem like a big deal but when you have a thousand users that’s kind of a big deal right so a lot of users going to be creating data renaming data points or re renaming files creating files deleting files and that process by itself just needs to be done quickly when you have a lot of users journaling a very similar concept you’re going to be hearing about this a lot it’s done a lot in uh the all of the different file systems that you’re going to be dealing with more often than not are going to have journaling just in case there’s some kind of a crash and you don’t want to lose data uh it is scalable so and lot large file systems making it suitable for system handling large data sets and high performance workloads which means if you have a lot of employees if you have a lot of lot of computers or servers it’s a really really good file system for that and of course it can resize file systems without requiring them to be unmounted providing flexibility in storage management which is again something that’s very important in data servers or in data centers so that they can uh work with the data without unmounting it and for somebody stopping the use of it you know what I mean so you need to be able to uh allow your employees and your users to still access that data so you don’t unmount the data and you can still allocate various uh uh dynamic or do Dynamic allocation which is essentially the name um that can help you just resize the file system so resize the potential allocation of that specific file system for this one computer or for this data center to make sure that yada yada yada I I feel like you get it I don’t want to kind of regurgitate and repeat myself over and over um but it’s allows for live environment allocation and changes to be made so that the users can still use the system and uh you can do what you need to do as the admin administrator the typical use cases for this are going to be of course Enterprise servers data centers um environments that have a lot of input output performance and scalability requests such as databases media servers scientific Computing etc etc so a big environment that requires a lot of processing power and high performance application so uh large files that need to be accessed and managed efficiently like video production or big data analytics these are some of the environments that re require xfs or make use of xfs and these are some of the example commands to create one so make file system make F mkfs do xfs and then you give it the mount Point pseudo xfs grow FSS grow FS excuse me pseudo xfs grfs and then the actual Mount Point itself so resizing requires the file system to be mounted and it supported only for increasing the size so just keep that in mind so you can’t decrease the size um you can increase the size of the file system by using grow FS grow the file system and then check the repair file system so xfs repair and then give it the mount point so this these are just some of the example commands for using and interacting with xfs and of course we have the swap file system so swap space uh it’s the dedicated partition or file that’s used to extend the memory as we’ve already discussed um it’s Unique compared to the everything else that we talked because it’s not a TR additional file system it’s actually uh used for live data right so it’s an extension to supplement the physical memory of which is our Ram our random access memory so it’s not storing files or storing data it’s just a live type of uh swap space or file system technically um it allows the system to avoid out of memory issues we’ve already gone through all of this so U memory overflow management is used when the system memory RAM is fully utilized we talked about this hibernation support we talked about this um the partitioning versus the swap file is kind of a concept that I guess uh should be noted here a swap partition versus a swap file so a swap was created as a separate partition so a swap partition uh it was created as a separate partition which could offer performance advantages due to the dedicated space on the dis the swap file which is inside of a lot of modern systems uh they use the file inside of a partition itself because it’s more flexible and it can be resized or removed quickly without having to deal with all of the partitioning commands so previously the swap partition was something that you have to actually have to create that specific partition using Fisk or uh you know any of these parted these various types of tools whereas if you’re dealing with a swap file you can resize the file remove the file do anything without actually having to mount unmount and deal with the the process that’s done through partitioning so uh more common systems are going to have a swap file and the kind of the older Legacy systems are going to have swap partitions the size recommendations for your swap file or your swap partition um it really has to do with the the Ram size itself so if there is not that much RAM typically available um then the system would benefit from more swap space so Twice The Ram size that that would really I don’t exactly know what is technically considered to be not that much RAM um if you have ample uh RAM so let’s say more than 8 GB if you have more than 8 GB of RAM then you don’t need that much swap space so for example you can get get away with having 2 GB of swap space and in some cases not at all if the memory is itself is actually really really powerful so if you have really really good Ram you probably don’t need a swap file or swap space um so so ju it just depends on the physical size of the ram itself now again unless it’s a really old business with very little uh RAM or like a really old computer you’re not going to run across a situation where the server doesn’t have enough RAM that’s just I I feel like uh this is a bit redundant but it is something of note so it is something that you should just keep in mind because you may deal with like a legacy computer or an old computer and they may not have that much RAM or maybe they’re expanding and the computer itself doesn’t have that much physical RAM and so you need to deal with uh some kind of a swap space or a swap file to uh to cater to the the massive size of the company or the as the company expands and continues to grow uh so that they don’t crash and until they can uh upgrade their systems and buy better Ram or you know bigger computer so on and so forth so these are some of our example commands for uh creating and activating a swap partition so uh you make the swap space first and then you turn it on so make swap that would be the swap space swap on you turn it on uh create and activate a swap file is a little bit more so the fall allocate or F allocate um one 2 gab or excuse me this would be an L it’s not a one so this would be 2 GB to the actual swap file which is would be the name of the swap file or the path to the swap file and then you need to change the permissions so to actually give it permissions and usually it’s uh the type of permissions that the system itself requires or root user requires and then you create the swap space so make the swap space and then give it the swap file path and then that then you enable it so first you have to allocate something for that swap file then give it the permissions that it needs and then make that as the swap space and and turn it on so that that specific swap file can be used and if you want to just look at the usage or see how it’s working so you can do swap on show or free- and those will give you the swap usage data points that you would need all right so now we’re going to talk about the various commands uh that will allow us to do everything that we just talked about so Fisk is one of the more common ones uh it’s a command line utility that’s used to create modify and delete partitions on a dis and it’s commonly used for managing the master boot Rec record or the MBR which is the traditional partition that allows you to have four primary partitions but it can also handle the GPT which is the guid partition table that can allow you to have more primary partitions so Fisk is the most commonly used right it’s a command line utility and you can create modify and delete partitions on a disk uh the key functions would be things like and this is in no way meant to be the full list of commands that you can run uh if you just do man MN Fisk then you’ll get the full list of what you can do with f disk so this is not something that’s supposed to be all-inclusive um but this you know these are some of the common ones so uh pseudo Fisk L would list all the available partitions and the basic disinformation about them uh interactive mode so if you run f disk as well as the name of the partition so this would be the path to the partition so you would need to replace that with the actual Target dis it opens an interactive mode where users can add delete or edit partitions inside of it so this could be a a interactive version of running f disk instead of just running individual commands to do what you want to do and after you’ve done all of your uh commands or modifications in interactive mode you would type w and press enter and that writes the all of the changes that you just made to the very the specific dis that that you are associated with so you would create a new Partition using the N option in f disk you would select that partition type or or choose a partition type that you want so for example xt4 and then assign the size that you would want and then you press W to press the changes this is this is like a overview we’re going to do this uh in detail when we actually go into the command line portion of this whole thing but you can also get a lot of different uh breakdowns of this if you just go to to uh gemini or if you go to GPT or anything like that and ask it to BL you through creating a partition and going through the various options of what would what it would be like to to mount it and delete it so on and so forth but we will go through those examples as well and then we have parted so it’s a more versatile command line tool than Fisk because it supports uh obviously supports the MBR and the GPT schemes um it’s ideal for resizing copying and modifying partitions without losing any type of data so it’s kind of a more recent version of it you will probably run across both of these and the command line structure of them is relatively similar and they have for the most part uh allow you to do uh the same things you just need to be familiar with the fact that both of them exist there is an interactive mode so very similar to f disk you would just do the same similar type of command except now you just do pseudo parted and you get into interactive mode you can create delete resar partitions with commands like like MK parts for make part RM to remove and then resize part very very like intuitive I think that’s one of the big things about it and then when you get to the GP uh GPD partitioning table um when using large drives which are mass so 2 terabytes in today’s world is actually a very large Drive part it is often preferred because it natively supports GPT uh which is used for a file system that is uh that requires more than for or primary partitions right so the the smaller file systems or the smaller storage discs use the previous one the MBR and then gpts for the file systems and the diss that are definitely going over two terabytes because they’re considered to be much larger especially when you’re not even dealing with media and you’re just dealing with text documents and uh configuration files and logs and things like that 2 terabytes is a lot of space so um parted ends up being being the Premier Choice the the first choice for that and example command to create a new Partition would be to just use parted uh this would be the disc or the physical location that you want it to be stored on you are making a partition so MK part and then you’re making a primary partition with the xt4 format and you want it to be a th000 megabytes in this particular case would ends up being a gigabyte So you you’re creating a gigabyte size primary partition with the xt4 format on the specified dis which would be at this particular location and then you can just run dis utility or a variety of different command line tools to figure out what partitions you actually have mounted onto your device and then from there you would choose that specific path for it as your creating your new partitions or extensions or logical partitions so on and so forth and then we have GP parted uh which is stands for The Gnome partition editor and it’s basically the graphical front end for parted and it’s available for a lot of Linux distributions that actually have a GU a graphical user interface if it’s just a command line uh Linux then it doesn’t exist but most of the desktop versions and anything that actually has a graphic user interface there is a g-p parted um version of parted a available for you and you can do everything that you would do with parted using an intuitive graphical interface so it’s very user friendly it provides a visual representation of partitions and unallocated space allows for easy resizing creating and deleting leading of partitions and it’s ideal for users who prefer graphic over command line management and need a quick way to modify partitions so pretty much does everything that part it does with a graphic interface since you’re not going to be using the command line you basically just need to know how to install this thing and so you would do pseudo apt install gparted and we’re going to go through apt which is a package manager and that’s for deban Ubuntu and then you can do pseudo dnf install gparted for Fedora um and then you just run it pseudo gparted to open the graphical interface uh so the launch and the installation is actually done on the command line but the rest of the stuff will be done through the graphical interface so you just need to know how to run these things um to install them and to start it and then from there you can go ahead and use the graphic interface okay so now we need to list the block devices right so we’ve created the devices and now we need to display the information about those devices including the Diss and the partitions to those Diss and you want it to be user friendly or close to user friendly so it does it in a tree format which you’ve already seen so um list lsblk will list the block devices it’s a great way to get a quick overview of storage devices on the system and the key features is that it has a higher article display so it’s the tree structure that we referred to earlier they’re showing you the relationship between the actual main device and its various partitions and it puts the information like the device name size type and mount points so the essential info you’re not going to get a lot of crazy details from this so but this is a very common tool to use to just see what all the block devices are essentially meaning what all the physical devices are and what the partitions are that are attached to them and it’s done in a nice tree format and these are some of the example commands so lsblk displays a simple tree view of all the devices uh using the dasf includes the file system information like file system type and uuid D and then- D shows only the main devices excluding any of the partitions if you have a very large environment you don’t want to see all the partitions you just want to see the main devices this will show you just those main devices using the DD flag or option and then we have DF which is disk free that basically reports what is uh being used or what is free so it gives you the the free space uh for each of the mounted file systems as well as what’s the the u space on it um but it’s one of those things that if you wanted to see just specific data about the file system dis space usage you would use disk free um it displays total and available space for each file system um dfh to display sizes in megabytes and gigabytes making the information more readable and then uh dftt will show the type of each of the file systems along with the usage stats that you have so this is for DF and then these are just some of the example commands so H again lists all the stuff H home will show show you the dis usage only for the home directory and again all of these things you can find the specific options that you can run by going through the manual page for each one of these tools we’re just going through sample commands and then when we actually get to the Practical version of this where we start using the command line and going through everything we’re going to go through a lot of this stuff in depth so this is I’m just going kind of like a quick overview of this so you can get some familiar I with it and then we’ll go into the great details later du is for disk usage and it’s used to check the space usage for specific files and directories providing a detailed view of which directories consume the most space so it’s not a file system thing uh it runs when you run du with the- SH uh on a specific directory it provides a summary of its total size when you run du by itself it shows dis usage for each directory and the subdirectory and then du and then the threshold of 100 m for megabytes displays only files directories that have over a 100 megabytes of space that they’re taking the command examples would be sh on this particular path would give you the total size of the ver log directory itself the ah home provides a detailed recursive view of the home usage and listing of the individual files and the directories which can be massive so this this you don’t want to do on a uh you don’t want to do on a super large uh directory because the the output could be massive so uh if anything you would uh take the output of this command and you would uh pipe it or export it into a separate file so that you can look at it outside of your terminal um because it really can be a a lot of data if you’re going to list all of the files and directories so it it can just be a really a big output so just keep that portion in mind most of this this specific thing you don’t want to run just on the terminal just to look at it because the termal doesn’t output everything it’s like it’s limited to how much data it can actually show you on the display even if you scroll all the way up you may not see everything all right now we can run through our package managers and the various commands that are associated with them so the intro to package managers um package managers are tools for managing software on Linux so it’s like a tool for managing other tools to help you install tools and to help you update tools so on and so forth they up uh they automat the process of installing updating removing software and it makes it relatively easy or if you know what you’re doing and if you are very familiar with the command line it makes it easier to maintain a consistent and upto-date system they handle dependencies uh meaning the the stuff that the software requires to run right so each software may require a certain number of dependencies for it to run so the the appt manager or the package manager excuse me the package manager will will handle those dependencies to make sure that any required libraries that you need and the tools are installed alongside whatever the software is that you are installing So when you say you know pseudo AP install such and such it won’t just install the tool it’ll install all of the dependencies and the libraries that that tool needs to run properly and then it saves you a lot of manual dependency resolution and potential conflict so you don’t have to go hunt down all the different dependencies cuz it can get very very tedious especially if it’s a piece of software that requires a lot of different elements and adjacent tools for it to run properly you don’t have to go hunt those things down manually you just run this one command and that one command gets all the dependencies that you need the libraries so on and so forth so very very useful um we have a which is the most common that I’ve used because I usually use ubun and Debian versions of Linux and it stands for the advanced package tool it’s very very common so if you want want to install something you do pseudo a install the name of the package if you want to update something pseudo AP update and pseudo AP upgrade you can technically run those both at the same time that’s what the double Amper Sands go into that we kind of talked about uh actually I don’t think we’ve covered operators yet I was just doing a a Linux tutorial Linux fundamentals tutorial so we haven’t gone through the operators yet but when you do two Amper signs right here that means you’re running both of these commands uh s multaneously so it’s going to run this one first and then it’s going to run that one next so it’s going to update the list of the softwares as well as the software itself and then it’ll upgrade anything that it needs to and if you want to remove something sudo ipt remove and then you give it the package name so very very intuitive and most of the package managers are actually similar to this um AP or apt is known for its ease of use the robustness and extensive repository of software packages and again it’s the most commonly used because it’s associated with Ubuntu and davan which is which are the the desktop versions of Linux and very very user friendly as you can tell the the commands themselves are super intuitive as well so very user friendly we have yum which is the yellow dog yellow dog updater modified or dnf which is the dandified version of yum um and this is for Red Hat uh so Cent Os or Fedora uh these are the distributions that would use yum but it’s it’s pretty similar to what we did with apt right so it’s like pseudo yum install name of the package or pseudo dnf install name of the package update or update it’s pretty much the same so you just use yum instead of Apt or you would use dnf instead of yum or whatever it is depending on what uh version of Linux you’re running and typically if you try to do like pseudo appt install such and such the the terminal will actually tell you oh this is not what is used on this system we use yum on this system or we use dnf on this system and it’ll give you an updated command to run so it’ll say yeah this doesn’t run here instead run pseudo yup pseudo yum install the package name so that’s it’s very also very very intuitive and very user friendly yam has been replaced by dnf in the newer dros like Fedora so dnf offers improved performance better dependency resolution and modern design um but essentially they kind of operate on the same uh distributions of Linux and then finally we have Pac-Man this is my favorite name uh it’s the package manager and it’s used for Arch Linux and Pac-Man’s uh commands are a little bit different than what we’ve seen with apt or yum so pseudo Pac-Man DS and then the package name is the installation pseudo uh Pacman Dash and this this is capital S by the way and then capital S Yu would be the software updates and then capital r package name would be the removal of the software itself so uh it’s known for the Simplicity speed and flexibility which is uh a common uh or a favorite among RS Linux users and handles binary packages and Source packages with ease so uh all the other ones do too in my opinion um or in my experience I guess I should say but this is something that is specific to the ARs linic distribution so you need to be aware of it so the name Pac-Man is not the video game it’s a package manager and it’s for Arch Linux and these are the the commands for the installation update and removal of software using Pac-Man and finally for this section we have the updating removal or troubleshooting of packages so updating packages and system upgrades um the reason why we want to do this is a few fold so the first one is security obviously so there are patches that need to be applied to certain packages as the vulnerabilities are discovered so when you’re considering the approach for ethical hacking and pentesting the reason why they do those things is because they want to try to break the package so that they can find what of the vulnerabilities are sometimes vulnerability scanners don’t do their jobs and sometimes there’s an announcement that’s made that hey we found this vulnerability you need to go patch this specific uh package that you’re using so uh this is not uncommon this happens very frequently and running an update on your package manager should be a a habitual thing that you do maybe even daily every time that you log into your Linux or every time that you’re about to install something or every time that you’re about to use a specific piece of software or specific package anytime you’re about to use that thing just run update real quick and just make sure that it’s the most recent version of that that includes all of the patches for it um then there’s also security features that are that come with those updated versions of those packages and then of course the dependency updates as well so if there’s new dependencies that are required to run the updated version that’s something that you may need and these are just some of the common things that fall under the bracket of security and then you have stability so there are bugs that are associated with these softwares or these packages so just make sure that that’s all updated I mean these are so common sense that I I feel like I don’t even need to go through this you just need to understand that updating packages and the system itself whatever you’re running needs to be a regular thing you need to check for system updates and package updates regularly to make sure that compatibility is there performance is there there are no bugs that are running there’s no security issues and the functionality is all great the user experience is great and of course if you’re in a regulated environment you need to be compliant so if there’s something that has to do with customer data and it’s not updated and then there’s a leak of the data because there was a security vulnerability you are now in grounds for a lawsuit or the company is in grounds for a lawsuit and guess what you as the Linux ad administrator are going to be fired because this is something that’s so simple that can so easily be done and it’s so powerful so it’s like just keep all of your packages up to date it keep your system up to date it’s not complicated to do runs a couple of commands and it’s very very useful and of course compliant to the regulatory environment that you may actually be in now the these are some of the update commands the upgrade commands so you do pseudo appt upgrade and it updates all of the installed packages that you have on your particular system that runs AP and then pseudo dnf upgrade runs all of the uh updates for the packages that you have installed on the NF system so if if you don’t want to upgrade the package individually as you’re about to run it you can just run this daily upgrade with a or dnf or Pacman or whatever it is and just make sure that everything on on your system in your environment is fully upgraded I would say removing and cleaning up the packages is probably just as important as running uh the updates on the packages the main reason for this is to free up space uh there’s also something called The Orphan package or unused dep dependencies that uh you just don’t use them anymore and they’re taking up storage space so this is probably something that is also as as important to run as the up updates of everything to just make sure that if there’s something orphaned meaning that it’s uh outdated and there’s a newer version of it if you run an upgrade on something you should also run the auto remove to remove whatever that’s been orphaned and a lot of times you will also get a notice from the system some kind of an alert that says hey are you sure you want to remove this this one’s associated with this and then you can either say yes or no but for the most part it’ll just take it will get rid of the things that are either orphant or legac or grandfather so on and so forth or unused so this is as important of a strategy as the upgrade and the update of all of your packages and thankfully troubleshooting the package issues is not something that you would have to do super uh in granular detail as well you just need to run a certain series of commands so if you have a locked database for example so if there’s a locked package manager in a Debian based uh system which is Ubuntu for example it means that another package management process is running or it didn’t terminate correctly so what you want to do is you want to remove that specific locked front end so pseudo RM removes the lock file and this is the location of the lock file so this is the file that’s used to lock that package database while the AP is running and then sudo RM removes that specific file this is the the full path to that file right so this is how you unlock lock a locked database for example and you’ll get that notification again your terminal will tell you that hey this can’t work because this is happening or this didn’t terminate correctly and then you can go ahead and just run the pseudo RM pseudo remove and it’ll work for you and then you have broken dependencies so if something is no longer current or it’s outdated or it’s missing a piece or uh a dependency for whatever reason wasn’t patched properly so if it’s not installed right any of those things the the version is outdated or it’s not the correct version any kind of conflict that would fall under a broken dependency you can do uh a fixed broken command so pseudo apt D- fix broken and then install so it tells app to uh fix broken dependencies by automatically installing or removing packages that are necessary and then dnf check will check for dependency issues and report them and then you can use dnf drro sync to synchronized installed packages to the versions in their repositories to make sure that all the dependency issues are resolved so again this is what’s really awesome about these package managers you don’t have to do the manual hunting of oh my God I got to go fix this I got a lot of these things are automated so you just run a command and it’ll just automatically install or remove packages that are necessary it’s like it’s so freaking useful but you just need to know that you can do this right and then you need to know what the command is so uh by the end of this whole thing you’re going to have a dictionary of commands that you can run to take care of a variety of different things which is just I think it’s super freaking useful so um there we go this the broken dependencies and then we have repository issues so repositories can be unavailable or misconfigured causing issues with the package management to resolve this you might need to reenable or update your repository resources and uh those things can be done using the various resources lists or uh the locations that are on the sources list so uh app sources list or the app sources list. D both of those are very useful on the debbas system so you can view the sources list in those regards and just see if it needs to be updated or the sources or the links or something might not be right um and then one of those one of the most powerful tools for that is just copy the contents of it and then take it to gemini or GPT and paste it and say hey does this look is something wrong with this and it’ll tell you if something’s missing or if something’s wrong um and then Red Hat systems check the repository file in the Etsy yum repos directory and that you can just make sure that all the sources for your repos are all good however if you don’t want to do all of that if you don’t want to go to GPT or whatever you can just run these commands right because they’re automated and they can just make sure everything is all good so if you run uh for AP you can run apt update for dnf you could run a make cache or dnf update date for yum you could make a cache or do a yum update info and then Pac-Man you can do this as well and essentially they’ll just make sure that the URLs and your repository files are correct and accessible and they’ll make sure that everything on your sources list is up to date and current so again you don’t need to do a lot of these things you don’t have to do manually because these amazing package managers will automate a lot of that processes for you and just make sure your sources are up to date make sure all the dependencies are up to date make sure the versions are current and if there’s any bugs or anything that’s been patched all the security vulnerabilities all of that stuff is taken care of by running regular updates and regular removals as well so make sure that the removals and the updates are being done in tandem to get rid of anything that might be orphaned or uh out of date and to make sure that everything that needs to be updated is updated to uh make sure that everything is all good you got to update the package list and basically this is literally these are the commands that would do all of that stuff for you as well but sometimes you might need to just restart the system or you might need to restart your shell um or just really just running the update command I think is actually all good um but just restarting the shell sometimes can uh do wonders if those update commands aren’t making everything run properly and then if that fails you can just restart the system um and then it just guarantees that everything is updated and current as as well as your package lists themselves all right now that you have Linux installed hopefully uh you took some time to actually install either your own version on a USB so you can Boot It live or you have it installed on your computer where you uh booted it as your operating system um or you’re using a virtual machine or you’ve used uh tryck me’s virtual machines that are all Linux based or you have a Linux computer whatever it is so hopefully now you’re in an environment where you can actually run these commands now if you have a Mac OS uh for the most part you can run most of these commands as well um if you don’t have them you may need to install them using one of the package managers and uh get access to them but uh in either case uh I would say do it in a Linux environment uh if you can download Cali Linux or a version of Ubuntu whatever it may be so that you have no problems and you can be sure you can rest assured that you can run all of the commands that are coming up um what we’re going to do is we’re going to go as an overview because we’re technically still in the lecture portion of this uh training series and I’m just going to show you what these commands are I’m going to tell you what they do and the purposes that they serve and then when we get to the second La the second portion of this whole thing where we actually get to the Practical exercises you will get plenty of chances to run all of these commands and will run all of these commands in an actual live environment while you’re you see me run the commands and we’ll look at the the output that comes from the commands and we’ll combine a variety of these different things um what we’re going to be talking about is just the basics of the command line and the basics of scripting so that you have an idea of what it all looks like and the the syntax and the general structure of all of this stuff and then we’ll go into the other chapters that we have and then when we come back at chapter 12 we’ll actually run all of the commands as well so that’s essentially where we at right now um the isial command line tools and navigation is what we’re going to look at all of these commands will yield some kind of information about the system that you’re logged into so who am I uh gets you the current logged in username by the way all of these things are case sensitive so if you do who am I with a capital W it’s not going to work who am I gets you the current logged in username uname displays all the detailed information about the Linux machine that you’re on including the hardware installation the name of the Linux uh the version of it the OS kernel version so on and so forth and then there are various options that come along with uname as well so this is just uname by itself there are other options or flags that you can attach to uname to get different results but uname is typically about the detailed information about the machine the hardware the name and the OS kernel then you have the host name which gives you the VPS name the VPS host name and other related info so depending on what flag you run with it it’ll get you different print information about that individual host so with no option it it just prints the host name uh with the if flag so Dash lowercase i it checks the server’s IP address- lowercase a prints the host name Alias uppercase a gets the system’s fully qualified domain name which is also known as the fqdn there is a difference between the who Ami and the host name so the who am I is just the user so whoever you are as the user you can be multiple users on the same host and that host would be on the same machine so the there could be multiple users logged in but they would be on the same host machine technically and then the same thing with the the hardware and the Linux machine and so on and so forth so who am I specific to the actual user that’s logged in un name is specific to the hardware of the machine the name the OS kernels stuff like that and then the host name is relevant to the actual host itself that you’re logged in on which is typically that machine um as well as the IP address the host name Alias if there is a host name Alias and the fully qualified domain name as well another way to look at the username and the host name is that the username is assigned to a specific user on a computer network while the host name is a label that’s assigned to the device on the network essentially identifying the computer itself rather than the individual user so there would be an IP address assigned to a the MAAC address and so on and so forth that would be assigned that would come under the host name data versus the username that comes under that individual person so the username is the login name while the host name is the name of the computer on the network and that’s not to be confused with the AME so the host name would be the name of the computer the username is the name of the user and then the uname just brings various data points about the computer itself for example the hardware and the the OS version so on and so forth all right on to navigation so navigating the actual computer itself so the first thing that I always run is PWD that prints the working directory meaning the directory that you’re currently logged in or the directory that you’re currently accessing it prints that path for you um CD changes the directory so if you do CD home user documents you’re changing the directory to the home user documents and you’re going to end up inside of the documents directory documents folder and then when you run PWD while you’re inside of the folder what’s going to happen is that you’re going to get this full path so it’s going to print that full path of wherever you’re logged in on onto your screen and that will say that is your printing of the working directory and then once in you’re inside of that directory you can list the contents of the directory which would be with ls and LS typically just by itself would just list whatever is visible it’s not a hidden file specifically what happens is that when you do LS L it’ll print the detailed view of all of those specific files and then when you do LSA it shows the hidden files and then you can combine these two flags and you can say LS L A so instead of doing- a or- l you could just do-la and it’ll give you the detailed view of everything as well as show you all of the hidden files as well so print working directory change the directory and list the contents of Any Given directory and then there’s the interaction with individual files and directories uh namely creating files and directories copying files and directories moving files and directories and these are what these commands are for so Touch by itself if you just create want to create any kind of a file you can do touch and then the name of the file which would be this specific thing if you want it to be inside of Any Given directory you can give it a full path but typically you would be inside the directories let’s say the documents folder and you just say touch file. text and it’ll create file. text for you and then there’s if there are any options that you want to attach to it you can attach those as well we’ll get into all of those things uh in a little bit when we actually get to the Practical section but touch is designed to create a new empty file in any given directory even the directory that you’re in or the directory that you give the full path to make dur which we would we make directory it creates one or multiple directories if you want it to and very similar it’s mkd and then any options that you wanted to give it and then the name of the directory one or directory 2 and that again could be the full path to the directory or you could be inside any given folder and then you create a new directory and basically what it does is it creates a folder that can house files whereas Touch by itself creates a file so you can’t expect the the file that’s been created by touch to be a container for any other files cuz it won’t be it’ll just be a file so make directory creates a folder that you can house a variety of other folders or you can house a variety of other files inside of it CP is copying so it can copy a file or a directory and then when it copies the directory it’ll also copy everything that is inside of that folder and so you would do CP and then you would provide the source which is the the thing that you want to copy and then you would provide the destination which could be the location of where you want it to go to and if it’s going to be inside of the same folder that you’re in you would copy the same the whatever the file is that you want to copy and then you just need to give it a name so that it won’t be the same exact name so if I want to copy file I would need to have as my destination file to be would be the second uh argument that we Supply to this command and it can still be inside of the same directory that we’re in it’ll be inside the same folder that we’re in or we can just say that I want you to take take whatever the file is inside of my current directory and I want you to copy it and move it to this whole other location and then you would give that full path to it and move would be another one of those tools that you can use but instead of uh copying it actually just takes that original file and it’ll transfer it out of wherever it’s sitting and move it to a different location you can also use it for uh renaming something so if I say move file one I would give the new location and it will transfer file one to that location or I can just say move whatever the old name is and rename it to change it to the new name and it it won’t copy anything it won’t do anything like that it will just rename the file for you so it can either move the file from wherever it’s sitting and transfer it somewhere completely different without copying it so just keep that in mind if you move it you’re not duplicating it you’re transferring the exact file itself or you can just rename the file RM would remove the file so that would be the command that you can delete an entire file or you can delete uh the directory that includes everything that’s inside of that directory so if you do rm- R it’ll actually delete the directory and everything that’s inside of it and it’s very similar to doing rmd so it removes the directory and everything that’s inside of that directory so you can do uh removal of the directory using the dasr uh flag that goes with it or you can just do remove dur and then remove everything that’s inside that directory as well as the directory itself so just keep that in mind that when you remove a directory you’re also removing everything that is housed inside of it so if you need it you need to make copies of it or you need to move whatever is inside of it to a different thing so that you can delete that directory file gets you the file type of whatever the name is that you give it so you say file either the path to the file or whatever the name of the file is inside your current folder and in that regard it’ll say okay this is a text file or it’ll say it’s a python file or it’ll be a CSV file comma separated value file so on and so forth it gives you the file type and believe it or not this is actually very useful especially when you get into scripting because there are certain interactions that you can’t have with certain file types so you need to know what type of file that you’re dealing with and if the file type is the file type that you want to interact with you would then use the series of commands that could potentially interact with that file so getting a file type is actually very important especially when you get into scripting and then zip would compress the file so it basically just creates a zip file for you from one or more files or a directory uh that you assign so you can say zip and then choose whatever option that you want and then you would take the file name and then uh that you want to create so this will be the zip file name that you want to create and then this will be the file that want to be added to it the next file that’s going to be added to it you can have a series of files but essentially you would zip this would be the name of the zip file the name of the zip folder and then these would be the files or the folders that would actually be compressed into that one zip file that one ZIP compressed folder unzip extracts the data or the the contents of that individual zip folder so very it’s a pretty simple concept to understand so again if you choose any specific uh uh options you can do that um and then you just give it the zip file name that you want it to unzip typically it would unzip in inside of whatever location that it’s already in so you just want to make sure that uh wherever you are unzipping it you want those contents of those files because uh sometimes a zipped file will have a bunch of content in it and when you do unzip it uh if you wanted to move to somewhere else you would have to move all of those things manually uh by doing the the MV command so if you want to unzip it in any given directory a specific location that you want all of that content to be first you move move the zip file to that location and then you unzip it um a tar or tar command itself it bundles multiple files and directories into an archive but it doesn’t compress them so you just run tar the tar file name wherever the location is going to be and then the files themselves they don’t get compressed typically it’s good for archiving and creating archives um so that you can interact with them without having to unzip them because when you zip something it gets compressed and then you would have to unzip it to be able to interact with it tar just bundles it multiples files into one location known as an archive and then you can interact with the contents of that without having to decompress it or uh unzip it so to speak these are some of the key operators that you need to keep in mind and this is actually very important because you need to be using this very very frequently so the first one I’m just going to call this the greater than symbol or pointing forward I guess we can call it whatever it is um the greater than or pointing forward adds the outputs of any command to an output file so for example example if I do Echo file contents just by itself it’ll just print file contents onto the screen but if I do Echo file contents and I push it into the new file then it takes this whatever is inside of this or whatever is inside of Any Given command really and it puts that inside of this file then this overwrites anything that is currently inside of the file so you need to be careful with that because if you want to append something if you want to add data to Any Given file you would use the double uh greater than symbols instead of a singular one because the singular one literally overwrites everything inside of that file and you lose whatever else was previously inside of the file so more often than not what you’re going to do is you’re going to take a given command so you’re going to run some kind of a command that will analyze something we do this a lot in security where we would run a uh let’s say a top command or we would run um TCP dump or something like this we would run some of these commands and instead of getting the contents uh displayed onto the screen because it’s going to be a lot of content we would output the content inside of this file so that we can review it later and manipulate the content of it um when you’re appending something you would add whatever those contents are to a new file and for scripting this is very very important to understand because more often than not when you write a script you don’t want that script to overwrite everything that would be inside of your folder or inside of your uh the output file you wanted to add every time that you run that script you want it to add the contents to the output file instead of overwriting everything that’s inside of that file so this one overwrites everything and creates a new file or it’ll just create a new file for you um then this one appends it it adds the output to the file and you keep everything that was previously inside of that file there is the and so ampers and uh you place this at the end of Any Given command uh especially if it’s a big command that takes a long time to process so that it backgrounds the command for you and then when it’s backgrounded you can still continue to use your uh CLI your command line um instead of having to wait for that command to finish so for example if we were to run uh something that’s big like this and then we were going to Output the results of it to a file but we had to wait for the command to finish we would just put an erson at the end of this command and then it would run it would do whatever it needs to do it’s going to create our output file for us and then we can continue to run whatever other commands that we wanted to run while that previous command was completing um this specific one right here where you have a double ERS sand it combines multiple commands and then gives you uh one overall input so you can do uh touch new file so you create a new file and Echo onto the screen that there was a new file that was created and Echo the contents of the file into the new file that we just created right here right so technically you’re running three commands you’re creating a file then you’re notifying that the file was created and then you’re adding whatever contents you want to that file so this is very useful especially if you actually know what you’re doing and you want to get a lot done and not have to do multiple commands uh and then just press enter wait for it press enter wait for it instead of doing that you can just combine a series of commands and then that way with one pressing of the enter button you run the whole thing and then if you have notifications in between each one of the steps you will get all of those notifications and you’ll be uh you’ll know exactly where you are in the process and then it’ll be done real quick so uh Ampersand by itself you put it at the end of a command and then you run that command in the background when you do this when you double up the ERS hand you can combine a variety of different commands and you can string together uh really as many commands as you want um if it gets to the point that you have to run a bunch of commands and you’re trying to combine a bunch of commands at that point you might as well create a script which we’re going to get into in a little bit so uh so far these are the key operators that we got once you’ve created files or if you have a bunch of files that you’re trying to view there are a few few different ways that you can do this when you do cat it concatenates that’s what it stands for it concatenates the the contents of that file and it just prints everything onto the terminal um if it’s a massive file there’s going to be a very large output and sometimes the terminal limit the amount of lines that’s output and you may miss uh all of the contents at the very very top of the file if it’s a really large file typically that happens usually with log files so if you have a very large log file then instead of doing cat and displaying everything on the terminal you can either do less and more to view large files Page by page so you do less and then the name of the file name and then you can uh click your uh the arrow buttons on your keyboard and then you would go onto the next page and on the next page head and tail will display either the starting or ending 10 lines and then you can also just uh display however many lines that you want so if you do tail n 10 it’ll display the last 10 lines of this file if you do tail N5 it’ll display the last five lines of this given file so this is also very useful if you’re trying to if you know that a certain amount of data like if you want all of the headers for example of the file you will look at the top 10 lines and then if you want the most recent data which is typically what’s going to be at the bottom of Any Given log file you want the last 10 lines or the last five lines whatever it is so you can look at the most recent data instead of having to scroll back and forth to try to find it and then there’s find so find itself is actually very very useful if you know kind of what you’re looking for you just don’t know where it is right so for example it would be find and then if you do the p it could be just forward slash that represents the root which means that all of the folders inside of the root you want to search basically in the entire machine so you want to search inside of the root which would be the path or you could say you know uh the documents for example so you can give the path to the documents and you say look inside of the documents and look for a let’s say if I do Dash name which means that I want you to find something by its name and and then you give it the name that you wanted to look for we’re going to do a lot of this because this is actually very useful um and locate of the file uh is essentially the same thing and it prints this location onto the screen so locate uh keyword and sometimes depending on where you’re at uh what type of machine that you’re on locate may not give you results fine may give you the results or fine won’t give you the results locate will give you the results they essentially do the same thing um so that’s kind of what it is for find usually you need to actually give it the path that you want it to search for locate just looks for it and then says this is where the path is so you can locate and then find whatever the path is uh for whatever keyword that you’re looking for find itself you would need to give it a location for it to search and then it’ll go look for whatever the the name is or if you’re looking for a file type or a permission uh so on and so forth it’ll display all of those things for you and then we have our common text editors so Nano and Vim are the most common text editors that are available on Linux uh Nano is very very user friendly Vim is also userfriendly in my opinion it’s just not as uh straightforward to deal with um so for example if you do Nano file.txt it’ll open up file.txt if you don’t have something called file.txt it’ll actually create file.txt so it’s very similar to using the touch command um but what happens is that you can now uh write inside of that file so if I do Nano file.txt there’s nothing inside of the file I can start writing inside of the file if there is something inside of the file and I do Nano I open it up and now I can interact with the content inside of that file so I can look at everything uh scroll back and forth if it’s a massive file instead of doing cat and then printing it onto my display I can just do Nano and just open it and scroll through it as I wish and then once I’m done I can if I want to save any changes that I I’ve made you do control o we’re again we’re going to go through all of this stuff so this these are just overviews you do control o to save it and then control X to exit um contrl K could be cut the line contrl W would be to locate something so it be where is something and you can look for certain text there’s a lot of options that comes with it those are just some of the common ones but Nano is the text editor and Vim is the other one that I mean it says it has a steep learning curve but in my opinion it doesn’t um it can be uh open just to read something it can be open to insert something it can be uh Visual and it can go in Fairly dep uh deep uh options that it has and uh there’s a lot of help uh manuals for all of these things as well so uh you’re not going to be left to the Wolves as so to speak just to kind of go through this stuff and uh I would be to enter insert mode so it would be vim and then I to go into insert mode um once you’re inside of vim and you’re done with everything you can do colon W to write or to save colon Q to quit colon WQ to save and quit Etc um and you can search for an any given pattern uh to delete a line you would do DD these are just common options this is not uh anything that you’re supposed to memorize right now because again we’re just going to go through the interactions but these are the text editors that you should be aware of so that once we go into it we don’t have to just do an overview of hey this is a text editor and this is what it does so on and so forth when we go to the Practical section we’re just going to start using these tools and it’ll be it’ll just kind of uh reinforce all of the data that we’re covering right now all right now we’re going to go into another level of dealing with files um and manipulating them and searching through them so grep is another one of these tools that you’re going to use very very frequently because it’s very powerful and it searches for stuff so uh it stands for Global regular expression print so you don’t have to know that you just know that grep search just for things um you can search for text within files so typically it’s like you’re searching for uh any given pattern or a word or you can even do actual regular expressions and then you give it the location that you wanted to search within so if you wanted to be case insensitive you would do- I so that it can just look for whatever without having to worry about capital letters or lowercase letters if you do R it’ll be a recursive search inside of a directory so if you do uh if instead of having a right here if you give it to something to search for inside of a directory it can actually do that and it can search for whatever that is um V would be to invert the mat so it shows uh lines that don’t match the pattern so if you want to show something let’s say that there’s a lot of noise and it all has to do with a certain event ID so if you want to show everything other than that event ID you would do V and it would show everything that doesn’t match that event ID so will show everything other than that event ID so grip is a very useful tool and typically you can also do a combination of commands where you pipe the output of another command into GP so that it’ll search for you so for example you can do cat and then concatenate something and then use grep to search through the data of that file typic that’s kind of just a very very simple example but you can do that a lot um sort will arrange the contents in a specific order so you can actually combine grip with sort so you can grip for something and if you know there’s going to be a lot of data you can then sort that data to be output onto the screen into a any given order so for example uh to sort alphabetically from A to Z you just do sort by itself if you want to reverse the order so do Z to A you could do sort dasr and then uh the file name or the contents of grep right so you can just do grep Etc and then sort d r and it’ll show everything Z to A if you do sort by itself it’ll just do uh A to Z or ascending order we can call it ascending order and then you can have descending order as well you can also sort files numerically using the N flag so that could be potentially if you’re sorting files specifically that could be potentially what you can do uh you can uh sort output numerically as well uh and then you can reverse the order of that using the- R so it’s very flexible there’s a lot of different ways that you can do uh interact with it um you can then use cut to take certain pieces of data so certain columns let’s say from that given file so you do GP it searches for the data it and you want to take instead of getting every line that comes out of that uh result you want just the First Column or the first two columns so you would do that and then you provide whatever the options are and then you cut that data from the results for yourself so there’s something called said that that is the stream editor so data streams are just another way to look at um text that is inside of a file and sometimes uh when you’re looking at certain types of text uh it may not be plain text it may be formatted in any type of uh display or format so it may not necessarily just be plain text the way that you’re seeing inside of the screen it could be Bas 64 formatting or encoding that should that’s probably the better word so it could be encoded in some way and you want to just display C certain things that you know that will might necessarily match into something um so what you can do is you can uh edit it for the output right so set stream editor uh will take the first instance of old so let’s say it finds something that is called Old for example and then it’ll replace it with new so the the first one is the actual data that it’s found and then the next one is what it’s going to be replaced with and then it’s going to do that for every line that it actually finds this specific pattern in so if it finds old inside of every whatever line it finds it’ll replace it with new for that line if you want to edit it if you want to actually transform that inside of whatever the file is you can actually do that using the if flag so it’ll take the it’ll still find the thing that you want it to find but it’ll do an in place editing it’ll actually edit the contents of it within the file for you um you may not necessarily want to do that maybe you just want to search for it and display the results so that one should be used uh cautiously but uh this is what the stream editor does for us if we want to extract data so the these are things that actually have Fields so typically like a a CSV file for example or something that has a field that has a value uh inside of it uh this is the type of data that you would use a for awk um and the usage is to take essentially the First Column so this is what this is right here so it would print the First Column right here of this file which is what I mean when I say field-based and usually CSV files are like that CSV files are separated by commas which turn into a spreadsheet for example so when you use something that has those types of fields you can extract the data of that uh and in this particular case it’s going to take the very first column and then print all of the data that’s in inside of that First Column from file.txt um if you have a condition that you want it to print for you so if the the third column is greater than 50 for example you wanted to print everything from one to three right so or not from one to three it would be columns one and three so column one for example would be the name of the field or the name of that specific line item and then column three would be the value that so associated with that col line item so if the value inside of column 3 is greater than 50 I want you to print the name of that thing and then whatever the value is and that’s what that does for you so you can actually give it conditional examples and this is almost like writing a script actually it is basically a script it’s like a conditional statement right so if the value of column 3 is greater than 50 I want you to print that data onto my screen and this is the perfect segue to get into shells scripting so setting up a simple shell script uh we’ve kind of already talked about this so I’m not going to spend too much time over here so first and foremost you want to create the script so you can do touch script.sh that would be a basic command to create your script and then add a shebang line which we’ve already talked about at the very very top so the very first line of that script.sh file is going to be uh the shebang line which is this piece right here so we just call shebang right so that’s the shebang line and you have to put that at the top of every single script in order for the script to actually run as a script otherwise it’s just going to be a file with a bunch of lines of supposed code but there is no interpreter this is what The Interpreter would be there is no interpreter so that it won’t be executed as a script now once you have that file and you have your code and everything in it you need to make it executable and that’s done through the changing of the permissions so chod which we’re going to visit later when we get into permissions stands for change mode and then when you do plus anything you’re adding that permission to it so in this case we’re adding X which is the executable permission and we’re adding it to script.sh so change mode add executable permission to the script and that’s the general outline of how that uh permission change does now if you want to remove executable permission you would do minus X and then it removes executable permission from whatever that file is and that’s that’s basically how permission adding and removal works so fairly simple now once you have it so let’s say you want to create a bunch of variables inside of your script the first variable in this particular case would be the name equals Linux GPT and then when you want to refer to this variable so that would be the the variable name it equals so this is called an assigning operator where assign assigning this value to it if you use two equal signs it’s a comparative operator and we’ll talk about that in a little bit but typically when you not typically every single time when you use a singular equal sign you’re assigning a value of something to this specific variable so in this case we’re assigning this string Linux GPT is now assigned to this variable which is name then you refer to this variable with dollar sign name so if I ever use Echo dollar sign name it’ll print Linux GPT onto the screen or inside of whatever it needs to do because we have now assigned this string to this value very simple um you can also substitute the variable by assigning an actual command to it now in order to do that you would need to do dollar sign and then put the command inside of parenthesis but the way that this works is that if I just typed date onto my terminal it’ll give me the date and time that we’re in right now but I want to store that value of this command inside of this variable so I can do date equals and then I do a dollar sign and put that command inside of the uh the parentheses and now I’ve assigned the value of this command to this specific variable you could do name equals uname for example and it’ll give us all of the data that is assigned to that machine and it stores all all of that data inside of this variable that we have over here so you can assign text or strings uh to the variable or you can assign the contents of another command to the variable it’s called assigning variables both of them are technically an assignment because you’re using a singular equal sign and then you’re just choosing the type of value that you want to assign to that variable once you have your variable you can then create your conditional statement if you want to use a conditional statement so a conditional statement is it’s very basic right so if something do something else don’t do something or do something else and then you have to add fee at the end well I consider it to be finish just like short for finish but I think it’s just a backward version of if and that’s how the scripting in Shell Works in uh in Shell the shell language um I don’t know if it’s a language actually I think it’s a language but whatever um when we’re looking at this specific uh the conditional statement right here we can see that if and then inside of our brackets we have our first condition so we say if the variable whatever that variable is equals value so now look we’re looking at a double equal sign so now it’s comparative right before when you use the singular uh single equal sign you were assigning the value but now you’re comparing so you’re saying if the value of this variable equals to the value that we’re looking for and then you do a semicolon you say then I want you to print onto the screen the condition has been met notice that there’s an indentation here typically there’s at least either two spaces or four spaces uh for user friendliness or reader friendliness I recommend you always use four spaces um so if the variable equals the value that we’re looking for then I want you to print onto the screen that the condition has has been met if it hasn’t been met that’s what else means else just prints that the condition has not been met that’s it and then finish and that’s the full basic structure if any of these things are missing so for example if the semicolon is missing this is not going to work this entire conditional statement is not going to work if this fee at the end the FI at the end is missing this is not going to work and usually you’ll get some kind of a notification that there is a error online such and such and something is missing or the syntax is wrong so on and so forth so you’ll be able to debug your code accordingly but it’s very important that you understand that everything in this piece of in this block of code has to be here if this parenthe not parenthesis if this quotation mark at the end is missing you’re going to get an error if uh this specific equal sign is missing then it’s going to say well this is also a logic error because you’re trying to assign a variable to this value when it already has been assigned something else and now you’re trying to reassign it like that doesn’t make sense so there every piece of this needs to actually work here if this dollar sign is missing it’s not going to work so a lot of these things you you got to be very specific with scripting is very specific once all the details are there it’s going to work like a charm but if the details are not there you’re going to have a lot of issues so this is just a basic structure of a conditional statement and these are some of the comparative operators the comparison operators that we’re looking at so right here we’re looking at equals to the value but right here you could say okay if it’s less than the value that we want or greater than the value that we want uh or if it’s less than or equal to so L would be less than or equal to or greater than or equal to the value that we want or equal to the value that we want or not equal to value that we want all of these operators that you’re looking at right here have to do with num numbers okay so if you’re going to use any of these things you’re using integers or you’re using numbers as the value operation or the value comparison excuse me the ones down here have to do with strings so a double equal sign is comparing the value of a string so if you can see right here we actually have a string as our value so we’re using a double equal sign so if we say if this equals I want you to do da in this case W equal equals uh equal a double equal means that you are looking for the actual uh comparison to be made so if this does equal to this uh if you do a exclamation equal means that it does not equal to that there’s too many equals that I’m talking about I’m almost I’m losing myself in this explanation but I think you get what I mean so if you have two equal signs that means it does equal to whatever the value is if you have an exclamation equal sign it means it does not equal to what whatever the value is and then this is where a lot of automation stuff comes in so this is actually really this is like it’s very basic what we’re looking at on the screen right now but this is the foundation of automating tasks so for something in a list I want you to do something right so in this case it would say for item in 1 two 3 I want you to Echo that item so what it would do in this case is it would print one two and 3 1 2 3 so per line it would say this value this value and this value and it would print that onto our screen for us right so for item and this could essentially be anything so it could be for I in one two3 do Echo dollar sign I so this name is another one of those variables that has been assigned in this particular Loop it doesn’t necessarily have to be exactly this in a lot of cases is it could just be a single letter or it could be any word really it could be for value in one two 3 Echo value right so for the whatever this is for this inside of this list and this could be a variable that has that stores a massive list in inside of it in this particular case we don’t have a massive list stored we just have the simple list you would do your semicolon because you have to separate this piece and then you say for this condition I want you to do this action right here and then when you’re done that’s it you’re done so this has to be here in order for this block of code to be complete it’s kind of similar to what we do in Python except in Python we don’t have done and we don’t say do or something like that we just say for what whatever I don’t want to I don’t want to confuse you but this is a for Loop and this can iterate over a list the list could be a completely separate variable that houses a bunch of data or it could be a variable that is reading from a separate file and then you’re going through the contents of that file there’s a lot of stuff that you can do with for Loops this is a very very simple for Loop but for Loops are the essence of Automation and this is one of the most powerful things that you will learn when we actually get into scripting and creating some Advanced scripting this is one of the most powerful things that you’re going to learn is creating complex for loops and inside of a for Loop you can have an IFL state statement inside of a for Loop you can have another for Loop and there’s a lot of different great things about it and as long as you have your indentation correctly then everything should run smoothly so keep in mind that the indentation is very important in order for a for Loop to work you have the header which is this piece right here and then you have the body which is this piece right here and the same thing applies to our IFL statement this is our header of the if statement then you have the body of the if statement then you have the else which is another header and then you have the body of the else portion and then you have the finish at the very end so the indentation is very important to keep that in mind especially as we go into the the writing of the scripting you’ll notice how those things work and then so there’s a for Loop and then there’s a while loop now a while loop runs as long as the condition itself is true so while loop has a condition that it needs to be met so for examp example we have counter equals 1 that’s our variable okay so the counter equals 1 now we’re saying while the variable counter is less than or equal to 5 then I want you to Echo counter and then counter in this particular case inside of the while loop so remember there’s this ination so inside of the while loop now we have a new counter variable but what we’re doing now is we’re assigning that previous variable + one so for every time that this iterates what it’s going to do is it’s going to print the first time that it iterates it’s going to print one onto the screen then for the next line it’s going to iterate again or actually excuse me it’s going to print one onto the screen and then it’s going to add one to this variable which would then equal two right so then it’s going to Loop through this again and it’s going to say okay it’s still less than or equal to five so I’m going to Echo that onto the screen but now the value is two so then it’s going to add one to that new value which will make it three and then it’s going to go okay yes it is still less than or equal to five and then it’s going to print that onto the screen and then it’s going to keep going until it hits five so once this condition at the top right here is now saying oh it is equal to five now so if it is equal to five then you’re done right so that’s it because that at that point the condition is no longer true the condition becomes false right because once that’s done once it’s equal to five it’s going to go over here and then it’s going to add one to it so it’ll become six and then when it goes up here and it says hey is this equal to five it’s like no no no it’s not less than or equal to five now it’s six so I’m done I don’t I I’m not going to do this anymore so this is a while loop so it’ll keep running as long as the condition itself is true and in this case our condition is if this variable is less than or equal to 5 then just print it onto the screen once you’ve done printing it then I want you to add one to that value right here and then on the second iteration and then the third and then the fourth and then after that it should be at five and that’s it that’s when it’s done because the fifth iteration it’ll actually turn into six and then it’s done it’s no longer true so the condition has been met and the condition is now false and it can’t continue so that’s what while Loops are and that’s how while loops work all right now that you know how the system works and how the file system works and how to create files manipulate files and do all of that stuff with the actual system it is now time to move on to the users and the actual human beings that are going to be using the system and this is where a lot of the roles a lot of the responsibilities for uh being a system administrator actually comes in right because you have to deal more than just dealing with the system itself which is fairly simple to do especially once you understand how to find the guides and the manuals and so on and so forth now you have to learn how to deal with the people and manage the users and the groups that they are in so first and foremost creating users depending on the distribution that you’re on uh it’ll be one of these two commands so it’ll either be user add or add user and it requires pseudo permissions so uh basically administrator permissions or uh maybe root permissions even um it just you run the command and then you have the username at the end of it and that is basically it that’s literally how you add a new user now this is very simplistic typically there’s going to be multiple options that you would run along with your user ad command just to kind of handle certain things alog together um but you can also run them after the fact so you can just do pseudo username ad or user ad and then the actual name of the person and then first you would set up a password for them and I’ll show you specifically what that is um and that also requires pseudo permissions as well um then you would need to assign a home directory to them uh the default home directory if you just do user ad-h uh M if you just have the- m flag and then you do username what it’ll do is that if the person’s name is Alice it’ll add their home directory to home Alice which is typical of uh where the home directories of all the users are based on what we’ve already learned about the file system now if you want to declare a specific directory for that username then what you would do is you would add- M and then you would do- D and then you would have to declare where you want that uh usernames home directory to be and in this case it’ll be data users Alice and that’ll be the directory of their home and then from there this would be the username itself that we’re going to add so you’re adding a user and then you’re declaring where you want their home directory to be by assigning these two flags as well as the path and then this is the name of the user that’s being added um you can specify the login shell for that user so again you’re adding a new user and then you do-s and then you say that this is their login shell which is the typical login shell location for the binaries and then that would be the username itself that’s being added and then supplementary groups and we’re going to deal with group management in a little bit as well and we’re going to do all of these things by the way when we get to the practical portion I feel like I just have to keep saying that cuz this is just more of an overview and I know I’m glossing over a lot of these things but it’s mainly because the fact that we’re going to do a lot of the Practical exercises so um pseudo user ad and then you have a capital G right here and the developers would be one group and then admins would be another group and then Alice gets added to those supplementary groups so these are just some basic commands to add user details now this is a full command that you’re looking at over here right so we’re going to do Pudo user ad and then we’re going to assign a directory for this person which is going to be this place this is their home directory we’re going to assign their uh shell which is going to be at this specific location we’re going to add them to a supplementary Group which is going to be developers and admins and then we’re going to add a comment so Dash C right here is just a basic comment for this particular user who’s going to be Alex Johnson developer and then the final piece right here is the actual username itself so M creates the home directory D sets the custom home directory – s would be their uh zh uh zsh at the login shell D capital G developers and admins adds them to developers and admins and then- C is just a comment uh at the very end just to say that this is who it is and this is mostly for the system administrator that’s going to be looking at this and then finally Alice the actual username of the person and this one long command but it does a lot of things when you’re creating that user and then if you wanted to uh add their password right so typically what you do is you assign a password once you create somebody and then you have to immediately expire the password so that the next time that they log in which would be the first time they officially log in they get notification that your password has expired and you need to set up a new password so you create the user you set up a password by doing pseudo pass WD and then the username and then there’s going to be certain prompts that are going to come in so they’re going to be like yeah what do you want their password to be and then uh confirm the password and then you do this specific piece right here to expire the password that you just assigned to that person and then from there the next time that they log in they’re going to be prompted to actually set up a new password themselves so this is the the very gist the very basic gist of creating a new user now some of our basic commands for managing user so if you want to modify an existing user details with user mod that’s typically how it would work so if you wanted to change their username for example you would do DL this would be the new username and then this is the old username that’s being changed if you wanted to lock an account or unlock an account it would be with the capital L and it would lock that account and then capital u to unlock that account and there’s a variety of user modification commands that we’ll be working with once we get to the Practical section and then there’s also the user delete portion and uh the dasr right here would be a cleanup of everything so deleting the user and you’re also removing their home directory and all of the contents of that user and their directory so uh these are just basic uh user management so to speak commands that you’re going to be implementing when we get to the Practical section and then we have creating and managing groups creating and managing groups is as simple as using the group AD command and then just specifying the group name you can also uh add a user to a group using the um AG so a stands for append and then G stands for the group itself and then you can just add them to a single group or multiple group so this would be outside of the user ad uh version of adding somebody to a group so when you do user mod you would need to do the lowercase a uppercase G to be able to add them to whatever the group is and this would be a supplementary group that you’re adding them too and then of course you can just do group Dell to delete somebody or to excuse me to delete the group that you have specified so the group name that would be what you would be deleting in this particular case um understanding difference between primary and supplementary groups is very important so a primary group is the main group that’s associated for that user um when they create a file and if they create any kind of file or folder the group ownership permission of that file is set to whatever the user’s primary group is now by default every time you create a user there’s going to be a new group that’s created by their name so if it’s Alice as the user there’s going to be a new group named Alice that’s going to be created inside of your group’s directory and that’s going to be the primary group that’s been assigned to that person so when you want to change their primary group you would use the user mod command and then you would do a lowercase G and then the name of the group itself so whatever it could be one of your existing groups it doesn’t have to be a new group that you’ve created but you’re changing the primary group of that person by doing a lowercase G flag and then assigning the group name and then the username themselves and then now you’ve changed their primary group a supplementary group is additional groups that they have access to so you know based on who they are and what permissions they have or what roles they have they could have multiple groups that they’re assigned to so they can get access to the resources that are available to all of those individual groups uh so that’s mainly the big piece that you want um and multi memberships can happen in a lot of cases in a lot of cases they do happen so for example just a a manager for example a manager will have access to the management group as well as the regular employee group for example so that they have access to all of the stuff that’s inside the manager folder as well as everything that’s inside of their own regular folder or along the other groups folder so there could be a manager they could be in marketing and they could have their own regular folder as well you know what I’m saying so they have multiple groups that they’re a part of it’s very useful for granting uh people access to different sets of files and directories owned by various groups you just have to be careful that whenever they leave that department so if they’re no longer in marketing they need to be removed from marketing unless they’ve gone up a level and they do still get access to the Marketing Group but if they’ve left Marketing in general completely and they went into Tech they shouldn’t get access to the stuff that’s inside of the marketing folder and this is mainly because that you want to protect the company from uh potential uh you know if the person Le Lees for example and there is a bunch of intellectual property that’s inside the marketing file or marketing folder and now they have access to all of the stuff inside of marketing and they can steal that IP for example that’s just an example so uh it could also protect the company from any security issues if that person gets hacked and they still had access to marketing for example and now they the hacker knows that they’re a part of that group and they go inside of the marketing folder and they see all of that IP and then they can steal that data because a system administrator didn’t remove them from that group and they should have never had access to that data to begin with so this is very important to keep in mind you can have multiple groups that somebody could be a member of you just need to be careful as you go along and as the company grows and as people’s roles change that you uh modify the groups that they’re members of because as long as they’re a member of that group they have access to everything that’s inside of that group um you can add or remove somebody from a supplementary Group by using the a G so lowercase a capital G and appending them to the specific group or groups that you want them to be added to so very similar to what we did previously uh by using user mod and then lowercase a capital G and then you start assigning the various groups that you want them to be added to and speaking of permissions and ownership and all that stuff access we are now in that particular section so file permissions overview um permissions model is a very fundamental component a very concept of managing access to files and directories uh it makes sure that only authorized users can read write or execute files or delete files or modify files so on and so forth maintaining the system security and integrity um there are permission models that are involved in three levels of access so there’s the owner of the file or folder or the asset or the whatever it may be there’s the group permission level and then there’s others so it’s basically everybody other than these people so it could be guests for example um so there is the owner of the file or folder there’s the group that they are assigned to which would be the primary group as we’ve already discussed their primary group is would be the group that it’s assigned to and then any everybody else that falls inside of others the owner is typically the user who created the file or the folder they have the highest level of control over their files and directories and they can set permissions to read write or execute the file or directory even if they are not a root user specifically so if example.txt is owned by the user Alice she can control who else can access and modify that file the group is associated with a specific group who are members of this group can be given certain permissions on the fileer directory so whatever the group permissions are the group permissions determine what groups uh what group members can do with that specific file or directory like the owner group members can have readwrite or execute permissions or whatever the permissions are that have been assigned to that specific group so if example text is associated with the group developers all the users and developers can be given permissions to read write or execute the file depending on the permissions available for that group specifically okay so keep that in mind because you can modify the permissions of the group and it may not necessarily be read write and execute all the files right and then you have others so it could be all the users who are neither owner nor members of that specific group so it could be everybody outside of Developers group or everybody who’s not the actual owner uh somebody that’s a guest for example so there’s a lot of different people that could be that could fall under the category of others so as long as they’re not the owner or they’re not inside of that primary group that’s been associated with that file then they all fall into the others category um determined uh the permissions for these people determine what any other user can do with the file it can also be set to read write or execute or it could be read or it could be uh execute or it could be none of the above right so they could have no permission to access it just depends on what the the company infrastructure is like so if example text has read permissions for others any user on the system that can actually read the file regardless of the user or group status so a very uh common file that is limited to a bunch of people that or all the people that falls into others would be the Etsy uh Shadow file the etsc shadow file has the password hashes of all of the users that is inside of that environment so even if somebody is not necessarily the root owner even if somebody is not necessarily inside of the administrator’s group and they’re in marketing for example that that means they fall in the others category and they should not be able to read that file so that’s very important to understand there are some files that even if people who are not guests and they’re actually senior Executives of the company or something there is a number of people a large number of people that should not have access to the Etsy Shadow file because it has all of the password hashes for every user that exists on that system so it’s very important to keep that in mind now the way that permissions are designed they go by read write and execute and they have acronyms for them so R would be for read W would be for write and then X would be to execute so read means you can view the contents of the file or the directory uh write means you can modify or delete the file or the directory and execute or X means that you can actually run the program or the script or access that specific directory so rwx so keep these in mind okay this is typically what it looks like and I would say that this is not typically what it looks like this is just this particular example but this is what it looks like when you look at the permissions of a given file or directory the first character which is represented by this Dash right here indicates the type of file that it is so if it’s a dash it would be a regular file if it’s a d that means it’s a directory okay so this is representing the very first character which is this Dash right here so in this case we’re looking at a file if this was a d then this would be a directory now the next three characters represent the owner’s permission so in this case RW and then we have a dash right here and if it was X that means it’s also executable right so this would be rwx representing the owner’s permission read write execute in this case the owner can read and WR write there is no execution so it’s probably not an executable file right it’s just read write and then that’s it and these are all of the permissions for the actual user that created the owner that created this particular file would be this this and this right here okay and then we have the next three characters that represent the group’s permissions in this particular case um in this example they’re saying r2x but in this case it’s just r d d so the group group can only read the contents of this particular file they can’t write to it and there’s no executable permission so there’s no execution that they can do on this particular file either and then the last three represent the others permissions which also in this case are read and then no writing or modifying and then no executing so this is what it looks like so the very very first one is either it’s a file or it’s a directory so a file or a folder so if it’s a regular hyphen a dash it means it’s a file if there was a d here that was mean that this was a directory the next three characters represent the owner’s permission the next three characters represent the group permission and then the last three characters represent every single other person and this is what the outline what the frame uh the template I should say the template of permissions are when you’re viewing the permissions of a file now let’s say you want to change the permissions of Any Given file or folder so we’ve already kind of touched on this so in this particular case we’re going to do CH mod so change mode and when you do plus X which is what we talked about in the very earlier example plus X adds executable permissions but what you’re doing in this case you’ve specified that you want a u which is the user so you want the user to have executable permissions to that file whatever the file name is right so CH mod changes the mode plus X which is a symbolic method of changing we can also talk about numeric methods which we’re going to do right now um but so we’re giving the user executable permissions to that file name which allows execute permission for that user now octal values would be a completely different thing so 755 so 7 represents the maximum permission so seven is read write and execute for the user five would be read and execute for the group as well as read and execute for everybody else so the value of these things breaks down if you had all of the permissions rewrite and execute you would have all permissions for that individual group so this is actually what the numeric value looks like to have read permissions you would be getting a value of four to have write permissions you’d get a value of two and to have execute permissions you would get a value of one so if there is read write and execute the value would be seven if you can only read the value would be four so if there was 744 that means the user could do read write and execute the group can only read and everybody else can only read right if it’s zero then that means they have no permissions okay so 740 means that the others group has no permission the user that created it the owner has rewrite an execute and then the group has uh just read permission right so that’s this is the the breakdown of what the values actually the numeric values of these things look like read equals to four write equals to two and execute equals to one and then when you have the breakdown like this over here then what that means is that the three numbers that are represented on the screen so CH mod 755 the seven is representing the owner the seven represents the owner the five represents the group and then the five right here represents everybody else so these three numbers represent uh the the modificate the uh overall owner group and others categories if it was 777 that means the owner the group and everybody else also has readwrite and execute permissions so just keep that in mind there’s the numeric value value of this the numeric method of modifying permissions and then there’s the symbolic method of modifying permissions along with changing uh permissions we can also talk about changing ownership and you can have ch own and and then CH grp which I’m sure you can imagine what these things mean so CH own stands for change ownership and chgrp CH stands for change group uh these are also pseudo commands so change ownership of the user to this particular group and then the file name as well so you’re changing the ownership of the user and the group for the file name so this is the example right here we have change group so change group of the group name to the file name that’s what we’re looking at so in the particular case that uh we have seen in the first line you’re changing the ownership of the the file name right here to this particular user and the group in this case we’re changing the group for this file name to whatever the group name is okay so just keep this in mind so these is how you change the ownership of the file name and it would be the user inside of this group and then you change the group of this file name by assigning it to this actual group grou so fair fairly simple it’s like fairly intuitive as far as the commands are concerned but you can and again just keep this in mind so once the file name has been assigned to this particular group that means now all of the permissions that are inside of this group are now applied to this file name and anybody who is inside of this group has all of those permissions on this particular file this is what’s very important to understand okay when you change the owner then you’re changing all of the permissions of this owner to this file name so if they have the permission and typically it’s everything they have all the permissions or whatever the main permissions are so you change all of the permissions of that owner to this file name if you’re changing the group of this file name everybody inside of this group has access to that file name and they have the permissions for that group over this file name so just keep this in mind it’s very important and then we have special permissions so suid sgid and the sticky bit so um when the Su ID when the set user ID when that permission is set that file will execute with the Privileges of the owner not the user that’s running it so this is very important to understand if the owner has administrator privileges and the set user ID the Su ID has been set on that file if the user so the user is not the owner right so whoever the user is when they run that file when they if it’s a script for example when they run that thing they’re running with the permissions of whoever the owner was that was created it it’s very simple and it’s it’s very uh powerful to understand okay you are setting the execution privileges of that file to be the execution privileges of the owner and not the user the user could be lower privilege the owner could be an admin and if the user is running it they are running it with the Privileges of the admin which is the owner so if you want to change an add that specific specific permission to the file you would do the change mode chod and then you add on the user level the S permission right here which is the suid and then you give the path to whatever the file or directory is so this is very much for things that are executable that everybody else should be able to uh access meaning a binary so a binary for example the password binary inside of the user bin so this is for the user binary not the the binary of the entire system so just keep that in mind so this is the users’s binary for their password allows regular users to change their password securely that’s what this specific binary allows them to do because we already established that the password binary allows somebody to change somebody’s password so if the user wants to be able to change their own password they should have the permission to be able to do that so this is what this does and this is the case that it would apply to and you just got to be you got to keep in mind that this is a security issue okay so if this is a system binary and this is again something that we’ve done a lot in pentesting we search for files by the permission that is set so if they have suid permission on that given binary or on that given folder we’re going to try to go ahead and access that folder and drop some kind of a exploit in there a payload in there so that we can run that payload Lo by the permissions of the administrator for example and so if we if that directory has admin privileges and we have a shell that we want to execute and we want to switch oursel to the admin privileges we can then run everything that’s inside that directory because it has the S permission set and then now we’re running it with the admin privilege which means we can execute as an admin and then give oursel access to that system as an administrator so this is very important to understand okay that may have been a little bit confusing that last piece may have been confusing but what you need to really understand is that suid will execute the Privileges of the owner not the user that’s running it so the user could have no permissions to do anything but the suid has been set on that file or folder and now they can run it as that owner right just keep that in mind SG ID is very similar except it applies to the group so it executes with the permissions of the files group and not necessarily the person that’s running it so for directories files that are created inside of that specific uh directory are going to run with the parent directories group so whoever the group is that owns that particular directory any file that’s dropped inside of that directory will run with the permissions of that specific group so if you want to change and add this specific feature for permission for any kind of a directory this would be it you would do G Plus s and that’s it and this is a CH mod that is done with pseudo by the way this is not something that typically would be done by everybody so a a lower level user should not be able to add the special permissions to these things uh this should only be something that’s allowed to be done by somebody who has administrator or root privileges so that we know that it’s the right person that’s making these changes so and everybody should not be able to make uh the special permission or modify the special permissions on files it should only be reserved for root administrators and domain administrators so on and so forth and then there’s something called the sticky bit so when you set a sticky bit on a directory only the file owner or directory owner can delete or modify the files within it regardless of the group or other right permissions or anything else right so only the owner of that file or directory can delete or modify it nobody else can do it this is called a sticky bit and so you do chod plus T you’re adding the sticky bit so just T you’re adding that to whatever the path of the directory or file is uh this is commonly used in shared directories like the temp folder so the the file owner or the directory owner can delete or modify the files within the temp folder regardless or of the group or other right permissions that may be assigned to that temp folder right so only the owner of the temp folder or the owner of the temp directory can delete or modify the files within that directory doesn’t matter who else is trying to do it uh doesn’t matter what other group or WR permissions exist only the owner can delete or modify the files within that directory so this is something else to keep in mind because this is also a security issue so if there’s a sticky bit that’s been assigned to something it’s also something to keep in mind and it’s typically something that you do uh to make more SEC like make the environment a little bit more secure so this is opposite of the the special permissions where it technically makes it less secure if something has the special permission attached to it any user can run it with the owner’s uh permissions or with the owner’s privileges whereas the scky bit only allows the owner of that file or directory to be able to modify meaning change or write to any of those files or delete any of the files inside of that directory which brings us finally to our user authentication and pseudo permissions portion so user authentication we’ve already touched on this particular file already so the Etsy password file stores all of the user names so the user accounts themselves there is no uh password doc uh hashes or any PL text or anything like that that’s inside of this file the name is kind of misleading and I think it’s been designed to be misleading each line in this file corresponds to a single user account and contains several Fields separated by colons and those fields all stand for something so all of the users the usern names are stored inside of the Etsy password file now this is an example of a uh a specific entry so you have Alice then there’s a colon and there’s an X and this is typically where the password hash would be and then you have colon and then an ID and another ID and then uh the name right here separated by a few commas and then another colon and then we have their home folder and then we have another colon and then we have their bash path so the username Alice would be the user’s login name so this is what their login name is the password placeholder which in this if we once we actually go into the shadow file and you’ll see this is a very large hash value that’s right here um the user ID would be this piece right here uh so unique numerical identifier for whatever their user ID is the group ID would be the primary group ID that’s associated for them which is in this case their actual personal group that was created when the user was created geckos um this is the optional user information like their full name office number Etc so this is this is the comment for example this is where the comment piece would fall which is everything that’s inside of this specific uh uh separated by these two com um what I’m having a brain fart the colons the inside of these two colons this is called the geckos which is the comments essentially so user information full name office number Etc and then we have their home directory which is the path to the users’s home directory and then we have their shell the default shell that’s been assigned for this user and this is what a typical entry inside of the Etsy password file looks like then there’s the Etsy Shadow file so the Etsy Shadow file has everything else that we just talked about except now it actually has the password hashes so the encrypted password information and other details related to the password management of that person this is more secure than Etsy password so a lot of people can actually access the Etsy password file because it doesn’t have the password hash in it the Etsy Shadow file cannot be accessed by anybody other than somebody who’s the root user or on the suit’s list so it’s very important in this particular case it’s saying it’s readable only by the root user which means that only the root user can access the Etsy Shadow file because it has the encrypted password hashes of all of the users now what we can see here is the same thing so we have Alice there’s the colon and then you see all of this data right here and all of this and you see there’s these this um this uh my gosh this ellipses that’s right here because this specific hash value was actually massive um it took multiple lines I think it took two lines so it was a very very large hash value but we can see that it’s been separated by these two colons right here so everything inside of this including the dollar sign and the six and the rounds and then including this forward slash at the very very end all of this was the hash value of Alice’s password and then there’s 18661 and then there’s 0 9999 7 and then the last three colons at the end so we have the user us name which is Alice the password hash which we already talked about uh this field contains the hash including details about the hashing algorithm and any salt that’s been used and typically the very uh beginning portion right here the dollar sign six and dollar sign this typically is the hashing algorithm and based on uh just what the breakdown is of the it could be shot 256 or whatever it is that’s typically what is determined at the very beginning right here and then the last password change so this is what 18661 looks like which the date of the last password change represented as the number of days since January 1st of 1970 so 1, 18661 uh 1,00 or excuse me 18,6 161 days gosh 18,6 61 days since January 1st of 1970 that this particular uh password was changed that’s been how many days it’s been changed so so you have to actually count forward from January 1st 1970 and come 18,6 61 days forward until you understand what date it was that the password was changed and then the minimum password age in this case is zero meaning the number of days required between password changes so this particular case there is no minimum age that’s required of this so uh it can essentially last as long as possible um and you can change this and this would be the number of days so if it’s 30 after 30 days it would have to be changed my bad excuse me so yeah the minimum password age meaning that they are not required to change their password um they can or they’re not required to wait any number of days to change their password so they could change their password immediately that’s what the minimum password age means they can change their password every day if they wanted to the 99999 this thing right here means that they have 99,999 days until they are required to change their password next time so this would most likely need to be set to let’s say 90 so that you can have the user change their password every 3 months for security purposes so this is a very important field as well so the zero is kind of understandable so you don’t want you know they can change their password any day that they want they can change their password daily if they wanted to but this piece right here is a security issue so nine 999,000 days almost 100,000 days they they are given almost 100,000 days before they’re required by the system to change their password again and that’s very very important to understand as a security issue you want to change that to make it 90 days for example or 120 days or something like that so that there is a definitive limit on how long they can go with the same password and it would be required to change their password and then there’s the password warning period so we already talked about the 99999 uh the password warning period which is represented by the seven this time is the number of days before password expires that the user is warned to change it now in this particular case it would be 99992 so it’s still too long right so they need to have uh let’s say still 90 days and then on day 83 they would be notified that hey in 7 days you need to change your password the password inactivity period in this particular case is represented by this uh colon that’s separated by these two other colons the number of days after password expires during which the account is still usable and in this case there is none so if the password is expired that means they have to change their password in order for them to use their account again and then they have the another one colon right here the date when the account so actually I was uh incorrect so the very next colon is what we’re talking about for the inactivity period the second colon is the date when the account will be disabled represented as the number of days since January 1970 which has not been assigned here either and the final colon is reserved for future uses so these last three colons especially this particular one so the password inactivity would be the number of days after a password expires during the account still usable which in this case is none so as soon as it expires they have to change their password the account expiration date there is none because as long as they’re in the system as long as they’re an employee as long as it’s your computer and you haven’t deleted your username for example that’s not going to change and then you have the reserve field that’s been reserved for future uses for a variety of other reasons and so that is the full uh explanation of a line inside of the Etsy Shadow file so as we’ve already discussed the Etsy password file it can be world uh World readable meaning that everybody essentially can read it but the password placeholder should be X meaning that it would be less sensitive so that that is potentially something that you can do if you wanted to do it like that um I still think that the password file should not be uh World readable because lower privileged users should not get access to all of the usernames inside of that system because we have gone through a variety of pen testing exercises that we found a variety of different users and then we did Brute Force exercises to be able to find the passwords for a variety of different users and then kind of did uh lateral movements and then eventually had vertical movements until we got higher privileges so this should in my opinion should not be World readable but it can be World readable um so that as long as the password hash has been uh replaced by this x then technically it should be fine the Etsy Shadow file however should only be readable by the root user because of the fact that it has the encrypted password hashes and that is a very very strict um file that only the root user or root users just in case you’re working in a company and one person is out sick or uh you want to have redundancy you have a a s just a handful of people who work in it who are the highest level of management that have root user uh permissions that can go ahead and access the data that is inside of this thing and the thing is you don’t need to give everybody root permission because not everybody needs to see these password hashes anyways because you can just reset somebody’s password very easily without having access to their password hashes so that’s the that’s the piece where it’s like okay it is understandable that they say that only the singular root user is the person that has access to the Etsy Shadow file because somebody could just be an IT administrator beyond the suit’s list and they have permission to reset somebody’s password if they’ve been locked out or expired so on and so forth so um these are the major security considerations to think about when you’re looking at these two specific files uh in particular so managing pseudo permissions uh granting the ability to users to execute commands with root privileges via pseudo is a critical aspect of system administration because you want to have redundancies with your administrators you don’t want everything to rely on one person this involves adding people to the pseudo group configuring the pseudo file and applying command restrictions for fine-tuned Access Control so when somebody’s in the pseudo file essentially they can run pseudo command and they can do really basically what any root user would be able to do they may not be the root user but they could be in the pseudo Group which means that they have those administrator privileges those higher level Privileges and the pudor file is really the highest level of privilege that somebody can get because they can modify and manipulate a lot of different things inside of the system adding users to the pseudor group is as simple as doing pseudo user mod add to group and then the group pseudo and then the username that you want to add to that group so it’s very very simple to do except this is a very very powerful command the command that you see in front of you is a very powerful command that somebody can run and now whoever this person is right here they have the key to the kingdom so to speak so um basic pseudo permission adding you just use the user mod add to the group pseudo and then give the username and this is just a breakdown of how that command works so user mod AG pseudo and then the username and you already know what all of this means and how these things break down so that’s how you add somebody to the pseudo group The pseudo group and this is an example so we’re just adding Alice to the to the pseudo group so this one’s kind of redundant but uh now you’ve seen this in multiple regards so you can see how you can add somebody to the pseudo group or really again any group right so if we just replace pseudo with whatever the group name is we’re adding Alice to that group so this is how we do the fine-tuning This Is How We Do the controlling of what people can do inside of the pseudo group so the pseudo configuration file is located as the Etsy pseudo location and it controls pseudo permissions for users and groups basically showing you what commands they can actually run with pseudo if they are inside the pseudo group so if you want to edit this you would do it with v sudo and you go Pudo vudo and the explanation is that this is the safer way to edit the sudo’s file because it checks for syntax errors before you save it so you don’t want to do this with Nano or Vim because vudo actually checks for syntax errors and then it’ll open the pseudor file and the default editor that you have it just does it while checking for syntax errors and once you’re inside of the sudos file you can Bas basically uh designate or define specific commands that people can run with pseudo when they’re inside of the pseudo group so for example um giving somebody full pseudo access would be assigning their username so this would be Alice for example and they she has all all all all so she has all of the permissions the breakdown is whoever the name of the user is the first all allows pseudo access from any terminal so all of the terminals would be this one so on all terminals she has access and then all all inside of the parenthesis right here allows her to run commands as any user and as any group and then the last one is allowing her to run any command so she can do it from any terminal as any user in any group and she can run all of the commands so she’s getting granted full pseudo access if you want to Grant pseudo access without a password which is another one of those things that like now you’re just giving this person literally everything in the Kingdom you just add that no password uh parameter or that no password argument inside of this piece and now she has access to everything so uh on all terminals as all users no password required she can run all of the commands and now she has access to the entire Kingdom um if you want to restrict access to a specific command which is most likely what you’re going to end up doing this is what it looks like so you have the username she can run on all of the terminals as whatever user no password required but she can run system control the user uh this is the full path of the system control binary and the system uh and the reboot uh binary so this is how you and then it’s separated by a comma and a space right so you have the path of whatever the command is meaning the binary path to whatever the command is so whoever the username is can run the system control and reboot commands with pseudo without a password this is what we’re seeing over here so uh this is how you specify what commands they can run by assigning the actual binary path inside of the user directory inside of our root directory so root user user binaries and then system control and this is what this specific user can run without a password requirement and just to make it legit for Alice this is our example of giving Alice that permission so Alice can run on all terminals uh as whatever user no password required the user bin system CTL binary and that’s pretty much it that’s how you uh specify what Alice can run on a computer so just to give you a couple of practical examples here so we got adding a user to the pseudo group so we got pseudo user mod add to group The pseudo uh add to the pseudo group excuse me the user Bob um we have pseudo vudo that edits the pseudor file so it opens it with vudo so that you can actually get all of your syntax checked automatically by the system to make sure your syntax is correct and then we have the managing of the pseudo permissions and our summary here so granting and configuring pseudo access involves adding people to the pseudo group editing the pseudo file with vse sudo and defining the command restrictions for fine-tuned Access Control you don’t want to do all all all all you don’t want to give them everything right so you get them access to the pseudo group get the pseudo file open with vudo so that you have your syntax correct and then you just want to give the specific path to the binary that they should have access to which means the commands that they can run and this ensures that the user has necessary permissions to perform administrative tasks while maintaining security which is very very important in this regard so security is a big deal and we’re going to go into security as its individ ual chapter and everything but we are now bringing all of these Concepts into play so you you’ve talked about file permissions so far and we’ve talked about groups that they can add to and inheriting the permissions of these various groups and now we’re talking about the ultimate Group which is the pseudo group and inheriting the permissions of that group but now you want to limit the individual command that these people can run as pseudo and that’s how we assigned that was going into the pseudo file with Etsy pseudo and then opening up the pseudo file with vudo to make sure that we can actually uh get our syntax correct as we’re doing these things and then from there we say okay these are all the different commands that you can run so that’s how you do that and as a last example over here we got the full series of commands here so you have the user uh mod so pseudo user mod adding the person into the pseudo group right here and then you open up vudo and then you go and use various options so for example the no password option or giving them all terminal access so on and so forth inside of the sudor file and then the username all equals all no password so on and so forth this means that this person whoever this guy is this username person can run this particular system control without any password requirement and that’s the only thing that they’ve been given pseudo access to without a password or even if they had a password this is the only thing that they have access to that they can run they don’t have all assigned to all of the commands that they can run because that would be silly that would be careless on our part as system administrators so this is it this is the very final cheat sheet kind of a thing that you get for permissions and uh pseudo and so on and so forth and we can now jump into the next piece right here which is file management and file systems all right so let’s get deep into the file management and file systems uh so the file system hierarchy standards and the directory structure uh is what we’re going to be talking about uh as a review these are the key directories that we have inside of our FHS our file uh file system hierarchy standard um the FHS defines the directory structure and contents in Linux helping maintain consistency across a variety of distribution so you will see this in pretty much every distribution of Linux the main directory is the root directory then you have the binaries then you have the Etsy you have home VAR temp you’ve we’ve talked about all of these things so none of this is news to you unless you actually skipped that particular uh section of this training but it was towards the very beginning where we went through the file system hierarchy so these are our key directories and since these are the key directories and I mean there’s also a lot of uh a variety of other directories as well that kind of fall under the the ne not NE primary directory so if you go back to the section that we were talking about partitioning uh it was in chapter 3 uh if you visit that or if you kind of re remind yourself of everything that we talked about we have the primary partitions and then we have the extended and The Logical partitions and uh this goes into directly into the concept of mounting and unmounting file systems or partitions within file systems so here’s what that uh is going to look like so we have the mounting of file systems so when you mount something you’re attaching the file system to a directory so that it’s accessible within the larger directory tree and you would do this with the mount command so uh you have any given file system you attach that file system and this could be the xfs file system it could be a fat 32 or a variety of other file systems you you’re essentially mounting it you’re attaching it to Any Given directory and then we’ll as you can see right here we’ll just talk about a few different ways that you can do that but when you do this you’re making that file system accessible you attach it to your directory uh hierarchy so that it can be accessible uh through the OS and through for whatever the user is that’s using it so on and so forth so uh in order to do that you would use the mount command and this is a pseudo command so you uh you have the pseudo uh pre-command I guess we can call it or the qualifier at the beginning of this so pseudo Mount and then you have the device name which is going to be mounted onto the mount point so you would find out what the device name is running Dev and again we also talked about this as we were going through the installation uh part of chapter 3 and I showed you how to find the various devices that are currently mounted or plugged in so to speak the the devices that are currently plugged in to your system and then from there you would get the path to that device and uh it usually uh is something like you know disk 4 or something like this it’s like it’s not a complicated thing so it would just be for slev and then there would just be the device name or the the name that the system has given to it and then from there you would give it the mount point which is the path that you wanted to be attached to so using an option like T would specify the type of the file system so if it’s the xt4 means that that’s the type of file system that you’re working with and then this is so this is what I mean right here so you see how it says Dev device name in this case it’s saying sdb1 so it’s the standard dis uh portion one of that so this is the second one that the second physical uh partition the physical disc that’s been attached to this particular system cuz SDA would be the first one sdb would be the second one SDC would be the third one so on and so forth and then you have the first portion of that physical device the first partition of that physical device that’s being mounted onto the mount uh directory inside of our root directory so that’s typically what it would look like and you’re just saying that I’m dealing with an xt4 or I want to be mounted as an xt4 right so there are various options and we’re going to go through all of this again I have to constantly remind you we’re going to go through all of these as we go through the Practical portion of the command but this is what essentially it looks like you use the mount command to mount any given um file system or any given specific partition a primary partition and extended partition you can mount that onto a mount Point um you can also declare automatic mounting and this is done inside of the ETFs tab uh configuration file that defines all the file systems that should be automatically mounted when you start your system so when you boot your system there would be either one or two or a handful of file systems that you want to be mounted as the system starts so you don’t have to manually mount everything this is a this is considered a manual Mount what we’re doing over here and sometimes you want to do that sometimes you want to unmount something as well but automatic mounting is typically for this the file systems and the partitions that you’re going to be using regularly so you’re going to use an automatic mounting configuration that’s inside of the fs tab file inside of the Etsy folder the ety fs tab is essentially where all of that stuff is housed so the dis partitions or any other file systems that you have that should be automatically mounted all of those configurations are going to be inside the F FS Tab and then each line in the fs tab represents a file system and the mount options that are attached to it so this is what it would potentially look like inside an example or typic the typical FS tab uh file so um you have the file system first and then you have the mount point you would have the type of the file system and then any options that you want to attach to it The Dump location and the pass location so as an example uh we have have the file system right here so just breaking this down it could be the dev sd1 which refers to the first partition on the first sat drive so you have SD for the SAT drive you have the a representing the first SATA drive and then one representing the first partition of that SATA drive so that would be the file system that would fill in right here a more robust way to specify this using the universally unique ident identifier would be this piece right here so you could do a uu ID and then fill in The UU ID instead of giving the path to the partition itself that you want to use obviously that requires that you know The UU ID which you can also find running the previous commands that we ran to find our partitions that are attached to our system uh you could have a label and the label variable equaling the value of whatever that label name would be and specifying whatever that file system is by its label typically this is like um what do I have I have like a SanDisk uh something something something I don’t know I don’t know what the name of the the the drives are but let’s say you have an external drive and it’s a SanDisk drive and it has the label name the label name is very different from its uuid obviously and label from the partition location or the partition path that’s been assigned inside of your system this is actually what it looks like when you plug it in and then you see your list of connections and then it says oh you know this is this particular one and then you can change the label name so I always change them because uh number one I don’t like spaces in the names I want the whole thing to just be one word and then I turn it into an acronym that I understand and I also put the size of it so uh primary 2 terabytes for example that would be like one of the labels that I would rename mine to so that I I know exactly which one I’m dealing with as I go through my uh my standard discs or my external hard drives so to speak speak um and then we have the server share path as well so this is a n network file system like for example the SMB or CFS file system uh those are network connections that are being accessed from a separate location from a remote location so it’s sitting on a file server somewhere and then you’ve connected to that file server and now you have the path to that file server that’s going to be inside of your file system variable so all of these fall under this very first piece right here which is referring to the file system so since now we have the location that we’re pulling the file system we now need to give it the mount point which is the location that it’s going to be mounted upon so the mount point is the directory where the file system is going to be mounted so it could be the very root directory it could be inside of the home directory it could be inside of the mount data directory um which typically is the Mount point for any addition additional data drives the user directories so all of the home directories for users are going to be mounted on to the home directory and this would be you know for every user that you have you typically would need to assign inside of the ET CFS tab entry inside of the ETFs tab directory or configuration file my mat uh so inside of this configuration file you would assign the actual home directory for the user inside of the home directory path that we have for the route so uh this would be done one time inside the fs Tab and then as soon as the system is booted and the it’s up and live and running uh it’s going to be accessible and everything is going to be mounted you don’t want to be doing that every single time especially if you have like literally dozens or hundreds or thousands of employees and in a lot of environments especially when it gets that big and you have that many people to deal with it becomes something that is done with a script because you would probably get a dozen employees per day or something per week or something like that and that’s just not something that you want to do manually because it’s so much faster to do it with a script and then you can also avoid making any errors if you use a script so uh root file system the user home directories the mount and data points for any additional data drives so we have the location that it exists we have the location that we want it to be mounted to and now we need to give the type of the file system that we are dealing with so xt4 xfs NF FS V fat which is one of the variations of the fat file system so fat 32 so on and so forth so we had uh all of these we have already talked about these various file system types but you would need to know what type of file system it is that you’re mounting so that you can give it the type in this particular variable and then the system will know how to interact with it and uh for the most part the most commonly used is going to be xt4 which is for Linux file systems in you know personal computers or in small environments xfs is the high performance file system that usually is used for a file server um and for a web server for example which would most likely be combined with some kind of a network path because if you’re accessing it remotely from a uh from a series of uh computers that are in a different city for example uh that is going to require the network path for the file system name right here instead of the the file system nickname or something like that you actually need to give it the network connection path that you have over there and the NFS would also be the type that would be used in in that regard so if it’s internal and you’re hardwired to it then you would use x xfs as the type but if you’re accessing it from the network connection then it would be NFS for the network file system and then vat is just one of the fat file systems that’s often used to USB drives or external hard drives that are being attached via a USB wire or even a fire wire or something like that it’s just something that’s being externally attached it’s an external hard drive that’s being connected to the machine and then we have our options that we need to attach to this particular path uh so it could be the mount options that control uh how the file system is actually mounted um it can be multiple options that are attached to this and the default options you can uh refer to them by just saying defaults and those are the wsid Dev exec Auto no user and async all of these happen all at the same time I’m not going to break these down right now you’re more than welcome to Google them if you want to but these are all mounted or assigned to this particular uh FS tab entry by just using the defaults uh entry or the defaults option um there is no a time which prevents the file system from updating the access times there is r o which mounts the file system as a read only there’s RW which mounts the file system as a read WR which is what’s represented right here um and then a variety of other options that you’re more than welcome to go check out and uh I’ll actually just show you what all of those options are real quick okay so we have the defaults option as we already mentioned which will include all of these options right here and the example entry would look like this so this is the partition it’s being mounted onto the root it’s an xt4 type of of a file system and we’re adding the defaults to it and the defaults would add all of these individual uh options as one entry which would be this piece right here then you have the RW by itself which is this guy right here and RW represents the read and write mode so that somebody that anybody that gets access to it has read and write capabilities you have r o which represents read only uh you have no exec which prevents the execution of any binary on the mounted file system um and that is actually not included on here because this is the exec meaning that they can execute all of the binaries on that particular file system no suid disables the set user identification or set group identifier bits that we just talked about in our previous uh sections uh making sure that you can or the the person who’s running anything from this doesn’t do it with the permissions of the owner or the creator of it then we have the no Dev which does not interpret character or block devices on the file system and really what that means uh is that the users cannot create device nodes within that specific directory structure which enhances the security by restricting access to that devices management functions on a mounted partition so the users can’t create devices on that specific file system they can’t attach uh external devices or create any virtual devices attached to that particular file system so no Dev if you can recall what we were talking about with the actual Dev partition or the dev portion of the file system and how it creates a file structure for a printer that may be added or for the driver of the printer for example or a USB drive or something like that so when you think about what that’s what Dev does then you can think about no Dev meaning that it doesn’t allow them to do that on this particular file system that’s been mounted uh no a time is the does not update the access time on files when they are read so this will improve performance potentially uh but it’s essentially the access time on files so you open a file and then there’s a little uh meta data that’s updated that says oh this file was accessed last at this particular date and time so this is the piece that you’re going to remove from there no dur a time does not update the access time on directory so very similar to the last piece uh ra a Time updates the access time only if the previous access time is older than the current modify time which obviously it would have to be uh which improves the performance while maintaining some of the a Time functionality so it will add an access time only if the previous access time is older than the current modified time which again it it would seem like how would somebody go go and access something at a date that is uh newer than the old like what that part is like if the previous access time is older meaning so the very last access time was June 1st and then I’m accessing it today on June 10th so obviously the previous access time is going to be older so that’s the that’s the thing that I’m like okay whatever that doesn’t make sense but okay um then there is the user which allows a normal user to mount the file system um meaning that somebody that is not an administrator or a pseudo user they to mount the F system and in no user only the super user can mount the file system meaning the super user being the root or the administrator or somebody that’s on the pseudo list and then you have Auto which is the mounting of the file system at boot automatically which is one of those things that was actually included I believe in our big list at the top right here yep we have the big list and then you have no user that’s also one of the ones that’s here Dev meaning that you can mount other uh file systems onto it or create device nodes onto it there is the suid which means that people can actually access and run this with the permissions of the person who was the owner and then async so let’s see if we can go and check that out specifically at the bottom right here uh no Auto preventing it from being automatically loaded we have sync which is all input and output operations are done synchron synchronously um and then you have async which all input and output operations are done asynchronously and let’s find find out what those things mean specifically okay so actually this is very uh easy to understand so all input operations being input output operations being done asynchronously means that when the computer performs the operation for example reading from a file or writing to a network it doesn’t have to wait for that operation to finish before continuing with the other tasks meaning if it is synchronously it has to wait for the previous task to finish so that it can move on to other one uh if you do asynchronously it can run those things simultaneously so the program can send the input output request and continue executing other code while the input output operation happens in the background receiving a notification only when the operation is completed which is actually very helpful so that’s probably why this is one of the defaults which is it is async right asynchronously um and then we have the ACL so it enables the access control lists for the file system system and the access control list uh whatever that is on your uh specific uh computer that’s been or on your system that’s been configured it’ll just enable that access control list for this particular partition as well so we have a few examples in this case or one at least one example in this case where the example entry would be something like this where you have the SATA uh a so the very first uh disc and then the first partition of the dis it’s being mounted Ed on the mount storage extension it is an xt4 file system it has the defaults as well as no a time and then we have zero and two and so we can really quick find out what the zero and two are as we go through the rest of our options but it gives us right here so no dump option so uh the zero represents the D dump option which is set to zero for file systems that should not be dumped which means they shouldn’t be downloaded you should not have the option to be able to dump everything from from that file system onto your current machine and then the pass option sets the order in which the file systems are checked at boot so when you’re running the boot this particular file system is going to be done second in line and that’s what those dump and uh pass options stand for and we literally just talked about it so zero would in this case represent do not dump and then one would represent dump defile system so that is something that would be the those are the only two options that are available for the dump parameter in this particular case uh which means that uh it’s a backup type of a feature right so it indicates whether or not that file system should be dumped and backed up um if it has the one that means it is going to be dumped and it is going to be backed up uh if it has a zero it’s not going to be dumped and it will not be backed up uh when you look at a a hash dump or a data dump or anything like that that means it’s being taken from where it’s currently sitting and it’s being dumped onto this particular Mount Point okay so it’s going to go from here and it’s going to be dumped onto here at boot right because this is something that we’re putting configuring for our boot options when we start the system and as it goes through all the various partitions and file systems that we have it’s going to check for this and then if it should be dumped or should not be dumped and it’ll if it is supposed to be dumped it’s going to go from this location and it’s going to be dumped onto that location and then of course pass as we already just talked about it as well so um zero would be do not check so this is the order in which to file systems are checked at boot time by the fs check utility so zero would be don’t check it one would be checked the system first usually the root file system and then two would be check the system after the first one has been checked so you have zero don’t check it one check it as the root which is typically the root file system so we’re not going to mess with it unless it is the actual root file system you’re not going to turn that into one the only thing that should be checked primarily before anything else should be the root file system and then you have the two which is basically check it after the other file system meaning after the root file system you can check this one and then you can assign two to essentially all of the other file systems that have been mounted onto this particular machine uh because they all come after the file system does the root file system they all come after the root file system does okay okay so this is an example of our FS tab file so uh we have these columns so the file system itself the mount point the type of the file system any options that would be attached to it and then we have the dump uh whether or not it should be dumped and then the pass whether or not it should be passed and so you have The UU ID in this particular case and then you have this one external uh or this uh extra partition that’s been attached because it’s the SAT disk B which would be secondary and then the first partition on that uh drive so you’re looking at the uuids here this particular file system is being mounted onto our root so this is standard this is going to be a standard entry on the fs tab because you have to mount the root every single time that you boot a computer it is an xd4 type file system and it’s going to be mounted with the default options and of course it’s going to be passed uh at one meaning it’s going to be checked primarily before anything else is checked and then you have the secondary file system which is going to be everything inside of the home location which would be all of our users so xd4 again all the defaults no dump required and it’s going to be checked second in line after the rout has been checked and then you have this particular one which is our swap space so if you remember talking about our swap partition for our uh partitioning section this is our swap partition and it is a swap type and it is a s SW option uh because it represents Swap and then there is no dump required for it because it’s going to be rebooted or wiped every single time that we reboot the system and it’s not going to be checked because for the most part at boot this is empty right so if you reboot the system the swap space gets emptied out the swap file gets emptied out so when you’re booting the system which is what this whole thing represents right so the Etsy FS tab is the configurations that are uh run when the system is booted and all of these things are being mounted on boot so when you boot the system the swap space is empty so there’s no requirement for us to check it to run FS check on it and then you have the dev sdb1 which is one of our external or secondary uh file systems that is being mounted onto this particular location and it’s going to be mounted on to our mount data partition and the sdb 1 is also an xt4 type of a file system there is no access time that is assigned to this so no defaults or anything like that it’s just a no access time that’s been uh assigned to it and then it has a dump of zero we don’t want to back it up and then it’s being checked after the root as well so if you notice all of these things are going to be checked so if this was a longer list essentially every other thing would also be checked with the exception of the swap space cuz it’s unnecessary to check it and then the options would be the only thing that would change for it um and then you would have the order in which they’re being checked which apart from the root all of them are going to have an option of two or zero which would be the swap space itself so this would be the example of the Etsy FS tab file and so this is the actual explanations of what I just gave you so if you want this you can just pause the screen real quick take a screenshot of this but it literally just explains everything that I just explained in this particular slide right here so if you want to take a screenshot or pause it or take these notes whatever it is feel free to do so right now 1 2 3 moving on okay so unmounting the file system is something else that you would need to do this typically is not going to be done with the fs uh CH or the fs uh okay so unmounting the file system will typically be done manually using the um Mount command this typically is not in the fs tab configuration file and it is just done manually using pseudo umount and then the mount Point itself or pseudo umount the device name so either one of those things so since we have the uh the mount point you could ount via the mount Point itself or you could umount uh by the device name that’s been attached to it right there so um let’s go back to this direction okay so there we go so that is the command that we’re going to have to be able to unmount something and it’s a crucial step to prevent any data loss or corruption especially uh for removable storage devices like USB drives and things like that so this is actually um in a GUI in a graphic user interface you would typically either right click on it and unmount it or there’s like an eject button that’s next to it that you would click on the eject button and it would unmount it for you but when you’re inside of a uh command line interface like a lot of Linux servers are and they don’t have a gue uh when you’re inside of that environment you would need to use the umount option so that you can unmount it and make sure that it’s saving everything it needs to save and then usually if something is open inside of that partition inside of that for example that USB drive if there’s a file that’s being accessed from the USB drive and that file hasn’t been saved usually you’re going to get some kind of a notification saying hey there’s something from this USB is being used and you need to save and close it before you unmount this and that’s always a notice that you would get if you’re running Windows or Mac OS or something that has a g when you try to unmount it or disconnect it instead of just you know obviously hopefully you’re not just pulling it out of the USB location um I sometimes do that but I only do it when I know for a fact that I have all of the files closed or I’ve saved what I need to save and I can just pull it out and just make sure that you know I can be certain that nothing is going to happen to the file that I was dealing with but if you haven’t saved something or or if it’s still in use then you’re going to get that notification and basically just save it and then close out whatever software is using it and then you can unmount it without any problems and just to kind of articulate the reasons to unmount just to make sure that you’re all good and you understand what we’re doing so um there’s something called a buffered right so os’s often use a process called buffering to improve performance instead of writing the data to the dis immediately they temporarily just store the data in your random access memory which is volatile memory which is temporary memory because it’s going to get wiped when the system reboots so when you unmount it it takes all the buffer data and actually writes it to the disk so it takes it out of the ram out of the random access memory and it actually writes it to the dis and then that way you can when you unmount you can be sure that everything that’s currently buffering and just kind of hang hanging out in limbo it’s actually being written onto the disc so you don’t lose any of your data um then there’s the flush cach a so when you uh unmount something you flush the cache and cach a is kind of another one of those temporary storages that just houses some data uh meaning anything that’s pending uh any kind of pending right operations are completed and the data is accurately transferred to the storage device and then it comes out of the cache and it actually goes into the device itself it’s written onto the device and you don’t have to worry about losing that data um another reason would be the Integrity of the file system so uh when you unmount it you cleanly close the file system and you make sure that the data inside of it and the state of it is consistent and it hasn’t been corrupted in any way um which is actually very useful it’s like a good habit to have because most likely you’re not going to ruin the Integrity of the USB especially in a lot of modern USBS most likely you’re going to be fine but if you do that repeated there could be some uh mess you know something that happens where the the corruption in this particular case corruption is like a very strong word but the Integrity of the USB may be messed up the Integrity of your file system may be messed up it may not run as quickly it may not save what it needs to save if you just keep doing it repeatedly without properly unmounting it and then of course uh the corruption of the data so if the network file is removed or disconnected connected or the USB drive USB drives typically are fine I’m not I’m still going to tell you to unmount it and just make sure that you eject it properly so that part is going to be fine but a network file system if you remove it or disconnect from that without properly unmounting within that relay of data because if it’s Network connected that means there’s definitely something hanging in The Ether in that connection that you have with it and if you don’t unmount it then the the data will potentially be lost because it’s just going to be hanging in The Ether in the medium portion of that connection it’s not going to be on the actual server that you’re pulling from and it’s not going to be on your actual machine it’s going to be somewhere in the middle and if you don’t unmount then you’re going to lose all of that data in transit and then it makes the file unreadable or the file system itself will become unusable uh most likely it’s not going to destroy the file system but it is going to lose some data in that Transit and you just don’t want to do that then you have preventing access conflicts so files may get locked so if you open a file and process might still be running or something might still be interacting with that file system unmounting it make sure that all the file handles are closed and no processes are using it so this is what I was referring to earlier when I said like something may still be using it a software may be using it so for example when I’m editing a video as an example all of my video files are stored on an external driver because I don’t want to take any space on my actual computer and if I still have Premiere Pro open and it’s still using any of those raw files or my project files and I try to unmount I’m going to get a notification saying I can’t unmount this like my computer will say this can’t be unmounted because of the fact that or you know dis can’t be ejected that’s another way that it says it because the fact that there’s a program that’s still using it in some capacity so this is the portion right here where it’s like it locks the file right it won’t disconnect I mean I can still pull it out right I can still pull it out of the USB but that process right there might lose my last save my auto save or it might affect some of my data or my video files or something like that so in that regard I’m like oh okay let me just go save Premiere let me close out Premiere and then that way I can unmount easily or eject the dis easily um there are shared resources and again this is inside of the networ connected file systems multiple users or uh systems may be accessing the same exact resources and if you unmount them it manages these resources and prevents the issues arising from unexpected disconnections right um Mak sure that everybody who is using it is notified number one that it’s being unmounted and it was unmounted or it just saves all of their work because it is a shared resource and you don’t want them to lose their stuff because it’s important stuff everybody’s working on something that’s relevant to the organization so you just want to make sure the shared resources are protected again I feel like Network file systems in my opinion are much more volatile and much more sensitive they uh than USBS right so they USBS are typically very resilient uh Network file systems are susceptible to uh loss of data because the fact that it’s being connected via an internet connection so that’s the piece that I think is kind of important to understand espec especially in a network file system you really want to make sure that you are unmounting that file system all right so some sample commands here so pseudo umount Dev stb1 pseudo umount and then the mount location itself so this would be the device name this would be the mount location um and this is the network file system this is a USB drive right so you mount and then whatever the name of it is inside of the the file system or the path of the network file system and that’s basically it it’s very very simple and so in summary for this particular section we want to flush all of our buffers you want to maintain Integrity you want to prevent any conflicts to close all the file handles and any processes um if you unmount correctly you help Safeguard the data and maintain the reliability of the file system and you always want to unmount before physically disconnecting USB drive or network shares to just make sure all the Integrity of the data is preserved and you don’t have any conflicts and now that we understand the mounting and unmounting and the importance of those two actions we want to talk about the actual management of the Diss and the various partitioning tools so Fisk the fixed dis is one of the tools that you’re going to use to create partitions and modify them or delete them so this is a command line utility that’s used to create modify or delete partitions and so uh you run it with pseudo and then you run f disk and then go into whatever the individual dis is that you want to partition so you would have to run pseudo f disk and the location of the actual physical drive and the physical file system or the physical disc that you’re going to be opening for partition and this could be done with a USB drive as well so this above Command right here it opens this particular dis for partitioning and then you can replace this with any device that you want to open for partitioning um a common command that you can run with it would be the print partitions command so it would be just the f disk and then p as the option which prints the current partition table showing all the existing partitions on the disk and we ran something very similar to this to find out what our partitions were earlier as we were installing Linux so it would be P for partition list right or print the partitions excuse me um you have n to create a new Partition so creating the partition you’ll be prompted to specify whether you want a primary or extended partition and the partition starting and ending sectors and then you have the usage for this which is going to be n right here so choose P for primary or E for extended which would be combined with the N uh command and then you can specify the partition number starting sector and ending sector or size and all of that will go into when we actually run these things practically I also think I have a couple of examples commands as we go through this as well so um deleting a partition would be done with the D command so deletes an existing partition you’ll be prompted to specify the partition number to delete and then specify the partition number to delete using the D command uh you can write changes so once you’ve made the changes you need to write them so you can enforce them so anything uh that is made all the changes to the dis uh that are made before you exit you have to write the changes otherwise they’re not going to be saved so you could be doing all the work creating partitions doing everything that you’ve done unless you actually write everything that you just did it’s not going to save when you exit so that’s the big piece that you got to keep in mind whatever edits you’re making deleting modifying adding anything that you’re making you need to use this W to make sure that it’s being written so that it saves it um you can set a partition as a bootable by using the a command with f disk which means that the partition will active uh will activate for boot purposes meaning on Startup when you start the partition or when you start the computer that you’re running that specific partition is going to be added to your list of bootable partitions meaning it’s going to go to the the fs tab uh configuration file so that’s what it means when you make something bootable so here’s our F example workflow with f dis so you open the dis using the f disk and then whatever the path is that you want to partition you partition uh or you print the partitions for help so P enter right so cuz you’ve opened it and you’re inside of the mode where you’re now interacting with Fisk you press p and then enter um you press n enter and then P for primary after you pressed n you are saying that you want to create a new Partition you would then enter either P or E so P for primary or E for an extended partition and then specify the partition number starting sector Etc and then you write the change is meaning you press W enter and then you can exit F dis safely because all of your work that you’ve done would be save lsblk so you should be familiar with ls because we already talked about LS inside of our introduction to the command line BLK would be the block devices so you’re doing lsblk to list the block devices um it’s displaying the information about all of the available block devices which are basically our partitions right the discs and the partitions in a tree like format and it’s a clear overview of what you have on that system as far as the storage configuration the device name the types the sizes the mount locations the amount points and every other piece of data uh that would be relevant to knowing about what your disk structure looks like and what your partitions look like the basic usage is you literally just press lsblk and you press enter and you see a tree format of what everything is on your computer and this is what the sample output looks like for list blocks devices so you have the name MCH Min RM size Ro O type and amount point so in this particular case we would have the first physical disc and then it has three partitions and then you have the second disc and it has one partition and then we can actually go and look at uh the various uh columns right here and what each one of them mean but for the most part you can try to understand what it is right so the very first line the type is that it’s an actual dis and then one two and three are the partitions of that disc and then you have another disc and you have a partition of that disc you have the mount point locations for each one of them uh this one right here is a swap space as you can see right here the size of them are going to all be listed here as well but just to give you a good idea of what all of these columns stand for uh we can go and look at our handy dandy AI assistant here so we have the common fields for the lsblk output so the name would just be the device name as we’ve already established the m and Min is the main major and minor device numbers in this particular case 80 or 81 uh the RM is then indicating whether it’s removable and for the most part if it is if it does have it that means it is a removable uh partition so zero would mean that it’s non- removable one means that it is removable the size would be the size of the device the r o indicating whether it’s read only so zero would be its read and write one would be its read only the type so dis part partition or ROM which is readon memory or swap as we just saw U Mount point would just be the path the path that has been mounted on the fs type would be the file system type The UU ID would be the universally unique identifier and then the label that has been attached as if it’s a backup or a data or so on and so forth so these are the individual uh fields that we have right here and we actually didn’t even have the label or anything like that so uh what we do see in this particular example is the the mag Min right here we have the removable so these ones are not removable this one because it is an external it is removable you have the sizes of this and then you have the the read only which means these are not read only um and then you have uh dis partition dis partition the mount point would be swap so on and so forth so that’s what we got that’s the output example and the breakdown of it so in the example that we saw with the AI there was the type label and uui and that would be done with the lsbl k-f so that it gives you the full I believe that’s what the f would stand for so it gives you the full display of all the block devices along with all the information like the type label and uuid and the output for that actually looks like this so it removes a few of the other pieces that we saw so the readon or the the swap location or the swap type for example those things we see that they’ve been removed from this particular location or from this particular output but now now we have in its place we have the UI uuid we have the label and the mountain point is also still there uh the fs type is still there as well and here’s a quick little screenshot just in case you want this so if you want to pause it to be able to write this down or if you want to screenshot this you have one two 3 seconds and we are moving on if you’re looking for specific data to be printed onto the screen you can actually use the dash o uh flag or argument or option to be able to list what you want this has to be all in caps lock and then you you need to know the actual name itself of the column that you want to print onto the screen so in this particular case it would print the name of it the size of it the fs type and the mountain Point location and it you can just customize your output in whatever way that you want if you do the dasd option it’ll display the information about the whole dis only excluding the partitions of the dis meaning that uh you have the dis right here so this is the disk and then these are the partitions of the disk so these will be removed if you use the DD option you will only see the diss themselves and so this is a quick little summary so lsblk provides the detail tree view of the devices with the F option it’ll include the file system information it is customizable so you can actually use uh the- o to be able to view whatever you want to actually view on the output and yeah that is the list block devices mkfs very similar to MK dur is a making of a file system so you can make file systems it’s used to format a partition with a specified file system type and you can use it with the mkfs so and very similar to what it looks like in Python structures you would use the dot to uh declare what type of file system you want to create so you would do pseudo mkfs do xt4 and then on this particular disk so you can see that uh this is the obviously the file system type that you want to create and this will be the the partition which is on the SDA dis on the first position and it’s being created as an xt4 file system uh the xfs file system is a high performance file system known for robustness da d da so you can do pseudo mefs uh xfs so pseudo mkfs do xfs and you can now create an xfs file system same thing with the fat 32 uh in this particular case you would actually need to say it’s a v fat type of a file system I love saying that the V fat type of a file system and then you do a-h capital F and then say that it’s a 32 extension of it so these are the older ones that are typically used for USB drives and things like that and they are widely uh supported meaning that you can use them on Windows as well as Mac OS and so on and so forth um but they’re typically limited to the amount of space that they can tolerate which is 2 terabytes as we discussed earlier in the training so uh this is specifically for USB drives for the most part or something that is maxed out at 2 tbytes um it is a little bit slower it’s a little bit older so that part of it you should already know about but if you want to create it instead of saying fat 32 on the dot afterwards you would say vat and then you would go- F32 and then the rest of it stays the same NTFS would be the new technology file system that is a Windows uh ingrained or intuitive to Windows and uh this is for advanced features like journaling support for large files formatting and partition with this can be useful for compatibility with Windows and you would say make FSS make fs. NTFS and then give the location that you wanted to do it so this is our example workflow so you want to First identify the partition so you would use your list block devices or Fisk list to list whatever block devices you got so for example lsblk would just be the you type it out you press enter and it gives you the list and then you choose the appropriate m mkfs m uh the make FS command based on the desired file system type so if you want to do xt4 you would say mkfs do xt4 at this particular partition and so again so keep this in mind right so what if you’ve create you’ve identified the partition that you want using the lsblk now you want to create a file system on the partition that you’ve uh found or you’ve design designated declared right from that that file system you’re going to create or from that partition excuse me from that partition you’re going to create the file system that’s going to be mounted onto it and after that’s done you can verify the file system type using the lsblk DF command and press enter and then you’ll verify what you got onto that file system so in summary the make FS the mkfs is used to format partitions with different file systems um you can uh use file system types like xt4 xfs fat 32 NTFS Etc um and then you just need to choose what you want based on the compatibility um there’s something called the dis utility and so just to compare it to uh something that would be on Mac OS for example there’s something called the Disk Utility tool that will do this for you with a gue type of an environment so you connect the USB drive and or an external drive whatever it is um and then you say that you want to reformat you go to the dis utility you select the USB drive that has just been connected to your device and then you go to format and then you choose the formatting option that you want and it would be xt4 xfs whatever is available for that specific drive and then you uh finalize it right so this is what this is doing uh it’s looking at whatever that connection is whatever that USB drive or external drive or disk is it’s going to look at that and then once you know exactly where it is what is mounted on as what its name is so on and so forth you then use pseudo Mech fs and then you reformat it right you format that drive to be one of these types of file systems and to completely be like very brutally honest and just declare like really really note you you know what I mean like disclose this for you uh this is going to wipe the file system and most in most environments in most cases it’s going to wipe everything that’s on that drive so when you format a USB drive it’s going to clean it out it’s going to delete everything that’s on there uh because it needs to reformat the thing so you need to make sure that if there’s anything on that dis that you want to be backed up you got to back it up first before you do this command because it is going to wipe the file system it’s going to wipe the current formatting of that USB drive or that disc and most likely you’re going to lose whatever is on there so just keep that in mind right if it’s not empty if it’s not a brand new USB or external drive that you’re trying to change or if it’s not a brand new disc that you’ve installed if it’s not one of those things and it’s already empty you need to back up whatever needs to be backed up before you run this because it’s going to wipe it fsck for file system check so this is what actually is ran um from that uh the fs tab file when we declared what we wanted it to run on boot and we were looking at the various partitions and discs that were going to be launched on on boot the very last option was do you want to pass or not and we were going to say yeah I do want you to pass or I don’t want you to pass which means you’re going to check and run FS check on it so it’s the file system consistency check that’s basically what it stands for and it detects and repairs any file system issues and you should pretty much use it so obviously if it’s on the the fs tab configuration file it’s going to give you the option of running it on boot so it’ll run the check of that whatever file system that’s been mounted as soon as you boot up your computer um but if you haven’t shut down the computer properly or if it crashed or something and you just want to make sure that uh nothing has been lost when you reboot it you will run FS check to just make sure that the file system is still all good uh to identify any kind of issues if there are any issues hopefully there aren’t any issues but sometimes there’s an improper shutdown you lose power or the system crashes for whatever reason so that’s all good if you manually reboot or shut down the system without properly unmounting your file system that would be another reason to run FS check on it to just make sure that it’s all good any kind of an error that happens so if there’s a boot failure for example and you start up your computer and for whatever reason it doesn’t boot that specific file system you run FS check to try to diagnose what just happened and why it didn’t Mount or why it didn’t uh boot it um same thing for mounting so if you can’t boot it or if you can’t mount it um then you run FS check to see what is going on with that particular uh partition and resolve any kind of underlying issues because you need you need to understand that you can connected right so it can be connected to the computer but it won’t be mounted and that is a very uh nuanced difference so you can have it be physically connected but it may not necessarily be mounted and so if it’s not mounted you need to find out why it’s not mounting then we have periodic maintenance so just preventative checks right so to just make sure that uh it’s all good and uh there’s nothing wrong with it you just run routine maintenance um if there’s any kind of an update or a health issue or any kind of a minor issue you can catch that before a major issue comes into play and before there’s a crash or before you lose any data and then there’s schedule check so many systems are actually configured to run this automatically at boot like we already talked about after a certain number of reboots or Mount operations um you can write scripts to do it for you every week or something or every month just to make sure your amount uh points and your file systems are all good so uh it’s better to do it regularly instead of waiting for some kind of a crash to happen or some kind of error to come up so that if there is something going on you can catch it in advance and then you can fix it so running it at boot is as simple as making sure that the pass option has been turned on with your FS tab configuration file uh manual invocation would be to just run pseudo FS check on whatever that partition is or whatever that dis is and it’s as simple as just running pseudo FS check it’s really this part is not is not that complicated to explain um you can also have unmounted partitions that you want to check uh before um running to avoid any kind of potential data corruption so you can unmount the partition first and then run FS check on it to just make sure everything is all good and that’s another strategy that you can run to run FS check um there’s interactive mode that can actually prompt you to fix anything um within the interactive mode and you can use the flags to automate the process um so for example Dy will be automatically answering yes to all of the prompts that come up so do you want to automatically repair something you just do Dy and then it’ll go ahead and uh run the entire autocorrect for you or the automatic repair for you uh without you constantly having to say yes yes yes so it can be opened in Interactive mode for the repair of any file system if it needs to be file repaired or any partition that needs to be repaired and then if you just attach that- y it’ll do everything automatically so as a summary you have any proper shutdown or file system error or any periodic maintenance that may be required that to run FS check on it and it just makes sure that the file system remains consistent uh if there’s any data loss you can be preventing it or catch it in advance if there is mainten maintenance that needs needs to be done um making sure that the system just runs smoothly all the time without uh risking the loss of any data it’s very very important um as an extra reminder just make sure that you back up the important Data before running FS check because sometimes through the uh through the repair process you may actually lose certain data because if there’s something with that file system that has been uh corrupted or if there’s malicious data or some kind of a malware or something that’s been installed on it uh you most likely are going to uh in the process of wiping that malware you’re going to lose other data that may be important to you so you want to make sure that you run backups uh or save the important files before you run FS check just in case it wipes certain things as an attempt to repair your file system which brings us to the configuration and management of the swap space so um we’ve kind have gone over this so we’ll just re-review this cuz this actually was a little bit of a concept for me to wrap my head around as well so it’s virtual memory so the swap is virtual memory on your hard drive that’s used when physical processing power is maxed out right so your RAM is technically part of the processing power of your computer so you’ll you know you’ll hear people like computer nerds you’ll hear computer nerds be like oh I got a 64 gab RAM on my computer there was literally somebody that actually commented on the channel that they were like yeah I remember my first computer had 24 megabytes of RAM and then now I have a 64 gigb of ram I’m like holy crap dude 24 megabytes like you know the system is old when you’re measuring the Ram with megabytes instead of gigabytes so you’ll have these nerds that really really compete over the size of their ram my Ram is bigger than yours kind of a thing and it’s mainly because it helps run things much much faster and usually in modern computers if they have 64 GB of RAM or 128 GB of RAM if they have that much RAM you’re most likely not going to worry about swap space but if it’s limited so if you have 4 GB of RAM or if you have 8 GB of RAM or something like that the swap space is very important because it’s going to serve as virtual memory to save uh life processes so that you don’t lose anything especially when you put the system into hibernation or it goes into sleep or something and you want to turn it back on and pick up where you left off all of that data is either inside of the ram the random access memory or it’s inside of the swap space so the swap is a buffer to prevent out of memory errors meaning that the system can’t run because the physical memory has been maxed out and so it’ll take whatever is being uh it’s kind of over the threshold of the physical RAM it’ll hold on to that um by offloading the inactive processes from the ram so if you have too many things open and you’re actively using something the ram processing power is going to be dedicated to what you’re actually using and everything else that’s in the background is going to go into your swap space if you want to create a swap partition you can create that swap partition using the Fisk command so you can create a partition uh simply by just opening up whatever it is that you’re trying to open up and then you would create a swipe uh swap type of a partition so uh a dis partitioning tool which is f disk you’re going to uh use it uh on the specific location so in this particular case it’s sdb as you can notice so it’s sdb which is going to be our external or secondary dis and it’s going to be where the swap partition is going to be created you can replace it with whatever identifier that you want to use and then you actually go through the process as you interact with Fisk to create the partition right so you would open up f disk on that location press n to create a new Partition press P to create a primary partition and the partition number for example would be two and then you accept all the default uh first sectors to accept the default last sector and then you have to change the partition type so this is the part right here where you change the partition type to swap you press t for swap I don’t know why it’s t maybe it’s temporary that’s what stands for maybe and then you press 82 which is the Linux swap number and then that’s it and you press enter and then after all of that is done you press W and press enter to write all of the changes to the disk and then exit f disk to make sure all the work that you did is going to be saved so that’s how you create it right so kind of review that cuz I’m not going to keep repeating myself I sometimes I keep forgetting that I’m doing a recording and then I am I beat something to death that’s like a bad phrase uh you know beat a dead horse or something whatever the phrase is I just keep repeating myself because I want to make sure that you get it but then I’m like oh you know what they could technically just rewind this and go replay it over and over again so my bad I’ve gotten comments from people that are like did you have to talk about that thing as long as you did and I’m like yeah well I just want to make sure that people get it so I try to say it in different ways so that it connects excuse me for trying to help you learn Jesus God I’m I’m having a conversation by myself in my room as I’m recording just just so you know okay moving on so now you need to format that partition as a swap space so now that you have that specific disc that you did everything with Fisk now you turn it into a swap Space by using the MK swap make swap command and you format it as a partition um you it’s very similar that we already have this understanding so we’re going to move on um then you turn it on right so you’ve you’ve used Fisk you’ve created that partition then you use me swap to turn it into a swap partition and then you use swap on to actually turn it on as the swap partition and very simple I’m I’m not going to keep repeating all of these things because the instructions are meant to be redundant um but here I’ll just leave this on in case you want to screenshot it 1 2 3 moving on and so verifying the swap space you just go show you use the D- show option with swap on to just make sure that it’s actually been created as a swap space and it’s actually turned on and it’s running as smoothly as it is so it’ll be the active swap spaces that are viewed when you run the swap on command with the show option so creating a swap file is similar to having a swap partition so creating a swap file to turn a swap file or to create a swap file it would be done with the F allocate and then you use the dash l so don’t confuse this with a one right so pseudo F allocate dasl and then 1 Gigabyte is going to be allocated to wherever the swap file path is right so you have a swap file instead of a swap partition um the F allocate allocates this uh space for that file the dash L 1G would be the limit right so you’re doing a 1 gigabyte uh limit for this particular file location and then you have the swap file which will be the path to whatever the swap file is and then you do chod 600 so you change the mode the permission of it uh to that swap file to set the file permission to read and write only for whoever the owner is and then that should allow it to actually read and write as necessary and then you would turn it into a swap so this part is pretty much exactly the same as what we did with the swap partition which in this particular case we’re just making swap uh the actual swap file path and then you would turn it on right so swap on for that swap file and then of course once it’s been turned on you just want to make sure that it is active and it’s running so you would do swap on– show so pseudo swap on– show and it’ll show you whether or not that specific swap file has been activated the last step with your swap partition or swap file would be to make sure that it actually loads every time you boot your computer right so you need to add it to your ety FS tab file as we’ve discussed uh so far so you need to configure the actual ET CFS tab file uh we can do it with our trusty Nano text editor by just opening up the ET CFS tab with Nano of course you would need to do it with a pseudo permission so you can actually write to it and save it um then you would uh add whatever the swap partition is uh in that particular FS tab according to the formatting that we’ve talked about so far so you would provide the name and then the location and then the type of the partition which would be Swap and then whether or not you want it to be dumped which is no you don’t want it to be dumped whether or not you want it to be passed um in the fs check when you reboot and you don’t want it to do that either because it’s going to be wiped every single time that the computer is rebooted anyways that’s the whole purpose of the swap partition it’s not going to store any memory or any kind of data on it because every time it gets rebooted it just gets deleted so that’s the whole purpose about this so you don’t need to dump it and you don’t need to check it with FS check when it gets started on but you do need to provide the name you need to provide the path and then you need to provide uh what type of partition it actually is which is going to be swap or what type of file system so this is the piece for the file system and so on and so forth so this is how it looks uh notice how all of these things are exactly the same with the exception of whether or not it’s a swap file or a swap partition and even this looks very similar right you’re just giving it the path to the partition or you’re giving it the path to the swap file that’s basically it and this is the explanation of what we just looked at right so you can screenshot this one 2 three so the first portion was the swap partition itself um it’s not going to be mounted onto anything because it is a swap partition it is the swap space and then s SW for the Swap and those are the options that you got and then so once you you have written everything into the fs tab file inside of Nano you’re going to save the changes doing crol o press enter and then controll X to exit out and then you can move on in summary creating and configuring swap space whether as a partition or a file is essential for maintaining system performance by following these steps you can ensure that your system has adequate swap space available and it’s probably a good idea to actually have this uh whether or not you have a massive amount of RAM installed on the computer um the Mac OS whether it gets uh you know 16 GB 32 GB whatever the the actual Ram is or Windows whether it has all of that massive amounts of ram it still has swap space so it’s probably a good idea if you’re going to be a Linux administrator and you’re going to use the type of interface that doesn’t have a GU or it doesn’t come preconfigured with with these types of things it’s probably a good idea for you to make sure that there is swap space that’s been configured and if it hasn’t been configured you go ahead and configure it the way that we just talked about and of course we’re going to review all of this stuff when we go into the Practical section and this is your little cheat sheet so if you want to create a swap partition you can create it using FS disk or f disk excuse me you can create f disk and then you have the creating of the partition then you format it to become a swap space and then you turn it on using swap on and then same thing F allocate L1 GB to the swap file pseudo chod the swap file and then make it a swap file and then turn it on as a swap so once you’ve created the swap space now you got to manage the swap space um the swap space usage and ensuring that the configuration persists across all of your reboots and restarts of the computer is very important for system administration these are the detailed steps that you got to do to check the usage so checking swap usage you would go swap on Das s excuse me swap on- S and it displays the summary of the swap space usage listing all of the active swap areas and this is the example output that you have over here so you would have the file name swap file and then you have the dev sdb2 which is the partition for the Swap and then these are the sizes that they have and then for the swap file 2,000 uh kilobytes has been used and it has a priority of minus two and then this has a priority of minus one and it hasn’t been used at all as you can see over here because it doesn’t need to you know for whatever the situation is this is 1 GB worth of space so it seems to be fine this is just a breakdown of the fields that we just looked at so the path to the swap file the type of file that it is or the type of partition that it is um the total size of it the used amount of it and a priority of the swap space so lower numbers mean that it’s a higher priority and the higher numbers mean that it’s a lower priority uh which is again I guess it makes sense right so number one would be a higher priority than number two um so that is the breakdown of these fields another way that you can check the usage would be using the free command so free- provides a human readable format of memory and swap usage and this is what the output would look like so you have the memory itself and then you have this swap space or swap partition swap file whatever whatever that allocation is when you’ve created your swap partitions or swap spaces um the total amount of memory and then the total amount of Swap and then the used amount of memory and the used amount of swap how much you have free whether it’s a shared portion or if it has any shared portions and then the buff cache as we talked about the buffer and the cache and then the available that’s going on with it so if you look at the the stuff that is sitting inside of the shared portion of this memory as well as the stuff that’s sitting inside of the buffer and the cash egg these are the things that we were talking about when you’re talking about unmounting to make sure that this 5 GB of data isn’t lost so you want to make sure that you properly unmount or you properly shut down whatever the system is or whatever the partition is so that you don’t lose this data because out of the 15 gigabyt losing 5 gabt of data would be catastrophic because it represents a large amount of data on this particular system so free shows you the free space the free memory as well as the free swap space that is available on your computer and these are the breakdowns of the fields so you have the total amount of memory you have the used amount of memory the free amount of memory the shared memory usage by the temp uh FS the shared memory that’s available to the temp file system you have the buff and the cache the buffering and the cach a the memory that’s used by the kernel buffers and Page cache and of course anything that’s available um after all of these things are considered right so after this is considered after the shared and the buffering and C cache is also considered after all of that is considered this is the final available amount of space that is available on that individual partition or disk and this is how we look at the permanent swap configuration so uh to make sure that it’s available after the system is rebooted you have to add it to the fs tab right so this file contains information about this partition so on and so forth um so where are we at I feel like I accidentally clicked something um so there we go so to be able to edit the fs tab file we’re going to use pseudo and Nano and then we’re going to go inside of it and just make sure that the swap partition is designed as it is so we’ve already talked about this this is just part of the permanent swap configurations as we’ve discussed and you should already know what all of these things stand for so I’m not going to explain this again uh you can do a one two three screenshot or pause it or take it down so on so forth and we’re going to move on so add the swap entry to it would be as a swap file same exact concept uh the breakdown is exactly the same so again I’m not going to say this this just redundancy so that you understand that these actions fall into different categories and so managing swap space or creating swap partitions both have a permanent feature and both of those features are inside of the fs tab configuration file that is inside of the Etsy FS tab location and then you save and exit because you’re inside of Nano so you just got to make sure that you save it and even when you try to exit without saving it’ll prompt you to whether or not you want to save it and you just press Y and press enter and I’ll save it and make sure that all of your changes have been saved to that document um activating it is exactly the same way as doing what we did before so pseudo swap on and a would be the activating all of the swap entries inside of the fs tab so you can do pseudo swap on and then give the path or the location or the the the identity of the swap space itself or you can just do- a to just make sure all of your swap configurations have been activated inside the fs Tab and then you just do das Das show to show you uh what the status of everything is and whether or not they’re actually active and correctly configured so in summary we’re going to monitor and configure swap space to make sure that the system can handle anything that’s memory intensive and remains stable under a heavy load which typically if it’s a high traffic environment if there are a lot of users that would be necessary so even if you have a massive amount of physical RAM you do want to have a good amount of swap space as well because you have a lot of data that’s being processed by a lot of different users and is your little cheat sheet so to check the swap spice using swapon you can do swap on- S that will list all the active swap areas and then you can do free- that’ll do a human readable summary of the memory and the swap usage and then if you want to make permanent edits you would do it inside of the fs tab configuration for reboots all the time so that it just loads every single time and then you can make sure that you have swap on- a so that it activates all of the swap entries that are inside of the fs tab file all right real quick let’s go into process and service management so you got to understand the difference between processes Damons and services okay a process is an instance of a program that’s running in memory uh each process has its own P ID its your own process ID and there’s a parent ID which is a PP ID so a parent process ID uh processes can be in a lot of various States or I guess three various States uh it could be running sleeping and zombie States so it’s a program it’s an instance of a program that’s running in memory and it has a p and a parent ID and it can run in various States including running sleeping and zombie States a Damon are background processes they’re running without an interactive user so the it’s basically Al what’s running behind the scenes in order for your machine to operate the way that it does um and it’s starts at boot and it continues to run while the uh the computer is on so that all of the operating system functions can actually run the way that they need to uh so for example a web server Damon like the HTTP D so the d stands for Damon um and anything that ends with with the D so you have the secure shell Damon or you have the cron Damon these are all considered the background processes that are attached to each of one of these individual processes so SSH process or the HTTP process so on and so forth okay and then you have a service uh service are the higher level concept meaning that they group one or more Damons together and that provides a specific functionality so the httpd service runs the Apachi HTTP server Damon right so the httpd service runs the Apachi HTTP okay so that’s the thing to understand so the service itself is a combination of a few Damons or at least one or more Damons that provide a specific functionality and they’re typically managed with system M D or CIS vinet as we talked about earlier these are our initialization processes and for the most part it’s probably going to be systemd on all of the modern computers in Linux cisv it is a little bit of a legacy um and it just depends on the distribution of Linux that you have and the version of Linux that you have so uh you have processes you have Damons and then you have Services okay these would be the commands that would manage the processes so if you want to view the list of processes you would just type PS and press enter that’s just by itself will actually show you the snapshot of all of the current processes if you do psox so PSA it shows all the processes that are running on the system with their details like their pids the user that is running it the CPU usage and the memory usage that it’s processing or that is taking up the the power that is taking up and then you have ps- EF which will display all the processes with the additional details like the parents process ID and the full command line the full and these are this is like where you a lot of these things are actually very much used inside of uh security analysis and incident response and the uh pen testing exercises that we run and the command line that is executed to launch that process can either be done by the system or it can be done by the parent ID the parent process that’s running that individual process or it can be done by a user so when a user clicks on something it actually processes a command in the background and that command has a command line entry so even if you double click on something to open it there’s actually a command line entry that’s running in the background and that is what’s launching that process so everything whether or not you use the command line and everything has a full command line entry associated with it and typically it would for a lot of people that can’t read this stuff it’s mostly jargon but uh in a lot of instances it’s the uh individual command that’s associated with it and the path of the binary that is attached to that process which is launching and actually running so remember all of these things have binaries or system binaries that are assoc associated with them and each of one of those system binaries is housed inside of the bin or sbin uh directories inside of our file system okay so keep all of that in mind so uh you don’t necessarily need to know much about this stuff uh you need to know the details that are presented and then as we go through the Practical portions of this training series we’ll start looking at a lot of these things in Greater detail and we’ll run a lot of the common options that come with PS and looking at the various processes so you can see see what all of that looks like when it’s displayed onto the terminal so that you can have a better understanding and just really kind of get that into your system into your uh your personal system as the person that’s watching this not your computer system okay moving on um so we have realtime process monitoring that happens with top and htop and top is typically what’s available on all Linux systems it’s actually also available on Mac Mac OS because Mac OS has a Unix like uh type of an operating system that’s running in the background um it’s a dynamic display of everything that’s going on so top actually when you press it uh or when you type it in and you press enter it shows you uh everything that’s currently running and it actually changes uh their uh their line item uh positioning right so the order of everything that’s being presented onto the screen changes in real time because something may be coming to the Forefront something may be using more processing power or CPU or memory and you can get a good I idea of what specific process is using up how much of your memory in real time and this is one of the things that you would look at to see uh if there is something that’s running that you don’t recognize and if you need to uh kill it right so uh the apart from the list of processes that are running which we saw with PS top shows you the the real time Dynamic view by usage right so it it’ll typically show you what’s currently running that list changes in real time and it’ll show it’ll show you what CPU and memory it’s using um you can press Q to quit or k to kill a process and R to renis which means to adjust the priority of the various processes htop if it’s installed it’s essentially top but it has a userfriendly interface because top is literally command line and it’s just lines of entries uh on a black screen and if you don’t know what you’re looking at it can be kind of overwhelming so htop is the userfriendly interface it’s like uh it’s a visual uh visually pleasing version of top that you can run and it’ll still show you real-time monitoring of all the processes that are running there’s colorcoded information and a better navigation interface so that you can navigate better and uh according to the color coding that’s done you can prioritize things better so top again is just a black screen with a bunch of white lines of data on on top of it htop is more user friendly it has color coding available so on and so forth once you’ve established a process that needs to be killed for example if you notice something that might be Shady or that might be taking up too much CPU or memory usage you can kill it with either kill or pkill for process kill and kill is a very simple uh command so you say kill and then you provide the P ID that you want it to kill and it sends a signal to the process ID and it just kills it um kill Das 9 PID sends the signal kill to forcefully terminate the process if it’s having uh if it’s taking too long to uh terminate or uh for whatever reason it might be slowing down something uh so it’s a forceful termination uh very similar to what happens in the task manager inside of Windows where you want to close something but it won’t close so you open up the task manager task manager and then you force quit that individual process that’s running and it just no matter what’s going on it’ll just crash and kill the process and then pill allows you to kill it by its name so kill requires the process ID pill can kill it by the process name and then at the same time you can also terminate all instances of a specified process by doing a kill all command and it requires pseo pseudo permission and then you do pseudo kill all and give it the process name so for example in this case let’s say you have you know 10 chrome windows open that’s kind of what my computer is like all the time I have uh different Google Google accounts Gmail accounts that are dedicated to different parts of my life and so for each one of those Google accounts there’s a chrome window that’s open and sometimes it can be overwhelming and sometimes you kind of you kind of you might want to close Chrome and general all together and then just start from scratch and open up a brand new Chrome window so when you do that you for me in Mac OS I can just right click on the Chrome logo at the bottom of my screen and then quit and then it’ll close all all of those instances of chrome that I have but when you’re inside of the command line and you don’t get the option of right clicking then you would just see okay there’s you know there’s 10 instances of this particular process and I want to close it because I want to free up CPU usage or I don’t know what it is I don’t recognize it it seems like it might be spamware or something like that so what I want to do is I just want to kill all instances of this process so then you’ll do pseudo kill all and then you would give it the process name and it’ll kill all of those processes and free up whatever memory or CPU usage that those things are currently using and as we manage processes we also need to learn how to manage services so managing Services happens with system CTL and we’ve actually already gone through this a little bit earlier um and system CTL is one of the big things that comes with systemd um which is the more uh modern version of the initial the init process for uh Linux and it’s a primary command for managing these services in that environment so uh starting or stopping a service is pseudo system CTL start the service or system CTL stop the service very simple enabling or disabling it is very much the same so pseudo system CTL enable or disable the service if you want to check the status of it it will be system CTL status of the service so it’ll show you whether or not it’s active and any logs that would be associated with the recent activity for it and then restarting or re reloading it would be say same restart the service or reload the service so it’s very intuitive I love the Syntax for this particular command because if you want to start something you literally just type start if you want to stop it you just type stop so it’s very very intuitive actually this is probably one of my favorite commands when it comes down to everything that we’re running cuz the syntax is just real language it’s real words that you’re using so this is kind of an easy one to remember and to deal with but uh system CTL manages Services right PS manages processes system CTL manages services so keep these things in mind these are the types of things that you need to kind of internalize for yourself as you move forward so when you want to manage a service you use system CTL now the service command is used in systems that have CIS vinet so CIS vinet is the older version of system d right so we look at this right here system D is in the modern distributions of Linux CIS vinet is in the older versions of Linux or the older distribution and it’s fairly similar to what you went through with system CTL except the syntax is a little bit different so you do pseudo service the N the name of the service and start or stop or get the status or restart it so these are the basic commands that would come with CIS vinet now what I’m going to be doing uh in the Practical portion of our exercises are not going to be using the CIS vinet commands we’re going to be using system CTL commands because we’re installing a current version of Linux or the most upto-date version of Linux because I don’t want any security vulnerabilities to be uh loaded on my computer as I’m going through all the exercises so I’m going to use the most recent version that I’m going to get from the Linux website so we’re going to end up using systemctl but these are just the series of the commands that you would get for CIS vinet and then there’s a series of commands that are also available inside of the Google document that I’ve created for the notes for this course and then if all else fails you can go to something like gemini or chat GPT and you say I’m running a system that has CIS Vin it as the service uh Management Service and what you’re going to go through is you know I need to do X Y and Z within this computer what are the commands that you would need I would need to run and then it would tell you what you got to do but the the main things to remember are that CIS vinet is for older versions or older distributions that run uh services and you would need to manage them as such and then systemd comes with the modern versions and the modern distributions of Linux and then we have job scheduling and KRON jobs are more so uh repeated tasks that you need to schedule and then the at command is used for a singular command that’s running uh for that one time so if you want to do anything that’s recurring you would do it with the Kon or the KRON jobs which uh essentially just handles all of the recurring scheduled tasks for you so if you want to edit the user’s Kon tab so KRON jobs are defined in the Chron tab files and then when you open up somebody’s Chron tab file you’ll see something that is in this kind of a format and that it has these asterisks that represent the minute hour day of the month month and day of the week so this would be the minute hour uh month itself or yeah minute hour day of the month sorry so minute hour day of the month the month and then the day of the week so in this particular case right what we have over here we have not uh it doesn’t need to run every minute but it needs to run every 5 hours or at 500 a.m. so my bad so this is the uh hour itself which is running the uh fifth hour of the day so it needs to run at 5:00 on that day and then it’s going to run every Monday because Monday is the first day of the week so 5:00 a.m. every single day uh doesn’t matter day of the month is empty doesn’t matter the month that part’s empty where you’re going to do it every Monday so it’s being run Weekly right so this is an example of this now there are a lot of great editors that are available online that if you want to modify something if you want a job to run at a specific time or day or whatever you can go to that editor and you say that this is the path to the job that I want to run and I want to run it at this time of this day or this month or whatever it is and it’ll just create this version this format of the command for you so it looks like this but I mean this isn’t really complicated to understand so I feel like you should be able to wrap your head around this so the first day of the week is represented by uh one and in this particular case it’s not Sunday Monday the first day of the week would be Monday and then the first hour would be 1:00 a.m. and then 2: a.m. 3:00 a.m. so 5 would represent 5 a.m. and the uh day of the month itself would be the first day of the month or the 2nd or the third and I think it’ll go up to 28 because we do have limitations for February so it’ll go all the way up to 28 and then you have the month itself so it would be the first month of the year which would be January the second month so on and so forth so you can look at all of that by going to Chron tab edit Chron tab e to look at whatever user that you’re logged in um to be able to modify those KRON jobs those specific schedule tasks if you want to look at all of these schedule tasks you can instead of opening the document itself you can just do KRON tab DL and you can list all of the KRON jobs the schedule tasks that are available for the user that you’re logged in on so this is recurring jobs with KRON now if you have a one-time job you can schedule that with at so for example you would say Echo the command which is it’s technically just running uh Echo and it’s going to print command onto the screen do a pipe and then do it at the time right so you the time could be a specific hour or relative time for example it could be at now plus 5 minutes or at now plus 5 hours an example of this could be Echo the path to this script right here it could be this specific thing I want you to Echo this meaning just print it print this path and then you pipe it so you take the output of this result that’s what piping does uh you take this result the output of this gets piped into this particular command meaning that at 10:00 a.m. it’s going to Echo this piece right here and that’s what at does so it will uh it’ll run something one time for you if you needed to run daily or more than once you would do it with Chron jobs if you’re just trying to run it once you can run it with the at command you can look at the scheduled jobs for at with atq and you can remove them with ATR r m and then the job number itself so you would do atq and it will bring you all of the jobs that have been scheduled with at and then you will get the job number with each job that’s been scheduled and if you need to remove anyone you just do atrm at remove and then do the job number and then just like that you can remove the scheduled task with at this training series is sponsored by hackaholic Anonymous to get the supporting materials for this series like the 900 page slideshow the 200 Page page notes document and all of the pre-made shell scripts consider joining the agent tier of hackolo anonymous you’ll also get monthly python automations exclusive content and direct access to me via Discord join hack alic Anonymous today

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Seven Sisters (Seven Sisters Series Book 1) by M. L. Bullock

    Seven Sisters (Seven Sisters Series Book 1) by M. L. Bullock

    The provided excerpt appears to be from the first book in the “Seven Sisters” series. The narrative follows intertwined storylines, one set in the historical past, and the other in the present day. The historical portion involves characters navigating love and societal expectations in Mobile, Alabama, in 1850. The contemporary storyline introduces a character named Carrie Jo, who is seemingly investigating the history and mysteries surrounding the Seven Sisters. Throughout both narratives, characters explore themes of family history, love, loss, and the secrets hidden within the old antebellum home known as Seven Sisters.

    Seven Sisters (Seven Sisters Series Book 1): A Study Guide

    Character Review

    • Carrie Jo Jardine: The protagonist of the modern-day narrative, struggling with personal and professional challenges.
    • Mia: Carrie Jo’s best friend, and something of a “researcher” whose current interest is the history and restoration of Seven Sisters.
    • Ashland Stuart: Wealthy and influential, deeply interested in the history of Seven Sisters and the Cottonwood family.
    • Bette: Carrie Jo’s new landlady.
    • William: Carrie Jo’s sort-of boyfriend.
    • Calpurnia Cottonwood: Central figure in the 1850 narrative, grappling with love, societal expectations, and a mysterious destiny.
    • Captain David Garrett: A steamboat captain involved with Calpurnia.
    • Muncie: Overseer at Seven Sisters in the 1850s.
    • Mr. Jeremiah Cottonwood: Calpurnia’s father and owner of Seven Sisters in the 1850s.

    Plot Summary Outline

    • Prologue: Set in 1850, introduces Calpurnia and her romantic entanglement with Captain Garrett. It hints at her connection to the Seven Sisters estate and a tragic destiny.
    • Modern Day: Carrie Jo, seeking a fresh start, moves to Mobile, Alabama, and begins working on a historical restoration project at the Seven Sisters mansion.
    • Mysteries Unfold: Carrie Jo becomes entangled in the mysteries surrounding Seven Sisters, including the history of the Cottonwood family and potential paranormal activity.
    • Investigation and Romance: Carrie Jo investigates the estate’s past with the help of Mia and Ashland, developing feelings for Ashland.
    • Flashbacks and Dreams: Carrie Jo experiences vivid dreams and visions related to Calpurnia’s life in 1850.
    • Connecting the Past and Present: The story explores how the events of the past continue to influence the present, with Carrie Jo uncovering secrets that may connect her to the Cottonwood family and Seven Sisters.

    Thematic Considerations

    • Southern Gothic: The novel incorporates elements of Southern Gothic literature, with its focus on decaying estates, dark secrets, and the influence of the past.
    • Romance and Betrayal: Relationships, both past and present, are tested by love, desire, and betrayal.
    • Family Secrets: The story explores the complexities of family history and the impact of long-hidden secrets on future generations.
    • Fate vs. Free Will: The characters grapple with the idea of destiny and whether they have the power to change their fate.
    • Historical Preservation: The modern narrative revolves around the restoration of Seven Sisters, highlighting the importance of preserving history and memory.

    Quiz: Short Answer

    1. Describe Calpurnia’s initial feelings for Captain David Garrett.
    2. What is Carrie Jo’s initial motivation for moving to Mobile, Alabama?
    3. What is Mia’s role in the Seven Sisters project?
    4. How would you describe Ashland Stuart’s personality, based on the excerpts?
    5. What is significant about the Cottonwood family’s history in relation to Seven Sisters?
    6. What is the mood in the Prologue?
    7. Why does Carrie Jo refer to her new job with Bette as a “gig”?
    8. What did the doctor want from Carrie Jo?
    9. What are some of the historical facts that Mia knows about the Seven Sisters?
    10. What is a significant theme in the story?

    Quiz: Answer Key

    1. Calpurnia is initially captivated by Captain Garrett, drawn to his romantic words, promise of love, and escape from her expected life, yet she questions if she will no longer want her once she has him.
    2. Carrie Jo is seeking a fresh start, leaving behind a difficult past relationship and professional struggles in Charleston. She wants a personal triumph.
    3. Mia is a friend and helps to solve mysteries and research history surrounding the Cottonwood family, to aid Carrie Jo in her research.
    4. Ashland Stuart is wealthy, charming, and deeply interested in the history of Seven Sisters, he’s also very handsome and charismatic to all who meet him.
    5. The Cottonwood family were the original owners of Seven Sisters and their history is intertwined with the estate’s legacy, including secrets and possible paranormal events.
    6. The mood in the Prologue is romantic and mysterious, hinting at both love and impending doom, and filled with desire.
    7. Carrie Jo is a free spirit looking to get back on her feet, she enjoys the freedom of a once-in-a-lifetime gig and doesn’t want to be weighed down by obligations, she’s not ready for something personal.
    8. The doctor was a lawyer, Matthews, who needed Carrie Jo to sign a confidentially agreement and needed her help with the work that was going to be done on the property at Seven Sisters.
    9. Mia knows about the history of the Seven Sisters and can tell Carrie Jo the stories, she knows of the French who settled there and abandoned it for a time.
    10. One significant theme is the intertwining of past and present, as the events and secrets of the Cottonwood family continue to affect the lives of the modern-day characters.

    Essay Questions

    1. Analyze the ways in which the author uses setting (both the 1850s and modern-day Mobile) to create a sense of mystery and foreshadowing.
    2. Discuss the similarities and differences between Calpurnia and Carrie Jo. Are they connected in any way beyond their association with Seven Sisters?
    3. Explore the role of romance in the novel. How does the pursuit of love both empower and endanger the characters?
    4. Examine the elements of Southern Gothic present in the excerpt. How do these elements contribute to the overall themes of the story?
    5. How does the author use dreams and visions to create suspense and reveal hidden truths about the past?

    Glossary of Key Terms

    • Seven Sisters: The name of the antebellum mansion that serves as a central location and symbol in the novel.
    • Antebellum: Belonging to the period before the American Civil War (1861-1865).
    • Southern Gothic: A subgenre of Gothic literature that focuses on the American South, characterized by decaying settings, grotesque characters, and themes of social and racial injustice.
    • Supernatural: Events or phenomena that cannot be explained by natural law or scientific understanding.
    • Historical Fiction: A genre of fiction that is set in the past and incorporates historical details and events.
    • Prologue: An introductory section of a novel or play that provides context or background information.
    • Mausoleum: A building, especially a large and stately one, housing a tomb or tombs.
    • Steamboat: A boat that is propelled by a steam engine, especially one operating on rivers or lakes.
    • Heirloom: A valuable object that has belonged to a family for several generations.
    • Restoration: The process of returning something to its former condition, especially a building or work of art.

    Seven Sisters: Love, Secrets, and Destiny in Mobile

    Okay, here is a briefing document summarizing the key themes and ideas from the provided excerpts of “Seven Sisters (Seven Sisters Series Book 1)”:

    Briefing Document: “Seven Sisters (Seven Sisters Series Book 1)” – Excerpts

    Overall Theme: The excerpts introduce two distinct storylines with mysterious elements, secrets and a link to the historical Seven Sisters mansion in Mobile, Alabama. The stories explore themes of betrayal, love, destiny, family secrets, and a connection to the past.

    Storyline 1: 1850 Mobile, AL

    • Setting and Atmosphere: The prologue sets a romantic and somewhat melancholic tone in Mobile, AL, in 1850. It describes a riverboat, the “Delta Queen,” and a sense of longing and anticipation.
    • Key Characters Introduced:
    • A young woman, unnamed in this excerpt, but heavily implied to be Calpurnia Cottonwood, is desperate to be free and to find love. She appears to be seeking escape from her current situation. “Run—be free. Be what I can never be!”. She is drawn to the music on the riverboat.
    • Plot Points/Mysteries: The woman is escaping her old life and her wedding plans. She is running off with Captain David Garrett. “Somewhere aboard the Delta Queen was Captain David Garrett, the gentleman who had liberated her heart.” The prologue ends with her falling into the river.
    • Themes: The themes include forbidden love, escape, and the allure of the unknown. There is also a sense of fate or destiny at play.

    Storyline 2: Contemporary Mobile, AL

    • Key Characters Introduced:
    • Carrie Jo: The primary narrator. She’s returning to Mobile and taking a job related to Seven Sisters. She is dealing with some personal turmoil.
    • Mia: An anthropologist who works as a museum worker. She seems to be more connected to the history of the Seven Sisters.
    • Ashland Stuart: Involved with the historical society and the restoration of Seven Sisters.
    • Plot Points/Mysteries:
    • Carrie Jo is returning to Mobile from Charleston after ending a relationship. She feels lost.
    • She’s taken a job related to the “Seven Sisters” mansion, which is being restored and will be made into a museum. The family who originally owned the mansion was the Cottonwood family. “The goal was to make Seven Sisters a sort of museum for visitors to Mobile, but the current owner had enough respect for the home’s history to want a proper catalogue of its antiques first.”
    • The house is described as a T-shaped Greek Revival style house that had somehow survived in Mobiles sub-tropical climate.
    • The house seems to harbor secrets from the past, with hints of a darker history involving enslaved people. “I wondered what one of those slaves probably killed her and buried her on the plantation.”
    • The narrator and others are investigating the genealogy of families involved in the “Seven Sisters” including the Cottonwoods, Beaumounts and Ashlands. The narrator learns that her father’s ancestry is tied to this history.
    • There are mentions of finding cross markers. “And there’s more. We found a dozen small crosses over here, but there’s nothing written on them. There’s really no telling who else is here.”
    • Ashland hires Carrie Jo to find a missing necklace named The Seven Sisters. “According to the local historians, Mrs. Cottonwood invented the money in diamonds and sapphires. The largest piece in the collection was a necklace called The Seven Sisters.”
    • Themes: The modern storyline touches upon themes of:
    • Returning to one’s roots.
    • Uncovering hidden histories and family secrets.
    • Restoration and preservation of the past.
    • Dealing with feelings of uncertainty and direction in life.
    • Past connections influence the present.

    Potential Connections Between Storylines:

    • The “Seven Sisters” mansion seems to be a central connection. The prologue is set on the “Delta Queen” which led to the Seven Sisters.
    • The Cottonwood family links both time periods.
    • The tragedy at the end of the Prologue hints at an unresolved history that may be influencing the present.
    • A character makes a statement to the fact that he will help the protagonist find her. “As I pulled away slowly, I whispered, “Yes, I’ll help you find her.”

    Key Questions Raised:

    • What was Calpurnia Cottonwood escaping from?
    • What was on the page in the book that Calpurnia read that opened her closed heart?
    • What is the history of the Seven Sisters mansion, and what secrets does it hold?
    • How are Carrie Jo’s personal struggles connected to the history of the house?
    • What is the significance of the missing necklace?
    • Who exactly is Henri Devoreaux and what role will he play in this story?
    • Why was a child crying in the house?

    Overall Impression: The provided excerpts suggest a multi-layered story that blends historical romance with contemporary mystery. The Seven Sisters mansion and its history serve as a focal point for exploring themes of family, secrets, and the enduring power of the past. The reader is meant to question who Calpurnia Cottonwood is, and how this woman is linked to Carrie Jo.

    Seven Sisters: Mysteries of the American South

    FAQ: Seven Sisters (Seven Sisters Series Book 1)

    • What is the setting of the novel, and how does it influence the story? The novel is primarily set in Mobile, Alabama. The story moves between present day and flashbacks to the 1850s. The historical backdrop of Mobile, particularly its connection to the antebellum South, slavery, and its rich historical society, heavily influences the plot and the mysteries surrounding Seven Sisters plantation and the characters connected to it.
    • Who are some of the main characters, and what are their roles? Carrie Jo Jardine is a central character in the present day and the story is written from her point of view. Other key characters include:
    • Ashland Stuart, the Master of Seven Sisters, a local historian.
    • Mia, Carrie Jo’s best friend, who appears to have some lost unexplained issues.
    • William, Carrie Jo’s sort-of boyfriend.
    • Calpurnia Cottonwood, and Muncie.
    • What are some of the mysteries being investigated in the novel? The story revolves around several interconnected mysteries, including the history of the Seven Sisters plantation and the Cottonwood family, the existence of a possible treasure hidden by Calpurnia Cottonwood, and the strange history of Calpurnia and Muncie.
    • What is the significance of the “Seven Sisters” name? The “Seven Sisters” refers to an old family home/plantation in Mobile. The name may also allude to a Greek myth. There are statues representing gods in the garden.
    • What is Carrie Jo’s primary motivation and how does it evolve throughout the story? Initially, Carrie Jo is looking for a fresh start and a distraction from her personal life. As she becomes more involved in the restoration project at Seven Sisters, she becomes increasingly curious and determined to uncover the mysteries of the place and its inhabitants, both past and present.
    • What are some themes explored in the novel? The novel explores themes of family secrets, historical mysteries, the weight of the past, love, betrayal, wealth, social class, and the complex history of the American South. It also touches upon themes of personal identity and self-discovery.
    • What is the role of history in the novel? History plays a crucial role, serving as both a backdrop and a central element of the plot. The characters are historians researching the area. The history of Mobile, Alabama and the Seven Sisters property are intertwined with the present-day mysteries. The past shapes the present and influences the characters’ actions and relationships.
    • How does the author create suspense and intrigue? The author creates suspense through the gradual unveiling of secrets, the introduction of mysterious characters, and the exploration of historical mysteries. The use of foreshadowing, dream sequences, and the interweaving of past and present storylines further enhance the intrigue and keep the reader engaged.

    Seven Sisters: Book One Details

    The “Seven Sisters” series is a sequence of books. The first book in the series is titled “Seven Sisters”.

    Here are some details from the first book of the series:

    • The prologue is set in Mobile, AL, in 1850.
    • A character named Captain David Garrett is mentioned.
    • The Cottonwoods owned the Seven Sisters. The main antebellum home is examined. The goal was to make Seven Sisters a museum for visitors to Mobile, but the current owner has enough respect for the home’s history to want a proper catalogue of its antiques first.
    • A character named Carrie Jo is referenced throughout the book. She is called an ambulance.
    • A character named Ashland Stuart is also referenced.
    • Muncie held the silver tray tightly. Muncie made Muncia feel a little better about taking his spot.
    • There is mention of the Leahona Meteor shower.
    • The largest piece in the collection was a necklace called The Seven Sisters. It had seven sapphires, with two diamonds, set in the swirling formation of the stars. The stars fell around as one closed her eyes and kissed him back.
    • The Seven Sisters are also referred to as the Pleiades—the Seven Sisters—in the Northern Hemisphere.
    • The place where drama has unraveled for nearly two centuries is located due north of the center statue of the Moonlight Garden.
    • One of the gardens is called the Moonlight Garden.
    • TD was handsome in an earthy sort of way and was excited about restoring the home.
    • The series has some unexplained issues. Seven Sisters was a place where life and death happened, where lost and found things were.

    Mobile, Alabama: History and Lore

    Here’s what the source says about Mobile, Alabama:

    • The prologue of “Seven Sisters” is set in Mobile, AL, in 1850.
    • The goal was to make Seven Sisters a museum for visitors to Mobile.
    • People are going to Mobile.
    • The Seven Sisters mansion is beautiful to put into our history here. “We get some real stories to tell. Did you know that the French settlers used to send little orphan girls over here to marry these backwoods French-Canadians? Poor little things. They used them the Pelican Girls because they landed on Dauphin Island in Pelican Bay. No wait, maybe the ship was called the Pelican”.
    • There was a lot of work going on at Oakleigh, the antebellum over off Government Boulevard. People had hoped that the Hunters would do the same thing with Seven Sisters, but nothing happened. Emily Stuart died sometime around 1985.
    • Comparable to Charleston, Mobile had its charms; at least that’s what the brochures told me.
    • He will return to the Delta Queen before nightfall. You can find me there; I will be in Mobile for another month; I am scheduled to pick up a load of supplies and then head up the river”.
    • According to TD, Seven Sisters was at first built in a T-shaped, Greek Revival style, perfect for keeping the home cool even during Mobile’s hottest subtropical summers.
    • I would love the History of Mobile, but there is so much we don’t know. I feel honored that I get the opportunity to help others remember it like it should be remembered.
    • According to the local historians, Mrs. Cottonwood invested the money in diamonds and sapphires. The largest piece in the collection was a necklace called The Seven Sisters.

    Seven Sisters: Unearthing a Family’s Hidden Treasure

    Here’s what the sources say about family secrets:

    • Someone kept pulling back the covers that hid a hidden treasure, “Calpurnia,” who was suspected.
    • There’s no telling what you will find on that land.
    • Someone thought there would be those who think it may be a clue to a lost family treasure.
    • It felt like collecting evidence for a case that I hoped one day to present to someone who might actually understand.
    • There are some unexplained issues.
    • Seven Sisters was a place where life and death happened, where lost and found things were.
    • The statues of the garden were made of white marble that reflected the moon. During a perfect full moon, the statues shone bright, like a Moonlight Garden. It’s not as mysterious as you think.
    • According to the local historians, Mrs. Cottonwood invested the money in diamonds and sapphires. The largest piece in the collection was a necklace called The Seven Sisters.
    • She kept her own money in her own hands that way: It was the only way women then could.
    • There are all kinds of hazards around here.
    • There are some family close by for the next few months while a beehive for the house and getting up the museum.
    • According to Hooney, the girl was putting on airs because everyone, even the house slaves, knew that she was just a poor relation of no true standing.
    • William had the impression that he was sending Mia some demos out of respect.
    • According to TD, Seven Sisters was at first built in a T-shaped, Greek Revival style, perfect for keeping the home cool even during Mobile’s hottest subtropical summers.
    • “I would love the History of Mobile, but there is so much we don’t know. I feel honored that I get the opportunity to help others remember it like it should be remembered”.
    • The handwriting was intact, with delicate letters.
    • The place where drama has unraveled for nearly two centuries is located due north of the center statue of the Moonlight Garden.
    • It was an old episode of the Lifestyles of the Rich and Famous with Robin Leach, well, okay, maybe not quite that luxurious, but it was close.
    • According to TD some details remain that are worth noting.
    • “What’s interesting is the white crosses you found around the mausoleum are arranged in the exact formation of the statues in the garden”.
    • The Seven Sisters necklace had seven sapphires, with two diamonds, set in the swirling formation of the stars. The stars fell around as one closed her eyes and kissed him back.
    • The current owner of Seven Sisters has enough respect for the home’s history to want a proper catalogue of its antiques first.
    • TD was handsome in an earthy sort of way and was excited about restoring the home.
    • There were two Rachel Kowalski and Rachel McChes, and James Fittman. All of them were excellent archeological students who earned their spots on our team.
    • “Thank you for sharing this with me, Ashland,” someone said.
    • There is mention of the Leahona Meteor shower.
    • “You are a real dream catcher, the real thing, and you don’t even see it?”
    • Someone said that William did not seem like the type at all. Her face was blank, and she said in a low voice, “He’s Ashland Stuart. He’s everyone’s type. He’s also the handsomest guy I’ve met in a certain case. In the case you haven’t noticed, I don’t have a type”.

    Historical Fiction Elements in “Seven Sisters”

    Aspects of historical fiction can be found in the source:

    • The prologue of “Seven Sisters” is set in Mobile, AL, in 1850.
    • References to antebellum architecture and the desire to preserve a main antebellum home for visitors to Mobile are mentioned.
    • There is a mention of French settlers sending orphan girls to marry French-Canadians. They were called the Pelican Girls because they landed on Dauphin Island in Pelican Bay.
    • The story references slavery and mentions house slaves.
    • It references lifestyles of the Rich and Famous.
    • There is mention of the Civil War.
    • A character recalls stories of the old days and can’t sleep without air conditioning.
    • There is also mention of the Leahona Meteor shower.
    • Mrs. Cottonwood invested her money in diamonds and sapphires and kept her own money in her own hands because it was the only way women could do that then.
    • There are mentions of museums and archeological students.
    • A character reads a leather-bound book.
    • There is a description of a T-shaped, Greek Revival style home.
    • There is reference to a Revolutionary War hero.

    Romantic Elements and Reflections

    There are several instances of romantic elements in the source:

    • A woman longed for her lover, desiring that love commanded release and would be fulfilled by her desperate soul of affection.
    • She imagined her lips turned up in a small smile as she imagined her saying, “Run–be free. Be what I can never be!”.
    • She felt an eternal romance for someone.
    • A woman felt herself falling, falling into the blackness of the river and into his outstretched arms.
    • Someone felt a stirring romance in southern evening.
    • There is a reference to a love of life with the dairy, new bride, and smart career woman.
    • A man recalled his details with surreal clarity/ Unwilling to lose even a snippet, he climbed out of the tub and wrapped himself in a cotton robe, half drying my tired body: he didn’t want to peek at my heart.
    • The speaker felt that a perfect world for him would be with Calpurnia at your side for your painting at your age.
    • There is a description of eye contact and an intimate moment of realization.
    • There is mention of candles burning brightly into the night.
    • The stars fell around as someone closed her eyes and kissed him back.
    • A character reflects on a past love, mentioning the end of a relationship and lingering feelings.
    • There are mentions of holding hands and shared glances between characters.
    • A character says, “You do know that for a moment, remembering how perfect the evening had been before all this. You do know that we have to fire her, right?”.
    • A character notes that their best friend appears to have some serious unexplained issues with me. “I’ve lost a sort-of boyfriend and found a gay I really like. I’ve met several ‘ghosts’”.

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • QuickBooks Online: Mastering Customers, Sales, and Vendor Expenses

    QuickBooks Online: Mastering Customers, Sales, and Vendor Expenses

    The text is a tutorial on using QuickBooks Online. It guides users through various aspects of the platform, starting with subscription options and initial company setup. The tutorial demonstrates how to manage customer lists, handle sales transactions, and utilize features like invoices, sales receipts, and credit memos. Finally, the tutorial covers product and service setup, purchase orders, and related reports, providing a comprehensive overview for new QuickBooks Online users.

    QuickBooks Online: A Comprehensive Study Guide

    Quiz

    Instructions: Answer the following questions in 2-3 sentences each.

    1. How can a user access the sample file (Craig’s Design & Landscaping Services) in QuickBooks Online without a subscription?
    2. What are the two primary ways to create an Intuit account when signing up for QuickBooks Online?
    3. Where can users find the sign-out option in QuickBooks Online, and what icon is associated with it?
    4. Why is it important to understand the Chart of Accounts in QuickBooks Online?
    5. Explain the difference between the “Company email” and “Customer facing email” settings in QuickBooks Online.
    6. How can you give another user access to your company file and can that user change the company info or manage subscriptions?
    7. Why should businesses set up a separate liability account for each loan they have?
    8. Explain the difference between “owner investment” and income in QuickBooks Online.
    9. What is the function of sub-customers in QuickBooks, and how does it differ from the desktop version?
    10. What is the purpose of “Undeposited Funds” in QuickBooks Online?

    Quiz Answer Key

    1. Users can access the sample file by navigating to qbo.intuit.com/r/edr/testdrive. This allows them to explore the features using a pre-populated company file without needing a paid subscription.
    2. Users can create an Intuit account by signing up with a Google account or by using an email address and creating a password. This centralizes their Intuit product logins.
    3. The sign-out option is located in the top right-hand corner of the screen, accessible by clicking on the gear icon. This ensures secure access control.
    4. The Chart of Accounts is the backbone of all accounting in QuickBooks. It categorizes where money is spent and received and is necessary for generating accurate financial reports.
    5. The “Company email” is a private email address used for internal communications from Intuit, while the “Customer facing email” is the email address customers see. The latter can be redirected to the company email for ease of management.
    6. Give another user access by going to Gear Icon > Manage Users > Add User. Administrators control user permissions, and an employee cannot change company info or manage subscriptions unless permission is granted to them by the adminstrator.
    7. Setting up separate liability accounts for each loan allows businesses to accurately track the principal and interest payments for each debt. This helps monitor individual loan balances and payment progress.
    8. “Owner investment” refers to personal funds the owner puts into the business, which is considered equity, not income. Income is revenue generated from business operations.
    9. Sub-customers are used to organize jobs or projects related to a main customer, enabling detailed tracking of income and expenses for each project. In the desktop version of QuickBooks, these are often called “jobs”.
    10. “Undeposited Funds” serves as a temporary holding account for payments received from customers before they are deposited into a bank account. This is a useful holding pattern when you collect money and plan to make a bulk deposit at the end of the day.

    Essay Questions

    1. Discuss the importance of customizing QuickBooks Online settings through the gear icon, providing specific examples of how these customizations can improve efficiency and accuracy for different types of businesses.
    2. Explain the process of setting up a new company file in QuickBooks Online, including the steps involved in the easy step interview, and discuss the significance of accurately answering the initial setup questions.
    3. Describe the different types of accounts in the Chart of Accounts, and explain how each type affects the accuracy of financial reports.
    4. Analyze the benefits and drawbacks of using the sales receipt versus invoice features in QuickBooks Online, and provide scenarios in which each method would be most appropriate.
    5. Evaluate the utility of the tagging feature in QuickBooks Online, explaining how tags can be used to track specific aspects of a business and improve reporting capabilities, and compare it to QuickBooks’ “classes” feature.

    Glossary of Key Terms

    • Chart of Accounts: A list of all the accounts used to categorize financial transactions in QuickBooks Online.
    • Company File: A QuickBooks term for the data file that contains all of a company’s financial information.
    • Dashboard: The main screen in QuickBooks Online that provides a quick overview of a company’s financial performance.
    • Intuit Account: A single login that allows access to multiple Intuit products and services.
    • Navigation Pane: The menu on the left side of the QuickBooks Online interface that provides access to different areas of the program.
    • Sales Receipt: A record of a sale where the customer pays at the time of purchase.
    • Invoice: A bill sent to a customer requesting payment for goods or services.
    • Accounts Receivable: The money owed to a company by its customers.
    • Accounts Payable: The money owed by a company to its vendors.
    • Undeposited Funds: A temporary holding account in QuickBooks for payments received but not yet deposited into a bank account.
    • Credit Memo: A document issued to a customer that reduces the amount they owe, usually due to a return or service issue.
    • Refund Receipt: A record of money returned to a customer for a purchase.
    • Statement: A summary of a customer’s account activity, including invoices, payments, and balances.
    • Tags: Customizable labels used to categorize transactions for detailed reporting and tracking.
    • Product and Service: A sellable item or billable service provided by a business.
    • Purchase Order: A document sent to a vendor requesting an order of goods or services.
    • SKU (Stock Keeping Unit): A unique identifier for a product or service.
    • Inventory: Goods held for sale to customers.
    • Vendor: An individual or company from whom a business purchases goods or services.
    • Sub-customer: A customer that is a sub-division of a main customer, enabling job or project tracking.
    • Equity: The owner’s stake in the company.
    • Liability: A debt or obligation owed to others.
    • Asset: A resource controlled by the company as a result of past events and from which future economic benefits are expected to flow to the company.
    • Accrual Basis Accounting: Recognition of income when earned and expenses when incurred, regardless of cash flow.

    QuickBooks Online: Setup, Navigation, Customer Management, and More

    Okay, here’s a detailed briefing document summarizing the key themes and ideas from the provided text excerpts.

    Briefing Document: QuickBooks Online Overview and Key Features

    Executive Summary:

    This document summarizes key functionalities within QuickBooks Online (QBO), focusing on initial setup, navigation, customer and vendor management, sales transactions, product/service inventory, and reporting. It highlights the use of sample files for practice, the process of creating and customizing a new company file, managing customers and vendors, handling sales transactions, managing inventory with purchase orders, and utilizing reports to understand your business.

    1. Introduction and Initial Setup

    • Theme: Getting started with QuickBooks Online.
    • Key Ideas/Facts:Sample File: Users can experiment with a sample file (“Craig’s design & landscaping services”) without a subscription. Access via “QBO dot Intuit comm /r e dr forward slash test drive.”
    • 30-Day Free Trial: A 30-day free trial is available by signing up.
    • Intuit Account: Creating an Intuit account (using Google or email) is required. Mobile number is recommended for account recovery.
    • Company File: Each QuickBooks file is a “company.” Users can have multiple companies.
    • EasyStep Interview: QBO uses an “easy step interview” to gather initial company information and configure settings.
    • Dashboard: The dashboard provides a quick overview of different company areas.
    • Logging In/Out: Use the gear icon in the top right to sign out. To log back in, go to QuickBooks.Intuit.com and select “Sign In.”

    2. Navigation and Customization

    • Theme: Understanding the QBO interface and customizing company settings.
    • Key Ideas/Facts:Gear Icon: The gear icon provides access to customization options, tools, and company settings.
    • Chart of Accounts: “Everything in QuickBooks will run through the chart of accounts.” It is accessible via the gear icon.
    • “New” Button: The “New” button (formerly located near the gear icon) is for creating new transactions.
    • Account Settings: Accessible through the Gear Icon.
    • Company Information: Allows editing of company name, legal name, industry, email addresses (customer-facing vs. company), phone number, website, and addresses.
    • Billing and Subscription: Used to upgrade QBO subscriptions. Subscription levels have limits (e.g., users, chart of account items, classes/locations).
    • Usage: Helps to monitor limits to the subscription level.
    • Sales Tab: Has customisation settings that help to manage how sales are processed.

    3. User Management

    • Theme: Adding and managing users within QBO.
    • Key Ideas/Facts:Multiple Users: Different QBO subscriptions allow for a different number of users.
    • User Permissions: Administrators can assign different levels of access. It is critical that administrators know usernames and passwords.
    • Invitation Process: New users receive an email invitation and set up their own username and password.
    • Audit Trail: Can be reviewed under Reports.

    4. Chart of Accounts

    • Theme: The fundamental role of the chart of accounts in QBO.
    • Key Ideas/Facts:Core Accounting Structure: The chart of accounts is “the backbone of all accounting,” a listing of where money is spent or received.
    • Account Types: Important account types include:
    • Bank Accounts: (Checking, Savings, PayPal, Square).
    • Assets: (Fixed Assets like vehicles, furniture, and current assets like inventory). Group assets into “big bucket categories.”
    • Liabilities: (Loans – separate accounts for each loan, Credit Cards – separate for each card).
    • Equity: (Owner draws, Owner contributions).
    • Income Accounts: (Sales income).
    • Cost of Goods Sold
    • Expense Accounts:
    • Sub-Accounts: Can be created under main accounts (e.g., “Fuel” as a sub-account of “Car and Truck”).
    • Opening Balance: A starting balance creates debit and credit entries.

    5. Customer Management (Accounts Receivable)

    • Theme: Managing customer information and sales transactions.
    • Key Ideas/Facts:Navigation: Access customer lists via the “Sales” tab on the navigation bar.
    • Customer List Overview: Includes open invoices, overdue amounts, payments in the last 30 days, unbilled activity, and estimates.
    • Customer List Features: Sorting, email links (if email address is present), phone number, open balance, actions (creating statements/invoices).
    • Search Function: Ability to search for customers.
    • Batch Actions: Option to email multiple customers or make them inactive.
    • Adding New Customers: Requires entering company name (if applicable), name, display name, email, phone number, billing address (and shipping address if different).
    • Sub-Customers: Used for different jobs/projects for a customer.
    • Editing Customer Information: You cannot delete customers. You can only make them inactive. Customer information can be edited.
    • Customer Details Tabs: Include notes, transaction list, projects, customer details, and late fees.
    • Customer Custom Fields: Options include preferred payment method, payment terms, opening balances, language, attachments, and additional info.
    • Inactive Customers: Hiding customers from the list.
    • Importing Customers: Import customer lists from Excel or CSV files.

    6. Sales Transactions

    • Theme: Recording sales to customers.
    • Key Ideas/Facts:Sales Overview: A quick overview of income over time, overdue invoices and bank accounts.
    • Sales Transactions: Can be reviewed for each customer and each transaction
    • Sales Receipts: Used when customers pay immediately.
    • Invoices: Used when sending invoices and payment occurs at a later date.
    • Sales Receipts Details:Customer information.
    • Billing address.
    • Date.
    • Payment method.
    • Product/service details (description, quantity, rate, tax).
    • Discounts.
    • “Undeposited Funds” account.
    • Invoice Details:Customer selection.
    • Email options (including sending later).
    • Billing address.
    • Invoice date and due date.
    • Product/service details (description, quantity, rate, tax).
    • Attachments.
    • Discounts.
    • Receiving Payments: Record how much customers paid, the date paid and when completed the invoice will show as paid.
    • Deposits Deposits must be made separately, particularly if multiple payments contribute to a single deposit. Money goes into the checking account.
    • Credit Memos Used to credit an invoice.
    • Refunds Used when you want to issue a refund to a customer that has purchased something and paid in full.
    • Statements: Gentle reminders that they owe money, shows all activity.

    7. Tags

    • Theme: Categorizing customers.
    • Key Ideas/Facts:Tags: new feature that allows the user to create certain words that will appear on a drop-down when you are in different transactions in QuickBooks.
    • Tag Groups: Allows the user to put tags into groups.

    8. Products and Services

    • Theme: Adding products and services
    • Key Ideas/Facts:Sorting: Sort products and services by type.
    • Non-Inventory: Physical items that you buy and sell.
    • Service: Service you provide.
    • Inventory Product: Tracking physical items.
    • Bundle: Combine items together.
    • SKU: Put in the SKU.
    • Income account: Account you want money to go back to.
    • Preferred vendor: Vendors you prefer.
    • Purchase Orders: Track what you have ordered.
    • New bills: Create a new bill
    • Open purchase order: Order you need to pay.

    9. Reporting

    • Theme: Reports to analyze information
    • Key Ideas/Facts:List of reports: Report for vendors and customer
    • Open purchase order detail: Report for vendors and customer
    • Customization: Can change the information in the report.
    • Filter options: Can look at all accounts.
    • Accrual basis: All reports are run on the accrual basis.

    Note: This briefing document is based solely on the provided text excerpts and does not represent a complete guide to all QuickBooks Online features.

    QuickBooks Online: Setup, Navigation, and User Management

    QuickBooks Online FAQ

    • How can I explore QuickBooks Online without a subscription?
    • You can use a sample company file, “Craig’s Design & Landscaping Services,” without needing a subscription. To access it, go to QBO.Intuit.com/r/edr/testdrive. You’ll need to verify you’re not a robot. The data in the sample file is updated daily, and you will be working with information from 2021.
    • How do I set up a new QuickBooks Online account?
    • Navigate to the QuickBooks website where the online subscriptions are displayed. Choose a subscription or sign up for the 30-day free trial. To create an Intuit account, you can sign up with a Google account or an email address. Providing a mobile number is recommended for account recovery purposes. Create a strong password with at least 8-12 characters, including uppercase and lowercase letters, and special characters. Then you will start the easy step interview that will ask you about your business, such as its name and industry, and set up the company file for you.
    • How do I log in to QuickBooks Online once my account is set up?
    • Go to the QuickBooks Online website (QuickBooks.Intuit.com) and click “Sign In.” If you are using a trial subscription, just use the “QuickBooks Online” option. Then, enter your Intuit account username and password.
    • What is the dashboard and how do I navigate QuickBooks Online?
    • The dashboard provides an overview of your company’s performance. The navigation pane on the left side of the screen is used to access different sections, such as banking, expenses, sales, workers, reports, accounting, and apps. Each option will provide another set of options related to the original choice.
    • How do I customize QuickBooks Online settings?
    • Click the gear icon in the top right corner to access the settings menu. Here, you can customize various company settings such as the chart of accounts, address, contact information, sales settings and add users.
    • How do I add and manage users in QuickBooks Online?
    • Go to the gear icon, select “Manage Users,” and then “Add User.” Choose the user type and specify access rights. Enter the new user’s first name, last name, and email address. QuickBooks will send an invitation email with instructions for setting up their account.
    • What is the Chart of Accounts and why is it important?
    • The Chart of Accounts is a comprehensive listing of all accounts used to categorize financial transactions. It’s the backbone of QuickBooks, as every transaction flows through these accounts. It defines where money is spent (expenses) and where money is received (income). To access it, click the gear icon and choose “Chart of Accounts.”
    • How do I manage customers in QuickBooks Online?
    • To access customer information, go to “Sales” and then “Customers” in the left navigation pane. Here you can view open invoices, overdue amounts, and payment history. You can add new customers by clicking “New Customer”. You can edit customer details, including contact information, billing/shipping addresses, preferred payment methods, and payment terms.

    QuickBooks Online: Features, Setup, and Management Guide

    QuickBooks Online is a paid subscription service that allows you to access your company file from any location with internet access. It is designed to help you manage various aspects of your business finances.

    Key aspects of QuickBooks Online:

    • Accessibility: QuickBooks Online allows access to company files from any device with internet.
    • Accounts Receivable: Manages customer-related transactions, including creating invoices and recording payments.
    • Accounts Payable: Tracks and manages bills to monitor how much is owed.
    • Products and Services: Helps set up and manage physical products and services.
    • Payroll: Includes tools for managing payroll.
    • Mobile Devices: QuickBooks Online works with mobile devices, allowing users to manage their business on the go. Mobile apps are available for both Android and iPhone.
    • Company Files: Each file created in QuickBooks is called a company, and multiple company files can be created.
    • User Interface: The dashboard provides a quick overview of the company’s performance. The navigation pane on the left provides access to various features.
    • Customization: QuickBooks Online allows customization of various settings to fit the specific needs of a business. The gear icon provides access to customization options.
    • Chart of Accounts: The chart of accounts is the backbone of all accounting in QuickBooks. Every transaction in QuickBooks flows through the chart of accounts.
    • Sales Transactions: Manages sales transactions, including invoicing customers, receiving payments, and making deposits.
    • Customer Management: Manages customer lists and related transactions.
    • Inventory Management: Manages inventory, tracking quantities on hand and reorder points.
    • Vendor and Expense Management: Manages vendors and expenses, including purchase orders.
    • Reporting: Offers a variety of reports to provide insights into your business finances.

    Subscription Options and Costs:

    • There are multiple subscription options available, each with different features and monthly fees.
    • The Simple Start subscription is the most basic and is suitable for new businesses.
    • The Essentials, Plus, and Advanced subscriptions offer additional features and capabilities.
    • The Plus subscription is the most popular.
    • The number of users that can access the online version depends on the subscription.
    • QuickBooks Online is not free; it requires a monthly subscription.
    • A free 30-day trial is typically available.

    Setting up QuickBooks Online:

    • To begin using QuickBooks Online, you must sign up for one of the subscription services.
    • You can sign up for a 30-day free trial.
    • During the setup process, you’ll be asked to provide information about your business.
    • QuickBooks will guide you through an easy step interview to gather information and set up your company file.
    • You can import data from a desktop version of QuickBooks.

    Mobile Apps:

    • QuickBooks Online offers mobile apps that sync with the online version.
    • These apps allow you to manage your business on the go.
    • You can create invoices, track expenses, and perform other tasks from your mobile device.
    • The apps may not have all the features available in the online version.

    Sample Company File:

    • QuickBooks Online provides a sample company file called Craig’s Design & Landscaping Services that you can use to explore the software.
    • The sample file is updated every day, allowing you to practice with current data.

    Customizing QuickBooks Online:

    • The gear icon provides access to various customization options.
    • You can customize your company settings, manage users, and access other tools.
    • It is important to understand the chart of accounts and how it works.
    • You can enable account numbers in the chart of accounts.

    Users:

    • Each person using QuickBooks should have their own login.
    • The administrator can add, edit, or delete users.
    • The number of users depends on the subscription.
    • You can limit users’ access to certain areas of QuickBooks.

    Sales Transactions:

    • QuickBooks Online allows you to manage sales transactions, including creating invoices, receiving payments, and making deposits.
    • You can create sales receipts for immediate payments or invoices for later payments.
    • You can record customer payments and apply them to specific invoices.
    • You can make deposits to record the transfer of funds to your bank account.
    • You can create credit memos for customers.
    • You can issue refunds to customers.
    • You can create and send statements to customers.

    Products and Services:

    • QuickBooks Online allows you to set up and manage products and services.
    • You can create inventory products, non-inventory products, and services.
    • You can track quantities on hand, set reorder points, and manage inventory.
    • If the inventory feature isn’t available, consider upgrading to Plus or Advanced.

    Vendors and Expenses:

    • You can manage vendors and expenses in QuickBooks Online.
    • You can create purchase orders to order products from vendors.

    Reporting:

    • QuickBooks Online offers a variety of reports to provide insights into your business finances.
    • Reports can be customized to show specific data and time periods.
    • Common reports include open invoices, customer balance details, and sales by customer.

    QuickBooks Online is constantly evolving, so the options may change or move over time. To stay updated you can log into QuickBooks.Intuit.com/blog to see recent changes.

    QuickBooks Online: Subscription Options and Features

    QuickBooks Online requires a paid monthly subscription, with four different subscriptions available. Here’s what you should know about them:

    • Pricing and Discounts: The monthly fee for each subscription can change, but discounts such as 50% off for the first three months are often available.
    • Free Trial: A 30-day free trial is offered for each subscription, allowing you to test the software before purchasing.
    • Subscription Levels and Features:
    • Simple Start: This is the most basic subscription, best for new businesses with few customers. It’s a good starting point and you can upgrade as needed.
    • Essentials: This level lacks the inventory feature and job tracking profitability, and batch invoices.
    • Plus: The Plus subscription is the most popular. However, it lacks options for importing and sending batch invoices as well as business analytics and insights options.
    • Advanced: This subscription includes all available features, such as importing and sending batch invoices and business analytics.
    • Upgrading and Downgrading: It’s possible to switch between subscriptions as your business needs change. For example, you may need to upgrade to allow more users to access QuickBooks, or for inventory management.
    • Considerations for Choosing a Subscription: Factors to consider when choosing a subscription include the number of users needing access, the need for inventory management, and whether you require advanced features like batch invoicing or business analytics. If unsure, contacting QuickBooks directly is recommended to determine the best fit for your business.

    To view the current subscriptions, navigate to QuickBooks.Intuit.com. You can also upgrade your existing subscription within QuickBooks.

    QuickBooks Online: Company Files and Setup Guide

    Here’s what the sources say about company files in QuickBooks Online:

    • Any file that is created in QuickBooks is called a company file.
    • A user can have as many company files as they want.
    • Often, a small business owner might set up one company with their personal information and another company that has the business information.
    • Company files do not interact with each other, so there is no concern about data being mixed up between them.
    • When setting up QuickBooks, it will launch an easy step interview that will ask questions and, based on the answers, it will set up the options in the company file.
    • The setup process involves providing basic information such as the name and type of business.
    • After creating a company file, there is still more to do because it is initially a blank file.
    • After the basic setup, the user is taken to the dashboard, which provides a quick overview of the company’s performance.
    • A sample company file, Craig’s Design & Landscaping Services, is available to play with.
    • To access the sample file, navigate to QBO.Intuit.com /r e dr forward slash test drive.
    • It is not necessary to sign up for a subscription to access the sample file.
    • The sample file is updated every day, and it is set in the year 2021.
    • If you have been using the desktop version of QuickBooks, you can upload your company file to QuickBooks Online.
    • To upload a company file from the desktop version, open the company file in the desktop version, go to the company menu, and select “Export Company File to QuickBooks Online”.
    • If the “Export Company File to QuickBooks Online” option is not available, it means that updates are needed in the desktop version of QuickBooks.
    • After exporting the company file, run a profit and loss report and a balance sheet in both the desktop and online versions to compare the data.
    • If the data is not the same, try exporting the company file again.
    • When logging in, users are given the option to sign up with a particular subscription.
    • If still using the 30-day free trial, use the QuickBooks Online option to log in.

    QuickBooks Online: Mastering the Chart of Accounts

    Here’s what the sources say about the chart of accounts in QuickBooks Online:

    • The chart of accounts is the backbone of all accounting in QuickBooks Online. Every single transaction flows through one of the accounts listed in the chart of accounts.
    • The chart of accounts is a listing of different areas where money is spent or received. It is important to ensure information goes into the correct categories for accurate reports.
    • To access the chart of accounts, navigate to the gear icon and then select “Chart of Accounts”. Another way is to go to the left navigation bar and click on “Accounting”.
    • The first column is the name of the account, which can be customized. The second column shows the type. The names are alphabetical within each type. The “Detail Type” column provides more information about the type chosen. It also shows QuickBooks balance and bank balance.
    • Account Types:
    • Bank Accounts: These include checking, savings, money market accounts, PayPal, and Square.
    • Assets: These are things the business owns. Assets can be fixed (long-term, like vehicles or property) or liquid/current (like inventory).
    • Liabilities: These are debts the business owes. They can be long-term (paid over more than 12 months) or short-term/other current liabilities (paid in under a year). Set up a separate account for each loan.
    • Credit Cards: These are for business credit cards. Set up each credit card account separately to track them properly.
    • Equity: This reflects the owner’s stake in the company. Owner draws are when the owner takes money out, and owner contributions are when the owner puts money in.
    • Income: This is where sales income is tracked.
    • Cost of Goods Sold: These are the costs of the products or services a business sells.
    • Expenses: This is a large grouping of expense accounts.
    • To add a new account, click “New”. Pick the account type and then the detail type that closely matches.
    • Subaccounts: To add subaccounts, the type has to be the same as the main account. Design the list so that it provides the needed level of detail without being overwhelming.
    • Starting Balances: When adding a new account, a start date and beginning balance is needed. For a checking account, this would be the ending balance on the last bank statement. The other side of this transaction goes to “Opening Balance Equity”.
    • You can enable account numbers by going to the gear icon, then “Account and Settings,” then “Advanced”. Turn on “Enable account numbers”. A new column will appear at the beginning of the chart of accounts to add the numbers.

    QuickBooks Online: Recording Sales Transactions, Invoices, and Payments

    Here’s what the sources say about sales transactions in QuickBooks Online:

    • There are a couple of different ways to record a sale to a customer. One way is to create a sales receipt and the other is by invoicing customers.
    • Any transaction that happened with a customer will be listed under the sales tab. You will see information on invoices, payments, credit memos, time charges, sales receipts or refunds.
    • Under the invoices tab you will see all the information on any sales transactions.

    Sales Receipts

    • Creating a sales receipt is almost like a point-of-sale transaction.
    • If a customer comes in, makes a purchase, and pays the money right then, you can put all of that on one transaction and provide them with a receipt.
    • To create a sales receipt, go to your customer list, find your customer, and select create a sales receipt.
    • Here you can enter the customer’s email, billing address, and the sales receipt date.
    • Then you can select the product/service that the customer is purchasing.
    • You will be able to edit the description, quantity, and rate.
    • Below this, you can enter a message that will be displayed on the sales receipt and on statements.
    • On the right, you can see the subtotal and the total subject to sales tax.
    • At the bottom, you will be able to see the amount received and the balance due.
    • Because it is a sales receipt, it is assumed that you have received all of the payment.
    • At the top, you can choose the payment method.
    • The next thing you’ll see is deposit to undeposited funds. In your chart of accounts there is an account called undeposited funds, this is where money sits that you’ve collected but you have not yet taken to the bank.
    • When you’re finished, you can save, save and send, or save and close.

    Invoices

    • The invoice is where you will send an invoice to your customer and wait for payment at a later date.
    • You may email or mail these.
    • To create invoices, go to the navigation pane and select sales.
    • You can either use the invoice option or the customers option.
    • If you select invoices, you can choose new invoice.
    • If you select customers, you can select a customer, go to the action column, and create an invoice.
    • If you are using sub-customers, always pick the sub customer.
    • You can change the customer email and billing address.
    • If you select send later, you can create the invoice, save it, and then email it at a later time.
    • You can change the invoice date and due date.
    • Select a product or service from the list to invoice your customer.
    • Remember that a service is non-taxable.
    • You can add an attachment.

    Receiving Payments

    • After you have sent the invoice, you will want to record the payment when it is received.
    • To do this, navigate to sales and then customers.
    • In the action column, select receive payment.
    • Here you can select the payment date and method.
    • Then you can select where to deposit the funds.
    • You can deposit the funds to the undeposited funds account or directly into the checking account.
    • Then save and close.

    Making Deposits

    • The make deposits option is always going to be the last step in this process, no matter how you receive the payment.
    • You want to make sure that your deposits in QuickBooks match what actually happened at the bank.
    • To record the deposit, select new and then bank deposit.
    • Make sure you have the correct bank account chosen.
    • Check off all of the monies that are going in this deposit.
    • You can also add funds to this deposit.
    • Then, save and close.

    Credit Memos

    • There are times when you will want to issue a credit memo to an invoice.
    • For example, if a customer is not happy with your services, you can issue a credit memo.
    • To do this, first, look up the original invoice.
    • Then, go to new and under customers, select credit memo.
    • Plug in the customer’s name.
    • Make sure you put the date you would like.
    • Under product/service, enter the same product or service that was on the original invoice.
    • Then, save and close.
    • Then, go to the payment and apply the credit memo to the correct invoice.

    Refund Receipts

    • There may be times where you have to give your customer a refund.
    • To do this, go to new and under customers, select refund receipt.
    • Select the customer you need to give a refund to.
    • Plug in the date and the refund method.
    • Select the product/service to refund.
    • Then, select save and print.

    Statements

    • One of the things you have the ability to do in QuickBooks is send statements to your customers.
    • A statement is basically a gentle reminder to your customers that they owe you some money.
    • Typically statements are sent at the end of each month.
    • To create statements, go to new and under other, select statement.
    • Pick a statement type, statement date, and customer balance status.
    • Then, apply.

    Tags

    • Tags will allow you to create certain words that will appear on a drop-down when you’re in different transactions in QuickBooks and you can choose those.
    • You can also create tag groups.
    • You can use these tags in any transaction.
    QuickBooks Online Tutorial: QuickBooks Online for Beginners – 3+ Hours!

    The Original Text

    hello welcome to QuickBooks Online my name is Cindy macdougan and I’m going to help walk you through this series of videos I wanted to take a few moments in this introduction video and just give you a little bit of information about what to expect as you go through the course and also let you know a little bit about myself and my background I’ve actually been a software trainer for about 20 years I teach a lot of different types of software QuickBooks being one of those I’m also a QuickBooks consultant I work with both the desktop and the online version I’m going to be able to relay some information about both as we go along but more importantly we’re talking about the online version here the online version has an advantage and that is that you’ll be able to access your company file from anywhere you happen to be that has internet access if you work out in the field for example you might have your laptop with you or need to access it through your phone and these are great reasons to sign up with a subscription for the QuickBooks online service we’re gonna actually take this from the very beginning I’m not going to assume you know anything I’m gonna actually start off showing you how to go online and pick the correct subscription we’re talk a little bit about working with QuickBooks Online and mobile devices and then we’ll take it from there and start actually setting up our company file we’re going to work with customers that side of things is called accounts receivable you’ll need to know how to create invoices what to do in the customer pays you how to actually put that money in the bank we’re also going to talk about the flip side which is your accounts payable that’s anything that has to do with the bills that come in the mail that you have to pay you’ll want to track those so that you know at any time how much you owe we’re going to be going through and talking a little bit about products and services those are physical things and sometimes you’re a service you provide but sometimes you buy products and you also sell products and we need to know how to set this up properly we’ll be looking quickly a payroll there’s a lot of other things we’ll look at but I want you to have a really good foundation for building your company file from the very beginning when you watch these videos make sure you watch them in order they won’t make very much sense if you get them out of order make sure you watch them all and make sure you watch them till the very end because a lot of times there’s a really good piece of information right at the very end of one of these videos if you have questions as we go along feel free to shoot us an email and we’ll get right back to you and answer your questions with that being said let’s go ahead and get started we’re going to flip over to section two and talk about the different subscriptions that you have available when you decide to go with QuickBooks Online thanks for coming back we are just getting started and the very first thing you’ll need to do before you start using QuickBooks is actually sign up with one of their subscription services it is not free to use the QuickBooks Online you do have to pay for it monthly and they have four different subscriptions that you can subscribe to I want to go ahead and pull up the website so that you can actually look and compare the different ones with me as we go through this alright what you’ll want to do is make sure you navigate to QuickBooks Intuit calm and you’ll see this screen right here which will give you a lot of different information on their subscription services one thing I want to point out is that they do have a try it free for 30 days for each of these that way you can see if you like it before you actually jump in and make a purchase I want to scroll down here because you’ll notice that this is where they have the different subscriptions listed and I want to compare these with you the pricing that you see here may change depending on when you watch this video you’ll notice for each of these that they have a monthly fee and right now you can say 50% off if you sign up for this three months at a time the simple start is the really basic one that you’ll want to start with if you’re a brand new business and you don’t have a lot of customers maybe not a lot going on with your business yet it’s great to start with this one and then you can always upgrade as you need more of the features let me go ahead and go through some of these features with you you’ll notice for the simple start that you can only have one user and that basically means that only one person can log in with that username and password if you need more you’ll notice that if you look at the essentials you can have up to three users the plus has up to five and then you can have up to 25 if you’re actually using the advanced let me scroll down a second because I want to show you that there are a lot of really good things about the Simple Start you’ll see for example that in addition to multiple users you can track your coming expenses they’ll all let you do that all of these will help you maximize your tax deductions they’ll all have mileage invoicing and accepting payments they’re all going to have reports as well but you’ll notice that the simple start and the one that’s to the right of it only give you the basic reports where if you need some more advanced reporting then you’ll want to go with these two over here which are the plus and the advanced and even with the basic reports you’re going to have a lot of reports quickbooks was really good about reporting you can do estimates in all of these if you think about a construction company you would want to actually estimate a job before you actually start doing the work and getting paid for it and that’s a really great feature they all have let me see scrolling down here you’ll notice that you can track sales and sales tax in all of these you can capture and organize your receipts mean you can scan them in you can also manage 1099 contractors in all of these and that’s really important because those are what you call your subcontractors and you need to know how to properly handle those you’re going to be able to actually manage the bills if you go with the essentials the plus or the advanced so notice that if you have the simple start you can’t handle the bills in QuickBooks and to me that’s really important because you want to track everything you owe because you’re going to need to really stick to your budget when you first start your business you cannot track time if you have simple start or you can’t do what they call tracking job profitability in the simple start even though like I said this is great for a new business starting out you’ll quickly want to upgrade to one of the others moving on to the essentials the essentials just doesn’t have the inventory feature the job tracking profitability you can kind of see the things here does not have you can’t send batch invoices and really if you don’t do a lot of these that may not be important to you the one that sometimes people want is the inventory feature and you would have to upgrade to the plus or the advanced to get that you’ll notice that the plus is the most popular one and it does not have the options for importing and sending batch invoices it doesn’t have the business analytics and insights options but you may not need these if you do want all of that you’ll want to go up to the advanced subscription here the other thing I want you to know is that you may go back and forth with these subscriptions because it could be that you add users like we saw earlier and you need to have maybe four people accessing your QuickBooks so as a lot of different things you need to think about and you can always call them if you’re really not sure which one would work best for your business I wanted you to be aware of that because the next thing you’ll have to do is actually start with one of these and you can actually choose to go ahead and buy now or like I showed you earlier you can go up to the top of the screen and you can actually try it free for 30 days and that’s where I want to stop right now we’re going to go through and talk about setting up your company file after you pick a subscription / module – but before we do that I want to briefly talk to you a little bit about how QuickBooks Online works with mobile devices over in section 3 I’ll see you there shortly before we go ahead and wrap up module one I wanted to briefly talk to you a little bit about some things QuickBooks does with the online version and how mobile devices actually work with QuickBooks Online the first thing I want you to know is that your online version is constantly evolving you might log in one time and be used to where a particular option happens to be and the next time you log in it may not be there at all or may be in a different location or look different when they rule out the changes they do not roll them out across the board for everyone at the same time that’s why your friend may have a version and he or she does not see the updates that you see but you’ll eventually get there the other thing I want to mention is that you have the ability to use different mobile apps for QuickBooks and they synch with QuickBooks depending on if you have an Android or an iPhone you can just go into your Play Store go into the app store in your iPhone and just look for that QuickBooks apps and you’ll notice that if you download one of them you can be able to take it out on the field with you and for example if you need to create an invoice out in the field you can do it right there on your phone and it will sync with your actual online version now the apps will not have all of the options that are available but they will have the basic most common ones that you would want to use go ahead also and look in your app store and see if there are other software apps that aren’t made by into it but would work well with QuickBooks and it might be something that you might need in your business so there’s all kind of apps that work with QuickBooks I just want to make you aware of that and if you ever wanted to just get a handle on what some of the changes are that they’re making in your version you can actually log into QuickBooks Intuit comm /blog and then you’ll be able to see all of the changes and stay on top of what’s new that’s going to wrap up module one let’s go ahead and jump into module two and start talking a little bit about working with the company files that you have to set up in QuickBooks we’re starting to work in module two now and this is where we’re going to talk a little bit about the QuickBooks company files anytime you create a file in QuickBooks it is called a company you can have as many companies as you would like often what you will see as a small business owner might set up one company with his personal information and another company that has the business information company files do not talk to each other you don’t have to worry about the data getting mixed up and like I said you can have as many as you’d like in QuickBooks you have to either create a brand new one which we’ll do in Section three you might already have the desktop version of QuickBooks and you want to upload your file to the online version we’ll look at that in Section two but real quick what I want to talk to you about here is the fact that you do have the availability of a sample file that you can go in and play with as much as you want you do not have to sign up with a subscription or anything like that to access the sample file all you have to do is head on over to QBO dot Intuit comm /r e dr forward slash test drive and the company file you’re going to be working with here is Craig’s design and landscaping services it is a service based business let’s go ahead and head on over there and we’ll check out Craig’s design & landscaping services the first thing you will have to do is just verify your real person I’m going to check the box I’m not a robot and then in this case it asked me to pick all the bicycles I’m gonna go through the list and make sure I got them all and I’ll hit verify now it knows a real person and I can access Craig’s design and landscaping services now while this is pulling up let me just mention a couple of other things about the sample file every day they update the date so you’ll see that date change you’re actually going to be working in the year 2021 in the practice exercise so just kind of know that when you go in here and this is what QuickBooks looks like when you first open it up now I do want to go through this Green and get you familiar with everything but I want to do that over in Section four before we actually go through this I want to show you how to upload your data if you wanted to bring your desktop file over or in section 3 talk about creating a new file so we’ll come back to Craig’s design & landscaping services a little bit later right now I want you to head over to section 2 and let me show you how to upload your QuickBooks desktop files to the online version okay we’ve already looked at some of the sample files that QuickBooks has we now need to talk about how do you actually go through and set up your new quickbooks online account all we’re going to do is navigate to where we looked at the different online subscriptions over a module one and then we’ll go ahead and decide which of those subscriptions we’d like to sign up with or we can sign up with a 30-day free trial let me go ahead and flip over and we will sign it for that 30-day free trial to show you how this works as you can see I’ve navigated back to QuickBooks to accom I think I’ll take advantage of the free 30-day trial I’m going to use this link right here if you see a pop-up that asks you if you’d like to sign up with the 30-day free trial you can use that option as well what I’m going to have to do here is create and intuit account and I can do this a couple of different ways I can actually sign up with Google and if I have multiple Intuit products then I can go ahead and use that one login for all of them I might also choose to use an email address and sign up that way I think I’ll go ahead and do that and use one that I just set up for this and it’s got my name here also it asks you to plug in your mobile number that’s recommended but you don’t have to and the reason that you may want to go ahead and do that is if you happen to forget your username or your login information and – it can help you recover that information by looking at your telephone number that you’ve plugged in you will want to create a password and make sure it’s something that you’re going to remember but hard enough that someone else can’t actually try to get into account remember a good password anywhere in your computer will have at least eight to twelve characters you’re gonna have a combination of capital letters small letters you might have special characters I’m gonna go ahead and choose a sign up with email once I’m done and this is going to create my intuit account I do get the option to skip the trial and go ahead and purchase my subscription but I think I’ll go ahead and continue with the trial for now what’s going to happen now is it’s going to start setting up what we call our company file each file in QuickBooks is called a company you can have as many companies as you like in QuickBooks this is going to launch us through what’s called the easy step interview where it’s going to ask us some questions and based on how we answer those questions it will set up all the options in our company file for us first we’ll see some basic information it wants to know what is the name of your business I’m gonna call mine a BC services and then the next thing it will ask us is to describe the type of business you do now if you start typing in things like plumbing electrical things like that then it’s going to start pulling from a drop-down list and looking for those first few characters there and if you see something close to what you do on the list just choose it there’s no wrong answer here just choose something close to what you do I’m gonna pick for example services and you’ll notice that there are several types of services that it thinks I may want to choose from I’ll just pick professional services in this case another thing that you have an option to do is if you’ve been using the desktop version of QuickBooks and you’d like to bring that data into your online version you have the ability to do that you can check this box and then it will take you into your computer so you can find that file we are going to talk over in section 3 about how to prepare that desktop file so that you can pull it into your quickbooks online file i’m gonna leave it unchecked for now and click Next the next thing I wants to know is what would you like to do in QuickBooks and you might want to do a lot of these different things you might want to send attract invoices organize your expenses manage your inventory if you have retail sales you’ll want to choose this if you don’t you may want to leave that alone maybe track your bills track your sales tax pay your employees and track your hours so you can see that you can choose a few of these or all of these I’m going to click Next to the bottom and now it says what is your role at the business are you an owner are you the bookkeeper maybe the employee usually the owner of the company is the one that sets up the file or it could have been that the accountant set it up for the owner whichever person set it up is actually going to be the admin or the administrator of the file meaning that you’ll actually own it I’m gonna go ahead and choose owner in this case and if I scroll down a little bit you’ll see that it says do you have an accountant or bookkeeper right now and you don’t have to say yes even if you do have one it’s just asking you this because it’s going to set up some of the options as we go down the road for the accountant if you happen to have one I’m gonna say right now then I’m just gonna do it all by myself and I’m gonna say all set at the bottom and now what you have is a basic setup for your QuickBooks company file there’s still a lot we have to do because it’s really a blank company file right now but at least we have the file set up so that we can work on it if you wanted to go through a 30 second tour to help you get down to business on QuickBooks you can do that I’m going to go ahead and close that out and then that is what it looks like when you first log in you are on what’s called the dashboard right now and the dashboard is just a quick way to see an overview of how different areas of your company happen to be doing now do you want to take time and go through this whole what we call user interface here I want to do that over in section 4 so right now let me show you how to logout and then where to go to log back in if you notice in the top right hand corner of your screen you have a gear icon and you can use the sign out option right here and that will go ahead and take you back to the screen now let me navigate away from this and then we will come back and you will see how to log back in so I’m at Google now and when you’re ready to login you want to go to QuickBooks dot Intuit comm which is where we were earlier when we first created our account and this time you want to go over here it says sign-in notice that you’ll sign up with a particular one that you actually subscribe to if you haven’t subscribed and you’re still using that 30-day free trial just use the QuickBooks online option which is the first one and then that’ll take you back in and you’ll be able to log in right over here and that’s all you need to know right now as far as setting up your company file well let’s go ahead now and talk real quick over in section 3 about how to actually go ahead and upload your QuickBooks desktop file if you wanted to bring it into your online account if you happen to have been using the QuickBooks desktop version and now you’d like to pull that data into the online version there’s a little process you need to go through and once you go through the process then you’ll want to run to reports to make sure that all your data pulled in let me go ahead and show you how this process works what you want to do is open up your company file in the desktop version and then go to your menu and click on company and down near the bottom you will see export company file to quickbooks online if you don’t see that option what it means is that you have some updates that you need to do in this version of QuickBooks before you can export this in order to do those updates just go to help and you’re gonna see it’ll say update QuickBooks right here now go through that update process and when you’re finished close the company file then open it back up and when you do you should see the option to export your company file to quickbooks online now what’s going to happen here is it’s going to ask you to log in to your online account once you click start your x4 here’s where you have to login so I’ll go ahead and put in my email address again gmail.com and I’ll go ahead and put in my password and I’m going to sign in now what’s going to happen here is if it doesn’t recognize you then it’ll want to send a code to your email to confirm your account if you had plugged in your phone number when you set up your account that it could send you a text that way I’m going to go ahead and tell it to confirm and I’m going to flip over to my email and get that six digit code and I’ll be right back I’ve got my coat now I’m going to go ahead and plug it in and then I’m going to hit continue at the bottom it’s going to ask me a couple of quick things before it can actually pull it up to the online version this particular one says do you want to bring over your inventory if you say yes you want to go ahead and select a date then you want to go ahead and pull it in from I’m gonna go ahead and say I’ll pull it in from January of 2020 and I’ll go ahead and hit continue the next thing is it wants me to choose my existing quickbooks online company file now if i have more than one you’ll see them all listed here and i just choose the one that i want and then I’m going to go ahead and hit continue at the bottom and now it’s preparing my company file which is Larry’s landscaping and garden supply here this process could take a while what will happen is you will actually get an email from Intuit once this process is complete once it is complete what we’ll want to do is go ahead and open both the desktop version and the online version and run some reports now this one finished pretty quickly I’m gonna go ahead and click on OK and now I should get an email from Intuit remember if you don’t get that email it’s not finished yet it might look like it’s frozen but it’s really not you’ll get it eventually now let me show you the reports that you want to run to compare your data in either version it doesn’t matter which one you do first you’re going to run a profit loss and a balance sheet in the desktop version you’ll get a reports company and financial profit and loss standard now when the report comes up there’s a couple things that you need to do make sure the dates are all that way you capture everything in your company file also make sure you’re running this on an accrual basis right up here you’re gonna want to run that one thing you’re gonna want to run the balance sheet you’re gonna go back to reports company and financial and run a balance sheet standard make sure that you pick all dates you’ll have to scroll up to the top for that and make sure you’re running it on the cruel basis even if in real life use the cash basis for this report we’re going on accrual so that you can make sure you’ve got everything here now I’m gonna go flip over to the online version and show you where to go in there to pull those same reports back in the online version the way you run your reports is if you notice on the left hand side over here you’ll see it says reports and then you’ll notice that both the balance sheet and the profit loss are already set under your favorites you can run either one first it doesn’t really matter I’ll just start with the profit and loss and if you get screens like this that says customize go ahead and just close that out for now and what you want to do is make sure that you choose all from the top of the list here and then make sure you hit run report and you can see there’s the data now you’ll do the same thing with that balance sheet you’ll go back to reports over here on the Left you’ll run the balance sheet make sure that you’re running this on accrual basis and also make sure you’re looking at the dates all at the top you’ll want to make sure accrual is chosen right there like I said and then run your report now print those out and compare those two if all the days it’s the same on both of those then you’ve got everything but if once different than the other then it didn’t actually export all your data and pull it up to the online version and you may want to try it again and that’s how you’re going to pull your data from your desktop version into your online version let’s go ahead now and move over into sections or and I’m gonna give you a quick overview of how the screen looks we call this your user interface okay what I’d like to do in section 4 is go ahead and give you a quick overview of what the user interface looks like basically the screen when you pull it up what is it you’re seeing and how do all those pieces and parts work let’s flip over to QuickBooks and I’ll give you a quick overview when you first log into your company file you’re going to be on what we call the dashboard right here and basically the dashboard is just a quick overview of how the different areas of your company are doing a couple things you’ll notice you have the ability to add your logo you can just click here search your computer for your logo and pull it in there are some things over here that it asked if you’d like to start doing you can click there so if you wanted to start invoicing for example you could choose that option you can also go ahead and set up some payments send your first invoice and swipe cards in person with your mobile app if you happen to have that set up now some of these things are not free they are fee based meaning that in two it will sell these to you so for example if you’d like to be able to accept credit cards then they can set you up with the merchant services account you’ll notice down here are all of your invoice options so think of this as your accounts receivable this would be the amount of invoices that you have outstanding they have not yet been paid over here your expenses those would be the bills that you’ve put in you would be able to see any of those you had not paid yet as well so think of this area as accounts receivable and this as accounts payable here where it says profit loss that is the most important report in QuickBooks because it will tell you if you’ve made money or if you’ve lost money and then over here you’ll just see all of your bank accounts and if you wanted to click on one you could let’s say for example I wanted to go to my checking account this one here is called checking if I double click and open it up that’ll take me directly to the checkbook register now imma close this message real quick we’re gonna spend some time in the register a little bit later but that’s a quick way to get into the register now if I wanted to go back to the dashboard all I have to do is come back over to my navigation pane which is what this is called and click on the dashboard and I’ll be back to where I just was this is called the navigation pane on the left if you went down to banking you would see all of your banking options I’m gonna click on banking here and what this is going to show me is how to actually set up my account so that it is connected to the bank and I can pull in my transactions now I’m going to talk about this a little bit later but you don’t always want to do this if you are actually using the invoicing feature in QuickBooks like you should and receiving payments or if you’re using the bill feature and paying the bills correctly then you don’t want to enter information twice so you can set it up but you’re not always going to want to pull in data from the bank now if you had a credit card it would work perfectly now I know that probably doesn’t make sense yet but we will talk about some of that stuff a little bit later on over/under expenses here expenses are things that you have to pay out you had to enter some bills you wrote some checks to pay those maybe use the purchase order system you can kind of see all that right down here the next thing is your sales these are the things that you actually sell to your customers you’ll notice that under sales I can look at invoices I can also look at my customer list as an example and I’ll just show you what that looks like real quick this is going to be a list of all of your customers and you can see that they’re set up alphabetical in this case by last name we’re going to spend time on customers a little bit later but that’s how you get to the customer list you also have different projects that you might work on in the desktop version they call these jobs in here they’re called projects you might have a particular customer you’re working with but you might have multiple jobs or projects going for that customer under the workers option this is where you’re going to find your payroll options there’s a ton of reports we’re going to be looking at a little bit later you’ve also got a place where you can go in and look at your sales tax and also payroll taxes if you’re doing payroll to QuickBooks you’ve got an option for mileage where you can go in and plug in which vehicle you drove which job you went to which customer you worked with those types of things accounting now this is going to be the one thing you want to remember how to get to because this is very important this chart of accounts is the backbone of all accounting when you spend money when did you spend the money for if you receive money was it a sale you made from your business you’re gonna have to tell QuickBooks where all the money connects to in what we call the chart of accounts we are going to be going through the chart of accounts over in module 3 notice also this is where you would reconcile if you wanted to reconcile your credit card accounts or your bank accounts you do that right there you’re gonna see my accountant which is the next one here if you actually have signed up with Intuit to use one of their QuickBooks bookkeeper accountant people that they have available then this is where you would go to actually find that person and invite them to be a partner with you as they call it there’s also some apps that work with QuickBooks you’ll see that right down here they’ve got a list of some of the more popular ones some of the trending ones or if you wanted to look through some of the different apps down here at the bottom and pick one that you might want to use you can do that down here where it says live bookkeeping this is actually where we were just talking about a few moments ago you could actually go to my accountant and have a an accountant partner with you they also have what they call live bookkeeping where you can actually pay into it and you get a bookkeeper that will take care of your books for you and both of you have logins to your company file so you can both get in there and do work and you can also have conversations so you’ll be able to talk to them live as well and then the last thing here is what we call a cash flow this is something new that will be coming to QuickBooks very soon is called a cash flow Center and you can see that it’s gonna let you know what else going on with your cash accounts meaning with your checking account and things like that and you get a screenshot over here if you want you can join the wait list and when the actual cash flow Center is ready to go then they will send you an email and just give you some more information about it now one thing to keep in mind I did tell you way back in the beginning that if you happen to log in tomorrow and let’s say for example this new button here is not there look for it or look for the options that were underneath it already because they’ve just moved them somewhere else and that’s just something they did recently actually is they used to have those options right over here and then they moved up here recently now just to tell you what the new is anytime you want to create something new like a new invoice or maybe add a bill those types of things you’ll see that in this list and you’ll notice that where it says money in all of these options are your accounts receivable anything having to do with customers whereas money out is your accounts payable and then where it says other these are just some other things that you can create new transactions in QuickBooks if you click on one of these particular options the other thing I want you to be aware of is what we call the gear and you’re going to see that right over here in the top right of your screen and we’re going to go through the gear options over in module 3 I just wanted to give you a quick overview of how this whole user interface looks and how it works now that you have a quick overview let’s head over into module 3 and that’s where I want to spend time talking to you about customizing your QuickBooks files we’re starting module 3 now and I want to start this module by briefly just talking to you about the gear menu there’s gonna be a lot of places in QuickBooks where you can customize things to make it work a little bit better for you but let’s go ahead and start there so that you can see what some of the options are and where you would go to make some changes to your company file the gear option is in the top right hand corner of your dashboard right here and you’re gonna see that when I click on this it’s going to give you some lists that you can look at it’s going to give you some of the tools that are in QuickBooks you’re gonna have access to some of your company options that you might want to go in and change like maybe the address things like that and also it’s got what they call a profile menu for your intuit account right over here when you’re looking in here you want to get really really really familiar with a couple of these specifically this chart of accounts right here we’re gonna spend more time on that later in this particular module specifically in section 4 we’ll get started with that but everything in QuickBooks will run through the chart of accounts that’s why it’s so important that you know where that is don’t confuse the gear icon with this new option way over here this is where you’re going to click if you want to create a new transaction maybe you need to create an invoice maybe you need to create a bill maybe you need to do something like track your mileage those are all new transactions you could create just recently they’ve moved this new button over here and renamed it it used to be right up here and everyone got confused between the gear icon and this now they’ve moved it way over here so that you don’t get confused anymore and it says new meaning new transaction that’s really all I want you to know about the gear menu right now what I want to do now is take you over into section 2 where we’re going to use the gear icon to go ahead and customize some of the options for your company file in section 1 we got familiar with the gear menu there were lots of different options there that you can use to customize how your company file works and I want to take you into the gear menu now and into some of those options and show you how to customize some of those different things so that your company file works best for you let me go ahead and flip over to QuickBooks and we will dive right in I’m going to click on the gear icon and I want to start over in the first column underneath where it says your company you’ll see an option that says account and settings these are going to be like preferences or options that you can turn on or off or edit in QuickBooks as we go down the tabs on the left and we’ll start with company if you want to change anything in these different sections just go over to the right and click on the little pencil icon and that will take you into the edit option you’ll notice here that I can add my company logo just by clicking the plus sign and that will let me navigate through my computer to find my logo I could edit the name of the company if I like also you might want to put in your EIN number or your social security number you’re gonna use your social if you’re a sole proprietor and you really don’t have payroll if you do have payroll you’re going to have to have your EIN number in here so that quickbooks can use it to help you with your payroll i’m going to hit save and that’s gonna save that little section the next little section says company type and you’ll notice the first thing is the tax form and then the industry I’m going to click over on the pencil icon here and I want you to notice that you have the ability to add whatever type of tax form that you actually file when you do your taxes at the end of the year you can add that here now let me just make a little point here you do not have to pick anything here as a matter of fact if you do not file your own taxes if you have an accountant then I would pick other or none every single time your accountant will know what type of tax form that you file if you pick any of these options what will happen is when you’re working in different places in QuickBooks there will be an extra field that says which tax line on the tax form would you like to put this on you’re not going to have a clue if you’re not an accountant and you’ll just get stuck there every single time so why see that field and get yourself stuck I’m just gonna pick not sure other or none and the other thing is you have an industry you chose when you first set up your company file I chose professional services you can change that if you want but I’m going to leave that and hit save the next little section you’ll see here has to do with your company email you’re going to have your customer facing email the difference is that the company email is the private email that you’d like different things sent to from Intuit for example the customer facing email is the one you want the customer to see and that can actually be redirected to your company email if you don’t want to have to open 15 different email accounts you can always have as many email accounts as you want and redirect them to the one you’d like to funnel everything into there’s a place of putting your company phone and your company website here again you would edit that over on the right and the company address down at the bottom same thing you can have a company address that’s seen on the back end and then one that’s called customer facing meaning that’s the one that the customer actually sees let me go down on the left here to billing and subscription this is where you’re going to be able to go in and upgrade your existing subscription if you’d like you’ll notice that you can subscribe right from here and you can see all of the options and we’ve talked a little bit about these before so I’m not going to spend much time on that the next one on the left is usage there are some limits to some of these different subscriptions for example when you’re using the QuickBooks Online Plus and you need more room you’ll want to go ahead and upgrade your subscription for example the one that I’m using only allows me one user if I want to add a user I may need to upgrade my subscription there is a number of items you can put in the chart of accounts as an example it’s 250 just a little fYI the desktop allows you to have 14,500 if I need 251 than I need to upgrade my subscription and then down here where it says classes and locations you can have up to 40 and if you need more than that’s another reason you would want to upgrade your subscription I’m going to go over to sales on the left and there’s several things in here that you may want to go ahead and work with now later on we’ll look at customizing the look and feel of your different forms for example if you have an invoice and you want to add your logo or something like that but these are some things you can turn on or off right here in your forms for example let’s say that you like to invoice your customers and you want the customers to automatically have terms of net10 for example well currently their net 30 let me go ahead and click on the pencil icon and show you some of these here’s where I could change this to one of these other preferred invoice terms if you’re not familiar with the ones that say 1% net10 like these three and there’s two percent notes in and eight basically what that means is the customer invoice will be due in 30 days but if they paid in 10 days they can take one percent off it’s a way to get your customers to pay you early if you have a preferred delivery method you can choose it right here do you like to print things now or would you like to send things later I’m referring to an invoice as an example here where it says shipping if you don’t ship anything then you can go ahead and uncheck this and this will say off if you do ship things then you had some options down here where you can have sales reps and put in purchase order numbers things like that these are custom fields you can also turn those off if you don’t need them if you want pio number not sales rep for example just uncheck the sales rep option you can have custom transaction numbers and that basically means that if you want to put in your own transaction numbers you can go ahead and set that series up you can have a service date field you can also have fields for the discount and deposits or tips or gratuity if you use that you can just go in and turn these on or off I’m gonna hit save right there the next thing you’re going to see is products and services right over here and you’ll see there are several different options related to that that you can turn on or off for example if you don’t track inventory you can actually turn off this inventory option right here I’m going to go ahead and cancel that there’s also some options for late fees there’s also some for progress invoicing and let me just mention what that is just so you’ll know if you estimate jobs construction is a prime example you’re going to want to take that estimate and turn it into an invoice at some point so that your customer can pay you you do not have to pull everything from the estimate into an invoice you can pull in 30% for example or maybe you want to pull in certain items that were on that estimate into an invoice if you do estimates you will want progress invoicing there’s a couple more options here let me scroll down there is an option for messages when you actually email a form so let’s say it’s an invoice for example or what they call a sales form you have the ability to email it directly to your customer you can set the default message and I’ll go ahead and click on that one so we can see you can say Deere or you can say to notice you can have a merge field if you want to have their full name there’s lastname firstname and you can use the standard message that you see right here below when you’re actually sending out that email you can also have a copy email to yourself every time if you’d like I’m gonna go ahead and hit save down at the bottom a couple more things I want to point out you’ll notice there is an option for reminders and I want to briefly tell you how reminders work but before we do that I think we’ll go ahead and stop the video right here let’s go over into the next section and I’m going to talk to you a little bit more about some of these other options here for account and settings hey welcome back let’s go ahead and finish up talking about customizing your company file this is actually part two of section two let’s go back down to reminders I’m going to click the pencil icon there’s a couple of options that you want to be familiar with in here you have the ability to set up invoice reminder emails for an example if your customer is late paying an invoice or you just need some reason that you want to remind your customer to pay that invoice then you can go ahead and either use the standard message or you can go ahead and edit the one that you see down here and you’ll see it just basically says this is a reminder we haven’t received your payment yet you do have the ability to insert a placeholder which basically means that anywhere in here you can put in the company name or the invoice number and that would actually be a merged transaction as what they call it it’ll pull from QuickBooks that information you can email yourself a copy and you can go ahead and save this when you’re done you also have options for online delivery down here at the bottom you’ll see these are email options for all of your sales forms your options for this will be when you actually email your sales form over to your customer do you want to have a short summary show up in the email or show the full details in the email you can also attach it as a PDF right here and some additional options you have is if it’s an online invoice you can actually set it up for HTML or if you want it to show up in plain text but you probably want to leave it online invoice and then click Save and the last one I want to mention at the bottom here are statements and I’ll go ahead and show you those options a statement goes out at the end of the month and basically it starts with the balance from the prior month it shows all of the transactions that month and then what the customer owes at that point it’s really a gentle reminder for your customer to go ahead and pay you statements are not mandatory but they certainly do help when you’re trying to collect money you’ll notice that when you print statements you have an option to list each transaction on a single line or list each one including all the details on that particular one you can also show the aging table at the bottom of the statement and what that means is it will have a field that says one to thirty days another one says 31 to 60 and another says 61 to 90 and that way your customer will know where they fall in that particular aging table I’m gonna go ahead and hit save and those are your options that happen to be under the sales let’s look at the options for expenses expenses are things you have to pay bills that come in the mail that you have to pay for example your options are to show item table on expense and purchase forms you can track expenses and items by customer make expenses and items billable and default bill payment terms make expenses in items billable let me just tell you what that means real quick if you have to purchase a product or service and you want to make sure that you invoice your customer so you can get reimbursed for it instead of just manually putting those receipts in the car or keeping them on your desk QuickBooks will remember those expenses and when you’re ready to invoice the customer you can just pull them in you also have the ability to use the purchase order system so if you don’t use purchase orders you might decide to turn this off also you have this option called messages at the bottom this is a default message that will be sent when you send purchase orders I’ll go ahead and open that one so you can see the default message you can also edit this to say anything you’d like and then make sure you save it when you’re done the next tab on the Left says payments this would be customers paying you there’s a couple things you can do one is if you want you can sign up with QuickBooks to receive payments quicker by going through this little service QuickBooks has it’s very similar to the way PayPal or zel might work you just signup forward if you wanna learn more you can click here and that way you can actually email an invoice to a customer for example they can click a button right there and pay you right then in there QuickBooks will automatically be updated once you’re paid from your customer if you already have some sort of existing account with Intuit for example they have something called go payment or merchant services you can connect it to your QuickBooks as well right here and this is where you connect and the last option says advanced there are several things here I’ll just mention briefly if you want to have the first month of your fiscal year start maybe in September you can actually go ahead and change this it’s going to default to January make it correspond with your real existing started or fiscal year you might have a different date for the beginning of your income tax year so you can go in and change those your accounting method is set for accrual when you run reports you can run them on an accrual basis or cash basis accrual basically means that as soon as you invoice it shows up as income where their customers paid you or not as soon as you enter a bill it will show up as an expense whether you’ve paid it or not if you change this to what they call cash basis you will only show the income once you receive the money from the customer or you’ll only show the expense once you actually spend that money I want to mention closing the books as well because this is an option that you’ll want to think about in real life accounting what happens is you close the books at the end of the month and you close the books at the end of the year and what that means is if you want to make a change in a closed period you can’t do it you need to make an offsetting entry in the current period your books are not closed automatically in QuickBooks it doesn’t remind you anything so if you want to close them you have to come here you’ll be able to go in and you’ll be able to tell QuickBooks that you do want to close the books and then you can set a closing date let’s say you set it for December 31 of 2019 that means that after you are working in the next year but you see a change you want to make in 2019 prior to December 31 you’re not going to be able to change it I’m gonna go ahead and cancel out at that we talked a little bit about tax forms earlier you want to make sure you keep that one also the chart of accounts I know you haven’t seen it yet but basically everything in QuickBooks will run through this chart of accounts and currently they do not have general ledger numbers they’re just a list alphabetical for each type if you want to turn on general ledger numbers you can turn them on right here also you have some options for the markup income account and we’ll address that a little bit later let me mention real quick the track classes and the track locations locations means if you have different physical locations for your business you can turn this option on and every transaction that you work in you can choose which location you want that to go to classes is very similar except it’s not really locations think about this let’s say that you happen to have two different divisions of your company you might use those for your class list and everything you do make sure you pick the correct option from the list there’s some things about forms where you can have it pre-fill automatically automatically apply payments things like that you might want to look through that at some point a project would be like a job related activity you’ll notice that you have the ability to organize all of those job related activities in one place and that is turned on you’re also viewing QuickBooks in the business view there is an option to go ahead and also see this in what they call the accountant view time tracking if you want to be able to track the time that you or your employees spend working on different projects or jobs you have the ability to do that you can also come down and change the currency there’s some date options and things like that all the way down here that means there’s a lot of options in you can go through and set you’re going to want to look through these you don’t have to get them all right away but at some point if you want to set these you just come back in and make all these changes I’m going to go ahead and close that with the X at the top right and that’s going to take me back to the dashboard let’s go ahead & Nail move over to section three and I’ll show you how to manage users one of the things that you will want to do is make sure that each person that is using QuickBooks has their own login you’ll give each person their own username and their own password only the administrator can add edit or delete users you can have up to five users in your QuickBooks file if you need additional ones you can think about upgrading your subscription or purchasing those additional ones that you might need the reason you want to have these additional users set up is because if you want to track down the errors then you’ll want to know who was logged in at the time that that particular transaction was changed you can run an audit trail to see a report on which user was logged in with the transaction used to look like and what it looks like now you also will be able to limit the users access to certain areas of QuickBooks let’s go ahead and flip over and I will show you how to manage the users keep in mind that the administrator has to be logged in in order to work with the users I’m going to go up to my gear icon in the top right-hand side of the screen and in the first column you’ll see an option that says manage users the first thing I want to point out is that normally if you’re using one of the basic subscriptions then you only have five what they call billable users in your plan and like I mentioned earlier you do have to upgrade if you want to have additional users the admin is considered one of the five users and you can see here is the admin name if you wanted to edit the admin information you can choose the Edit over on the right and then come over here to edit user settings typically when you first set up QuickBooks you’re gonna see the email address that you signed up with right here under the first name field and there won’t be anything where it says last name you could come up here and change those like I did I’m going to go ahead and hit save at the bottom if you want to add a user just come over to the right here and click on add user your user that you’re setting up can have what they call standard rights which means that you can choose to give them full rights but you can also choose to limit their access to certain areas or you can give them company admin rights which means they have access to everything these options up here count towards your five user limit we discussed these here don’t because you might have someone you want to be able to log in just to run reports or maybe just to do time tracking I’m gonna go ahead and choose standard user at the top and click Next in the bottom right hand corner of the screen the first thing it asks me is how much access do I want to give this user now if you say all notice it will include payroll and it will check that and you can see all the different things they have access to over here if I go ahead and uncheck that you’ll notice that the things they don’t have access to do or down the bottom they can’t add or edit employees in this case or delete payroll transactions it could be that I say none I don’t want them to have rights to any of these accounting features but they can still manage other things in QuickBooks like submitting their own timesheets things like that I can also give them limited access meaning if I want them to be able to do things with customers you can see the choices here or if I want them to do things with vendors or both you can see I can check both and you’ll see all the options here as well I’m gonna go ahead and click Next and now it asks me do you want this user to add edit and remove users we’re going to say no and I wouldn’t change that because you want the administrator to have rights to everyone if you start giving everyone full rights to change users and that sort of thing then what’s the point in even setting those up notice that you can also give this person permission to add the company info or if you want them to manage the subscriptions you have the ability to do that as well I’m gonna go ahead and click Next at the bottom then it says we’ll invite them to create a QuickBooks account and password for each to access the company file what you’re basically going to do here is the new user you’d like to setup you’re going to put in their first and last name here put in their email and they will actually get an email saying that the administrator would like them to become a user they would accept and then they can set up the username and password make sure that the administrator knows that information you wouldn’t want to have an employee that has their own username and login information and the administrator doesn’t know what it is and can’t have access to what they do that’s going to be very important for you I’m going to go ahead and just X out of this because at this point what would happen is once they accept it then you would see their name down here as a user and that’s really how the users will work I do want to show you the audit trail report but we’ll do that when we get over to reports a little bit later let’s go ahead and wrap up this section and let’s talk over in section 4 about the chart of accounts we’re getting ready now here in section 4 to talk about the chart of accounts the chart of accounts is probably the most important thing in QuickBooks every single thing in QuickBooks will flow through the chart of accounts somewhere the chart of accounts is basically a listing of different areas where you might actually spend money or you might receive money as well and you’ll want to make sure that your information goes into the correct categories that way when you run reports you have accurate information there is a part two to the chart of accounts make sure you watch both parts so that you have a really good understanding of how the chart of accounts works let’s go ahead and flip over to QuickBooks and we’ll get started there are a few different ways to get to the chart of accounts one way is to go through the gear icon and in the first column you will see the chart of accounts another way is just go over to the left and click on accounting and there you will see the chart of accounts as well and this is what your chart of accounts looks like remember that every single thing in QuickBooks runs through one of these that’s why it’s so important that this is set up correctly but let me quickly give you a quick overview of how the screen looks you’ll notice the first column is the name of your account when you’re setting these up you can pretty much name this accounts anything you’d like but make sure that you name them something that makes sense to you or whoever happens to be looking at your reports the second column is the type and notice that it’s currently sorted by type we’re going to be going through all the different types so that you will know which ones you need to set up to make sure that you have everything you need I want you to notice also that when you’re looking down this list and you see the type for example income notice that the names are alphabetical and that will be true of each of these types if you look at the expenses here then these are alphabetical if you want to turn on general ledger numbers you have the option to do that and let me show you what it will look like if you do you’ll actually go up to your gear icon then you’re going to go into account and settings then you’ll want to choose advanced on the left-hand side and under advanced you’re going to see an option that says enable account numbers right here currently they’re off if I choose on just by clicking there and choose enable account numbers notice that turned it on and I can show account numbers and then save and I’ll show you what this looks like now let me go ahead and close this and you’re going to see now that you’ll have a new column at the beginning here where you can actually go through and putting your own account numbers there will not be in here automatically you have to add them the way you would add them is the way you would edit any of these accounts just come over to that line that the account you want to edit is on you’ll see a down arrow and you’ll choose edit and in this window you have the opportunity to add your new account number right here I’m gonna go through this screen in a minute so I’ll just close that for now and I’m going to go back and turn those account numbers off for just a moment account in settings it’s going to be the advanced option on the left and I’m gonna go ahead and turn off enable account numbers just by clicking that word on and I’ll uncheck these and save that now let’s go back and finish going down our list here the next column that you’re going to see next to the type is going to be the detail type and that’s just telling you a little bit more information about the type that you chose there’s also the QuickBooks balance and the bank balance the QuickBooks balance would be if you had entered some transactions in QuickBooks what is that balance for that account the bank balance column will allow you if you pull in your entries from the bank that’s called downloading your transactions then you’ll see what that balance is as well and you can see that you can match those up and see if you’re in sync here and we’ll be getting into that a little bit later but right now what I want to do is start talking to you about the different types of accounts you’d want to add and then we’ll add a few so you can get a feel for how this works the first type that I want to talk about our bank accounts you’ll notice there are no bank accounts at the top of this list that means that right now you do not have a checking account you don’t have a savings account any kind of bank account you have the ability to add these you’re going to be doing this by clicking over here where it says new and the first thing you’re going to do is pick the account type in this case it will be Bank but notice all the other types we’re going to be talking about weird says detail type right here just go ahead and pick the option from the list that closely matches the account type you’ve chosen over here is the name of the account when you name your account you can name it anything you want if you want to call it your bank name you could do that if you want to call it operating account and maybe another ring called payroll account you can do that whatever you like to name it I’m gonna go ahead and leave it on checking for now description is totally optional and there’s not a sub account right now but later on I’ll talk to you about how sub accounts work the other thing you want to think about is a start date to start tracking the money in this checking account now what you want to do is if it’s the beginning of the year like it is currently then you probably want to go back to January 1 or the beginning of your fiscal year and put in all the entries if that’s the case then you can choose beginning of this year you might decide if it’s later in the year and you’re starting your QuickBooks file to go ahead and start with the beginning of that current month you can also pick other the reason you might want to pick other is what if you have a bank statement that cuts off in the middle of the month that would be an option where you can tell it a specific date to start with it really doesn’t matter what date you start with just try to make it correspond to the start date of your bank statement I’m going to go ahead and say beginning of this year and I’m gonna go ahead and put in the balance the ending balance on 12/31 of 2019 would be the exact same number as the beginning balance of 1 1 2020 you’ll want to get that number from your bank statement I’m gonna go ahead and say it was 250 dollars and 62 cents and I’ll go ahead and hit save and close at the bottom and now you’ll see at the top you have a checking account and you have a balance of two 50 and 62 cents you also have the ability to view the register I just want to show you that real quick if I come over here to view register then this is what the checkbook register actually looks like I’m gonna close this this is just some information on what a register looks like and what it’s supposed to do anytime you want to go back to the chart of accounts you’ll notice right up here it says back to chart of accounts and that’s going to take me back to the screen now I also want you to notice something that happened any time in accounting you do something like this then you will have a debit and a credit for that transaction you’ll notice that in this case the flipside the money went to an account called opening balance equity and that’s the way it should be you can’t change that just know that whenever you have a starting balance which could be a minus number if you have a loan but this is going to be an actual picture of what your books look like so don’t freak out if you see a negative number there it’s an accurate picture of your books let’s go ahead and talk about some other bank accounts you obviously would have savings money market accounts things like that but think about do you have PayPal do you accept square those are bank accounts as well so if you do accept those then you want to set this up as bank accounts what would eventually happen is you would transfer money from PayPal or square into your checking account or sometimes you go the other way but those are just bank transfers the next type I want to talk to you about are your assets and you’ll see there are a couple of these here an asset is something that your business owns that makes it more valuable you’re going to have equipment you’re going to have chairs desk lamps vehicles property assets fall into one of two types there are fixed assets which are things you plan to keep long-term like the vehicle or property then there are what we call more liquid assets or QuickBooks cause some other current inventory is a great example of that because I’m worth more right now because I have inventory in the back room but my goal is to sell it and get it out the door now what’s going to happen with assets is you’re going to set up big bucket categories and what I mean by that is instead of listing each vehicle the business owns you’re going to have a category called vehicles and they’ll all dump into that one category you don’t want to have a hundred different categories for your assets because no one wants to sit there and look at that just have big buckets maybe seven to ten good ones some of the common ones that I see are vehicles you might have one called furniture and fixtures you might have one called property if you have a lot of property you might have equipment but again they’re just big buckets this is where the accountants going to be very helpful to you because the accountants going to help you decide which categories to set up and also when you start talking about the money part then the account it’s going to help you plug in how much the vehicles were worth and depreciation and things like that QuickBooks does not do depreciation and that’s because there are multiple ways to do it if you had ten accountants they might all tell you a different way they want it done so just know you want to have the account set up so that if you go to the bank to get a loan for example the bank will know that you do have some assets we’re going to move down the list but before we do I want to go ahead and stop the video here and have you go over into part two and we will continue talking about the different types that you’ll need to set up we’re in Section four and we’ve just talked a little bit about how to start setting up some of the accounts and your chart of accounts I want to go ahead and finish telling you how to set up the rest of those accounts so let’s flip over to QuickBooks and we’ll keep going the next type that I want to talk to you about our what we call your liabilities a liability is something you owe now I’m not talking about the monthly payments you have to pay for the electric bill things like that what I’m talking about is a loan you’ve taken out the bank when you think about your liabilities there are really two types there are what we call long term which are things that you’re going to pay on for more than 12 or 13 months and then there are short term which is under a year basically and QuickBooks calls them other current liabilities when you set up your liabilities you want to set up a separate one for each loan that you have and when I say loan it could be a car loan it could be you as the owner decide to set up a loan where you put money into the business and you want to get paid back you might have borrowed from the bank those are all different liabilities you want to set up and each one should be set up separately let’s set up a car payment so you can get an idea of how you would set up these accounts I’m going to click on new and the first thing it asks me is to pick the account type here you’re going to see your other current which is a short term and your long term liabilities which what I’m gonna choose in this case another thing to notice is that where says detail type if you see notes payable that’s just an accounting term for a loan basically over where the name goes this is where you’re gonna pick the name that you want for your loan I’m gonna call mine the bank of any city but you can call this anything you want sometimes what I’ll see people do is put the last couple digits of their account number here just so that they can see which loan they’re looking at when they have it pulled up in front of them description is totally optional this is where you might say that this is my 2019 Jeep Cherokee loan or you can leave it blank and then we’re going to have to pick a start date now remember if we’re starting your company the beginning of the year what you’ll want to do is for your beginning balance here find out what the amount you owed as of in this case January 1 was so that you can plug that in it’s not the amount you started with when you purchase the vehicle two years ago it’s the amount you owed as of the start date of your company file I’m gonna put $15,000 in here and then hit save and close at the bottom and now what you’re going to see is that you have a loan right here notice it says Bank of any city and the balance is $15,000 every time you make a payment on the loan this is the account you want to put it to your car payment is not an expense to the business do not set it up as an expense account it is a loan and you want to know when you’ve paid off the loan you’ll also be able to on each individual check that you write you’re going to be able to put in how much is principal and how much is interest there the other thing I want you to notice here is look at your opening balance equity it’s a negative number and that’s because I said that when you owe something it’s a negative number and this is an accurate picture of what your books look like let’s talk about credit cards a little bit and I’m talking about credit cards that your business uses to purchase items for the business this has nothing to do with accepting customer credit cards you want to set each credit card account up separately so that you can track each one I’m gonna go ahead and set up a new one for you the type is going to be credit card I’m going to name my card I’ll just call it visa and I’m going to pick the start date of my company file the beginning of this year and the starting balance would be the starting balance from my January bank statement if you don’t have your January bank statement then you can grab your December of 2019 and plug that number in I’m gonna say was $2,500 and I’ll save and close and now what you should see is that you have a credit card and you owe $2,500 when you make a payment towards the credit card you’re going to actually put it to this account always do not try to break it up that so much as gasps and so much was meals because there is another way to do that in QuickBooks all the payments go directly to the credit card account going down the list the next type that I want to mention is where you see equity equity basically means equal if you think about it you’re the owner of the company when you take money out that’s considered an owner draw when you put money in is considered an owner contribution now they’ve got some other terminology you’ll notice owner investment is when the owner puts money into the business and owner pay and personal expenses is when the owner takes money out of the business what I don’t want you to do is make a deposit from your personal account and consider it income it is not income to the business it’s considered equity the next type that I want to talk to you about are your income accounts I’m going to scroll down just a little bit here you’re going to see that there is one called sales income and typically when you make a sale for your business this is the account that you want your sales to dump into you can have a few extra ones added if you’d like maybe you have different areas that you do business in and what I mean by that is in your company maybe you have different things that you do and you’ll want to actually set those up so you can see how much income you’re getting from each one that’s certainly okay keep that list pretty short though no one wants to read 50 different lines of income accounts but sales is normally where you’ll see most of that go into the next thing I want to mention is your cost of goods sold think about the things that you have to buy to make a product or service in your business you have to buy materials you’re going to need subcontractors sometimes maybe you have Freight that’s part of that anything that you have to buy to make a product or service in your business is considered a cost of goods sold and you want it to show up on a profit loss as being deducted from your total income the largest grouping that you’re going to see are your expense accounts and you’ll see there are a ton of these here you’ll also add a lot of these let me show you how to add some sub accounts so you’ll see how this works let’s use car and truck as an example we have the main account here but I want to add a sub account called gas and maybe another one called repairs and maintenance all you’re going to do is go back up to the new option and the top right of your screen here you are going to create a new account and it has to be the same type as the main account so that means this one has to be an expense account and in this case it is Auto and I want to name this one fuel what I’m going to do is check it’s a sub-account of and then from this list here what I’m going to end up picking is car and truck so see how that fuel is a sub-account of car and truck and when I click Save and close at the bottom I want to show you how sub accounts look see how fuel looks like it’s indented a little bit that’s a sub account and there’s going to be a lot of these you’ll want to add when you’re going down this list think about insurance you might have general liability you might have auto insurance those would be sub accounts of insurance going down under legal and professional fees often what I’ll see is accounting and the attorney will be sub-accounts of legal and professional fees and you can just come down and make this list look any way you want there’s utilities at the bottom you’ll want to have telephone underneath gas electric any of the utilities that the business pays that’s going to give you a quick overview of setting up your chart of accounts make sure you spend some time on this and get it set up the way you want it you want it to be as detailed as you need it to be to get your numbers but don’t make it so detailed that no one wants to read it you can always set up accounts later as you go along as well because you’re not going to catch them all right away well that’s going to wrap up the chart of accounts let’s go ahead now and move over into module four and we’re going to talk a little bit about working with accounts receivable and we’ll start with learning how to set up customers we are getting ready to start talking a little bit about the accounts receivable portion of QuickBooks if you’re not familiar with that term anything happened to do with customers in your business that’s called accounts receivable customers are people or businesses that buy from you you’re typically going to make a sale and that’s going to be income to your business we need to talk first of all about how the customer list is set up and then once we do that we’ll go into the second section and I’ll show you how to add some customers to this list the way you’re going to get to a list of your customers is to go over to your navigation bar on the left point to sales and then you’ll see customers in the list at the very top of your customer list here you can see the dollar amount for any of these categories you can see that for open invoices I have thirty five thousand eight hundred and ten dollars these are invoices that have been created and the customer has not paid them even if they owe a penny if you had any of this amount that was overdue you would see that over here and overdue means that if you had set specific terms on an invoice say net 30 meaning that invoice was due in 30 days and the customer has not paid you by then then some of this moves over into the overdue category you can also see how much was paid in the last 30 days in this case nothing there’s also a dollar amount for what we call unbilled activity and for estimates sometimes you will get little messages like you see here right above your actual customer list you can close those with the little X in the right-hand corner and then you can actually see the list the customer list is set up alphabetical by last name you’ll notice that when you look down this list the list is set up by last name comma first name you’ll want to do that because it’s a lot easier to find someone when you’re looking for them if it’s set up that way obviously a business like Adams candy shop would not have it last name and a first name so it just sorts the first letter which is a in this case with the A’s in the list if you see a little envelope to the right of some of your customers that means that if you click there you can actually send that customer and email if their email address was set up when you actually set up the customer then it would pull it like you see here if not you’re going to notice that there’s no envelope meaning that you have not put in a customer email address in the customer information these are what we call sub customers sometimes they’re called jobs sometimes they’re called projects in the online version the technical term is a sub customer they’re both sub customers of in this case Mike Ballack you can also see the customers phone number and the open balance meaning how much money that customer owes you there’s also a column for actions if you happen to be on this screen and you’d like to take one of these actions related to this customer you could do that for example you can go ahead and create a statement or an invoice right from here just know that you’re not always going to be on this screen when you want to do those things so there are other ways to do those actions notice you can also search for a customer right up here so if you wanted to look for Mike bellick for example you can start typing the last few characters of their name and then you’ll see that it pops up in the list over on the right-hand side you have the ability to print a list of your customers you can also export this list to excel if you’d like and there’s also some settings and I want to click on those for a moment because I want to show you that these are going to be the columns that you see up here if I’d like to see their email address I just choose that and notice now I have a column for email or if I’d like to see their address I can click on that and now I see their address as well it’s just how do you want to actually look at this list another thing I’ll mention way back over in the left where it says batch actions if you have multiple customers selected from the drop-down list you can actually email all three of these customers or you can make them inactive an inactive customer is a customer you’ve used in the past therefore you can’t delete them but if you haven’t seen them in a long time and you just want to hide them from the list you can make them inactive that’s a quick overview of the screen itself here what I’d like to do now is take you over into the second section and show you how to add a customer to the customer list now that you’ve gotten a quick overview of what the customer list looks like and how it works we need to start adding some customers to this list let’s go ahead and flip over to QuickBooks and I will show you how to add your first customer if you’re in your customer list you’ll notice in the top right hand corner there’s an option to add a new customer there’s also a down arrow to the right of that because you can also choose to import customers what if you have a list of customers already set up in Excel you can just import those so that you don’t have to set them up one at a time we are going to talk about importing customers from Excel over in section 5 of this module for now I’m going to click on new customer we’re going to put in some customer information on this screen and you’ll notice the first thing it asks for is the company name remember that a customer can be a company a customer can also be an individual that works for a company or it could just be an individual and there’s no company in that case you wouldn’t put anything in the company name field but I’m going to go ahead and put in this customers company its BRC supplies and you’ll notice that because I typed a B it starts pulling down a list of different companies that it’s failed and their addresses so if I want to just choose one of these I could but since I’m typing this inference garage I’m going to go ahead just click over to the side somewhere and then I can come back over and finish filling this out this customers name is Tom Allen and notice it now has a display name as Tom Allen you can change that display name to show as the company name or last name comma first name display name means the way you see it in the list over here remember we talked about the easiest way to find customers is to type it in last name comma first name just be consistent with however you decide to do it it’s also going to use the display name as the same way it’s going to put their name on checks it looks kind of funny if I write a check to Allen comma Tom I’m gonna uncheck the box and then I’m gonna put in Tom Allen and that way that’s how his checks will appear when we put his name in there over on the right you see I can type in an email I’ll just say Tom at Yahoo you can also put in Toms phone number Tom’s mobile fax other end website also if this is a sub customer I can check the box and choose the customer that he is a sub customer of we’re actually going to do that over in section 4 now notice I’m on the address tab and this is where I’m going to put in the billing address I’m going to go ahead and say he’s at 1 2 3 and we’re going to say this is Billings Road this is gonna be in the city of Bayshore California States California and the zip code is nine four three two six the country will just say USA now you’ll notice that the shipping address is the exact same as the billing address if you don’t ship anything you don’t have to worry about that but if you do they may want their invoices going to one address and the actual things your shipping going to a different address you can uncheck the box and change that information if you need to I’m going to go ahead and hit save and let’s see if Tom Allen is in the list he should be in here’s Allen comma Tom and he is you can see it right over here now what I mentioned a couple of things when you’re in this list if you have a customer that you accidentally put in you cannot delete that customer the online version of QuickBooks lets you make a customer in active meaning you hide them from the list but you cannot delete them now what you’re going to see is all the information you had set up about Tom Allen notice a couple of things you can add some notes if you want to this customers record I’ll just click add notes just to show you let’s just say that we can put in here this is a new customer for the year 2020 and that’s a note that’s all you have to do there and now that will show up any time you want to see that notice also there is a tab for the transaction list down here and obviously we have no transactions yet but as we start creating invoices receiving payments that sort of thing they’ll show up right down here the projects these are going to be the jobs that we actually do for these customers there aren’t any set up yet here we can also see customer details this is where we’ve got all of the information we had just set up for this customer and then also if there were any late fees you would see that listed here as well and that’s how you set up a new customer I’m going to hit this customers link here on the top left and take me back to the list of customers and notice Tom Allen has an envelope to the right because we did put in an email address for Tom Allen that’s pretty much how you put in a new customer what I want to do now is take you over into section three and I’m going to show you how to add a sub customer now that you know how to add a customer let’s talk about how to add sub customers a sub customer is basically going to be a way of adding a level underneath your main customer if you have different jobs that you work on for a particular customer you can actually separate those jobs by actually creating sub customers then you can look at reports for the entire customer but also per sub customer in the desktop version of QuickBooks they actually call these jobs sometimes they’re called projects here like I said the terminology is a sub customer let me show you how to set those up to create a sub customer we’re still going to use the new customer button because it is a new customer we’re setting up they’re just a sub of another one we already have existing when this comes up all you want to do is put in the display name you can see in their case they’re using street addresses I’m going to make up one one twenty four and this will be Scottsdale Drive and the only other thing you want to do is come over here where it says is sub customer and underneath it pick the customer that you want to apply this to you can also see it says bill with parent over on the right and you do want to keep this together you can also build this customer individually we’re gonna leave it on bill with parent and you’ll see that it actually pre-populated all of this information from Tom Allen’s setup we don’t need to change any of this unless it happens to be different we’re just going to hit save and then that’s going to be our next level we’ve created you can see it right over here and that’s all there is to creating a sub customer now a couple things you need to know if you’re using the sub customer feature you want to use it consistently throughout QuickBooks if you don’t let’s say that you’re working on some transaction and instead of picking 120 for Scottsdale I picked Tom Allen it’s still going to go to the right main customer but on reports you’ll see other and you’ll go what’s going on you want to make sure that you put it to the correct a sub customer if you’re using the sub customers option not every business will use the sub customer option but it’s really great if you need to break out different projects like I said or maybe you have different locations for our particular customer things like that that’s really all there is to working with sub customers let’s go ahead now and move over into section 4 and I will show you how to edit an existing customer once you have a few customers set up you’re going to realize that you need to edit some of the information maybe you actually set up the information wrong or it could be that the customer information has changed maybe they’ve moved they have a new address you want to add a website you can always go in and edit the information about your customers and it’s a pretty easy process so let me show you how that works if you want to edit a customer’s information make sure you click on your customer over in the customer list and then come over here and choose this edit option let’s say that Tom’s email really includes his last name I’m going to go ahead and add and let’s say that when we set this up we did not look at any of these tabs so let’s go through those real quick so that you’ll know what other types of information you might want to set up when you’re setting up your customers we’ve looked at the address tab now let’s take a peek at notes this is where you can add any notes you would like pertaining to this customer the best thing to do is just drop down after the previous note pop in the date and then pop in any notes that you might have pertaining to this particular customer the third tab over says tax info this has to do with collecting sales tax from your customer if you sell physical items and you charge sales tax you need to tell QuickBooks that this customer is taxable and what the default tax code is we’re going to talk about sales tax later on but just to give you a heads up what you’re going to have to do is where you’re setting up the items or the different things you sell they actually call them products and services in here then what’s going to happen is you’re going to set up each sales tax you need to collect and then you’ll group them together to create one big tax so that you’re charging the customer correctly and that’s where you would put that tax code let’s say that it happens to be the San Domingo we’ll choose that and now what will happen is when we invoice a customer it’ll pull that tax code automatically the next one is payment and billing a lot of this is just information for you first of all the preferred payment method does this customer you usually like to pay you with cash check barter or MasterCard you can kind of see the list there if you need to add a new way that the customer can pay maybe PayPal Square you can just hit add new right here and then you can actually type in the name of that new payment method and then hit save and now PayPal will be on the list since I just added it it does not mean that the customer pays you with PayPal every time it just means that’s their preferred way they typically like to pay you preferred delivery method how do they like to have their invoice sent to them do they like to have them print it and you can print them later or do they like to have them sent email where you can send those later or do they not have a preference terms you can have different due date two terms per customer if you have a really good customer you might have net 30 if you have a customer that’s brand-new you might say do a pom receipt now let me tell you why you have this opening balance field here as of the start date of your company file how much money did this customer owe you let’s just say it was a thousand dollars you could plug that in there and the accounting would be correct but you would not have a way to go back and see that that was actually three separate invoices you sent them that total eight thousand dollars I like to go back and put each invoice in that the customer still owed me four and not fill this in but whichever way works for you would be fine as long as the numbers come out correctly and then of course if you did put an opening balance you would put in the date that that would be as of which would really be the start date of your company file the next tab over says language this will default to English but if you’d like to sing your invoices to the customer and French Spanish Italian you can see the list there you can also have attachments for this customer what this would be is let’s say that you had some sort of file that you actually created or it could be a bill that you received something related to this customer instead of having to get out of QuickBooks and search your computer for that file you’ll be able to open it right here from QuickBooks because it will be attached if I click on attachments here it will allow me to search my computer and find that file and attach it here the last tab says additional info you might have different ways you like to categorize your customers you’ll notice they have commercial customers and residential customers but you can set up this list any way you like it and that’s going to be how those tabs work right there all you have to do when you’ve changed all the information is hit save and that information is now saved in QuickBooks now one quick thing I want to mention to you especially about sales tax if you have a customer you have set up where you charge a certain tax and later you go back and edit the information and change it it’s not going to go back to any prior invoices and change that sales tax it’s only for any new ones you create from this point forward well that’s how you’re going to edit your customers let’s go ahead now and move over into section five and I’ll talk to you a little bit about making customers inactive one of the things you can do in QuickBooks is with any list you’re working in whether it be customers chart of accounts vendors it doesn’t matter if you have an item on that list that you’d like to temporarily hide from the list you can make it inactive inactive customers actually will not show up when you’re working in other areas of QuickBooks but if you wanted to actually turn them back on you could go and activate them again let me go ahead and show you how to make a customer inactive and then you’ll know how to do it when you’re working in other lists in QuickBooks as well let’s say that I want to make Edward Blackwell inactive notice that Edward still owes me one thousand one hundred and twenty five dollars I wouldn’t want to make him inactive because I’m going to be using this customer he’s going to make a payment and I’ll need to be able to apply money typically you make it customer inactive if you haven’t seen them for a while or maybe it was someone you set up and you never used those would be reasons to make a customer inactive let me show you what happens if you try to make mr. Blackwell inactive and he still owes you money I’m gonna go ahead and click on edit and here’s where you go to make a customer inactive now this message is telling me that Edward still owes me money he has a non-zero balance if I say yes and make him inactive then QuickBooks will create an adjusting entry so that he doesn’t owe me money anymore I’m gonna click yes and notice there’s a little error message and that’s because this customer has what’s called a recurring template that’s being used anytime you have something recurring you have to actually delete the recurrence of that whatever it is before you can go in and delete the customer in this case I’m going to go ahead and hit cancel at the bottom and let’s use a different customer Tom Allen because he doesn’t owe us any money we just sent him up I’m gonna go ahead and click on Tom Allen and then click Edit on the right make inactive and now it tells me that tom has a sub customers or projects making him inactive will also make all his sub cover and projects inactive and that’s what you want I’m gonna click yes and now you’ll notice it says Tom Allen is deleted just a little fYI QuickBooks does not have a feature to delete anything from a list in this case a customer if you wanted to quote delete them you’d have to make them inactive and they’re still not really deleted because they show up in the list they’re just hidden so you can always activate them again now if you notice over here it says make active that’s how I go back and activate my customer again I’m gonna click make active and now you’ll see over here it does not say deleted but notice the sub customer does you’ll want to repeat that process with your sub customer select them from the left and make them active and that’s a quick overview of how to make your customers inactive well let’s move on we’ve got one more thing to cover in this particular module I want to talk to you in section 6 about importing an existing list of customers that you might already have into QuickBooks the last thing I want to talk to you about in module 4 is how to import your customers into QuickBooks you might already have a list of your customers in Excel for example or in a CSV file and it’d be really nice to be able just to import them into QuickBooks instead of having to enter them one at a time you will need to set them up a certain way I want to go ahead and pull up the excel file that I have so you can see how it’s set up and even if you don’t have the fields the exact same you can map them once you go through this import process but let me go ahead and pull up the excel file and show it to you and then pull up QuickBooks and we’ll go through and import those customers here I have a list of three customers I’d like to pull in from this excel spreadsheet into QuickBooks and you’ll notice that I’ve got them set up by name company name email phone you can see the list here those are the names of the fields that are in QuickBooks that you want to pull the information into if you can set it up this way that’s the best way to do it but you can also map the fields if you want once you get inside QuickBooks but I wanted you to see this so that you would know exactly how to set it up and make sure you save it somewhere that you can pull it in pretty easily when you go to look for it let me go ahead and flip over to QuickBooks and we’ll pull in John Ellen and Doris all you need to do is make sure you’re in your customer list and go up to the down arrow next to new customer and choose import customers here’s where you’re going to select your Excel or your CSV file that you currently have your customers in minds call customer list and I’ll just choose that and you can see it brought that file in now all I have to do is click Next at the bottom and here I can map my fields to the fields that are in QuickBooks you’ll notice the first column are the names of the QuickBooks fields and over here will be the names of the fields you had in your file if the names don’t match exactly like this one says name but maybe in your Excel spreadsheet this one said first name for example then you would choose it from the down arrow if there’s not a match like company for example when I look in my excel sheet I did not have one company then I’ll just say no match and it won’t be able to pull anything in the ones with the checkmark that you see are the ones that actually have a match to the QuickBooks fields that sees the exact same name that it sees over in your Excel spreadsheet in this case once you’re finished going through that list you want to go ahead and click Next at the bottom and you’ll see that there are three customers now that are ready to be imported if I had a lot of these I could go in and search for these by filtering and typing in the name of that customer it’s going to be pulling in the ones that have the check mark next to them I’m go ahead and import all three of those I’ll just choose import at the bottom and now you’ll see that it’s brought in those three customers let’s look first of all for mr. Stewart we’re gonna go down the list here and you’ll notice that here is John Stewart he was the first one on our list it has now imported all the information was in that excel spreadsheet well that’s going to wrap up module four where we’ve talked a lot about customers now that we have our customers in we can move over to module five and talk about sales transactions using these customers hey there we’re working now in module five and in this module we’re looking at all the different types of sales transactions that can occur when working with customers these are going to be things like are you invoicing customers are you receiving payments from those customers maybe making deposits credit memos things like that before we get started over in section one I want to go through very quickly with you the sales tab that’s in QuickBooks and show you an overview of how it works and what type of information you can get out of it let’s go ahead and flip over to QuickBooks and we’ll look at the sales let’s give her to our navigation bar and point to sales and then I’m going to click on overview this is just a quick overview of your income over time you can see that I’ve got two hundred and twenty dollars that it looks like I made this month and I made that the week of February 16th through 22nd notice I can actually point right up here as well and see that information if I wanted to change this and see how much I’ve made this month this quarter for example you can see last year this year you’ve got different choices here I’m going to go ahead and choose last month and it looks like last month we brought in over $7,000 and you can see the high points of when you brought in the most money in this case January 19 through 25 down here I can see how many invoices are overdue and also the ones that I’ve already sent out that are not due yet and that’s three thousand nine hundred and seventy-six dollars I might also have some money I’ve received that’s not deposited yet and you can see that here and also I can see the amount that I actually did deposit over on the right here these are some things that you can opt to set up with QuickBooks and some of these are paid subscriptions but if you want to set these up you’ve got different ways customers can pay you that would be Apple pay if you want them to be able to pay you direct deposit things like that you can set those up with Intuit you can also set up to get paid anywhere so if you have an app you’ve downloaded to your phone you can accept payment right there or you can send out an invoice to your customer that they can pay online they can actually click that invoice and then pay you right then and there like I said some of these are paid you will want to look into those before you sign up with one of those subscriptions if you’re interested in learning how the QuickBooks payments allow you to get paid online or in person you can watch this video here and then they have some shortcuts to some of the things we’re going to be talking about as we go along right down here but this is a quick overview of your accounts receivable now notice the next tab over will show all of your sales here you’ll see all the information on any sales transactions you can see all the transactions listed at the bottom so you’re going to see invoices payments credit memos if you look down the list here’s a time charge there’s a sales receipt or refund any transaction that happened with your customer is going to be on this list you’re going to see all the information about the transaction the balance the total and all the way over on the right you can take an action related to that particular transaction if you click the down arrow notice that you can either copy this you might want to delete it you might want to send a reminder you kind of see your choices there the next tab at the top that you’re going to see are your invoices these are just invoices that are not yet paid you’ll notice it shows you all the information about each of the invoices the balance the total if it’s overdue maybe not sent or if it’s partially paid you can see some of these and then of course here’s your actions again if want to take one of these actions related to one of these invoices the tab that’s next is your customer tab and we’ve spent a lot of time on that and the last tab says products and services products and services are things that you either buy or sell to your customer they can be a physical item it could even be inventory or just a service you provide and you can see for all of these that you can look at all kinds of options related to whatever is underneath that particular tab that gives you a quick overview of how to use the sales option what I want to do now is take you back and let’s go ahead and get started looking at how to actually create sales receipts for those customers that want to go ahead and buy something and pay you at the same time when you make a sale to a customer there are a couple different ways to record that sale one way is to create what’s called a sales receipt this is almost like point-of-sale if a customer comes in makes a purchase and gives you the money right then you can put all of that on one transaction and send them on their way with a receipt the other way that we’re going to talk about in section 3 is actually invoicing customers and that’s where you send out an employees and the customer pays you after the fact but right now let’s focus on sales receipts let’s flip over to QuickBooks and I’ll show you how to enter sales receipt you want to start by going to your customer list look down the list and find your customer and the sub customer that you’d like to send a sales receipt to if you’re using sub customers always pick the sub customer if you just pick the main customer what will happen is you’ll look at reports and you’ll see other and you won’t know what that refers to so just make sure you always choose the sub customer notice when I go all the way to the right here and click the down arrow I have an option to create a sales receipt the first thing you’ll notice is that it brought in the customer and the sub customer you chose if you want to change those you can actually pick those from the drop-down list the next thing you’ll see is a place to put in the email if you want to email this to more than one email address notice that you can type them both in here but just separate them with a comma and if you need to cc or BCC some additional email addresses you’ll see those here there’s also our check box that says send later that’s because you have the ability to set up the sales receipt and not actually send it right now it could be that you’re not really sure of the quantity but you want to go ahead and get this set up and saved you could do that you’ll see abroad in the billing address and it also has the sales receipt date which would be the current to date if you want to change this date you can just click the little calendar like I did and change the date now in this case they’ve customized this sales receipt to have an additional field that says crew number if you wanted to plug something in there you would just type in the number for that crew or not use it at all and we’re going to come back to the payment method in a moment let’s go down to product slash service if you click your mouse in the first area there you’ll see that there’s a drop-down list of all the products and services that you sell your customer if I go down this list you’ll see there are rocks these are garden rocks and if I choose that it will bring in a description and I can edit the description or add to this as much as I like I can cover to the quantity and put in how many of these the customers purchasing and the rate will say we sell these for $25 notice when I tab through it it’ll do the calculation three of these at 25 cost $75 and this is subject to sales tax typically physical items are but services you provide are not the little trashcan that you see at the end would allow you to delete this line now let’s say I’m going to add one more to this I’m going to go down and pick a service let’s say that we have design services and I’ll just put this over in the description and then I’ll say the quantity is 1 and we’re going to charge $100 this and notice this one is not automatically subject to sales tax I do have a third line available if I want to put something else in here if you don’t see an available line click where it says add lines and that will give you a line to type in notice you can also clear out all the lines if you wanted to do that right underneath it you have a message that will be displayed on the sales receipt it currently says thank you for your business and have a great day but you can put anything you like in there and also if you wanted to put a message and have to display those statements you could put that in here and just type it in over the right you’ll see it shows us our subtotal you can see that $75 of it is subject to sales tax and in this case they’re using a sales tax called California and it’s 8% six dollars in this case if you want to give your customer a discount you can get them a percentage discount or a value meaning a dollar amount let’s say I want to give them 10% I’ll just type in 10 with a % and notice it deducts 18 cents and if I scroll down it’ll show me the amount received and the balance due now remember because this is a sales receipt we’re going to put on this the payment amount they’re assuming we’ve received all of the payment back up here’s where I can choose the payment method if they paid me with Visa or if they pay me with a check I can pick any option I like and there’s a little place for a reference number now if you had a Visa card you wouldn’t have a reference number with a check that would be a check number the next thing you’ll see is deposit – and it says undeposited funds your other choices would be to go ahead and deposit this – maybe a checking account for example you can see the list let me explain undeposited funds for just a moment in your chart of accounts you will have an account called undeposited funds this is a place where money sits that you’ve collected but you have not yet taken to the bank a customer came in paid you with a check you want to show QuickBooks the sales is paid so you’ll choose deposit to undeposited funds but it might be that you’re gonna collect all the monies you receive today and make them all one big deposit that’s when you choose undeposited funds if you knew this was the only thing that was going to be in this deposit you could choose checking and skip the next step of making a deposit I’m gonna go ahead and leave it in undeposited funds and when you’re finished down at the bottom you’ll want to either just save this or you can choose save and send which will email it or from the down-arrow you can say save and close we’re going to close this and now that transaction has been completed you’re going to notice when we look at this that Tom Allen 124 Scottsdale does not owe us any money however if we go over to the all sales and look here we should see Tom Allen’s sales receipt right here for a hundred and eighty dollars and 82 cents and it says it’s paid here’s where we could go and actually print this I want to view or edit this you’ll see here that this is your sales receipt where you can make that change if you need to I’m gonna go ahead and get out of this I’m gonna hit the X and cancel it and that’s how you would go in and actually create a sales receipt that money is now sitting in undeposited funds I want to take you over to your chart of accounts which happens to be over here under accounting and show you that account so that you can see the money there let’s see our chart of accounts and here’s undeposited funds now you can see it has two thousand two hundred and forty-three dollars in there but if I view the register over here you’ll see the transaction that we did and also which is right here any others that were already sitting in undeposited funds so hold that and when we talk about making deposits in section five you’ll see how this all comes into play but one way to keep a check on yourself is if you know everything’s been deposited then there shouldn’t be any money in undeposited funds okay let’s go ahead now and go over into section three and talk about invoicing customers we’ve talked a little bit about sales receipts and now let’s talk a little bit about sending out invoices to your customers remember the difference in a sales receipt and an invoice is that on a sales receipt the customer is standing right there you’re going to put in the line item they purchased you’re going to put in they made a payment the invoice is where you’re going to send an invoice to your customer and wait for payment at a later date sometimes you email these sometimes you mail them it really doesn’t matter you’re going to receive the payment at a later date let me show you how to create invoices for your customers it’s very similar to the sales receipts but I want to show you where to go to get started creating invoices there are a couple of different ways to get started creating an invoice you’re going to head over to the navigation pane and point to sales you can either use the invoice option here or the customers if you choose the invoices option here you’re going to see a list of all of your invoices that you currently have and if you want to create a new one you can choose new invoice from right here if you started with the customers you would just come back to sales and go to customers this way then what would happen is if you had a customer you want to create an invoice for you could check them off head all the way to the right under the action column and then you can create an invoice this way either way would work whatever works for you you’ll notice this way because I had a customer selected it pulled in all that customers information now if I want to change that I just click the down arrow and choose the new customer from the list remember I told you that if you’re using sub customers always always always pick the sub customer you want to go with the lowest level so that when you look at reports you don’t see other on your reports I’m going to start with Freeman Sporting Goods I’ll choose 55 twin lane and now you’ll see it’s changed the customer email and the billing address if you didn’t have an email setup in your customer setup then you could physically type an email here you can also choose to be cc or CC someone just by choosing this option and putting their email addresses in here I’m going to hit cancel you can also send this later if you have this checked that means that you can create this invoice and then save it and then create another one and check the same box if you’ve done that you can email both of them at the same time that’s called sending a batch or emailing a batch if you happen to see that something’s changed at the billing address go ahead and change it here it’ll prompt you when you go to save it and ask you if you want to save this permanently in their record because we had terms of net 30 setup in the customer setup you’ll notice the invoice date is 212 but the due date is 313 which is 30 days from the invoice date if I change this to net 10 you’ll see the due date is 10 days just make sure the due date is the date that you want the invoice to actually be due to you the crew number is a field they custom setup for this particular exercise you can go ahead and plug in some numbers just to keep it consistent there and then you can pick a product or service from the list to invoice your customer I’m going to choose installation and let’s say that I’m going to charge them a quantity of one at $200 remember a service is non-taxable so you will not see a green checkmark there if you happen to see one just uncheck it and if you have a second line you’re just going to type on the second line whatever information you want to invoice the customer for here’s where you have your message that will appear in your invoice automatically you can type in there and change that to anything you like also when you’re sending out a statement to your customer then you can have a message on that statement appear as well whatever you typed in here you’ll notice that you can also put in an attachment let me scroll down just a little bit so you can see that if you happen to have some sort of file that was already saved in your computer you could attach it here an example might be if I’m installing landscape design I might have hired a subcontractor to do that and maybe the subcontractor has already sent me a bill and I want to attach that to this invoice over on the right if you’re going to give your customer a discount you can give them a percentage discount or a value discount I’ll choose value and give them $25 and you’ll see it will deduct it from my 200 so now that the balance due is 175 couple of things at the bottom you’re going to be able to do you can print or preview this right here you can also make it recurring and what recurring means is if this is something that happens on a regular basis then you can set QuickBooks up to automatically just put this in whenever you’ve told it to let’s say once a month it inserts this invoice automatically and then you can customize this a little bit if you want to do things like they added the crew number you’d be able to add fields like that at the bottom you have an option that says save you have your save and close’ and if you wanted to create a new one you could click the arrow and choose save and new I’m going to choose a save and close though and you’ll see now that our invoice has been completed if I wanted to go back and look at this I can actually come up here to invoices and then I can look down this list and find the one I’m looking for and that’s how you’re going to create an invoice for a customer let’s go ahead and move on into section 4 and I’ll show you how to record the payment once a customer actually pays you now that you’ve created your first invoice the customer is going to mail you a payment at some point now it doesn’t matter how the customer paid you you’re going to record their payment the same exact way we’re going to go in and tell QuickBooks how much the customer paid the date they paid all the pertinent information and when we’re done we’ll see that the invoice will show as being paid if they’ve paid the full amount if they haven’t it’ll show the balance or if it’s an overpayment it will show that as well let me show you how to record a customer payment before we receive our first payment I’d like to take you over to the report section QuickBooks just head over to your navigation bar click on reports and the reports from the menu and this is all the reports that are in QuickBooks we are going to take some time in a later module and look through the different reports but right now I’d like you to head down to a section that says who owes you these are your accounts receivable reports if you head over to the second column you’ll see the second one is called the open invoices report and you can just click to run that one now these are all of the invoices that you’ve sent out that have not yet been paid even if the customer owes you a penny if you remember in the previous section we actually created an invoice for Freeman Sporting Goods and we did one for 25 Twin Lake and here it is right here 175 dollars I want you to notice that in any report if you want to go to that particular transaction you can see this is a link and you can just click anywhere and actually open up that invoice I wanted to show you this first because once we receive our payment this invoice will actually disappear if it’s paid in full or you will see this invoice and the balance is owed right over here not the hundred and seventy five dollars that it originally was invoice for now that you see that let’s head back over to our customers we’ll go to sales and we’ll go down to customers now let’s go down and find our customer we’re going to receive the payment for and this is going to be Freeman Sporting Goods 55 twin Lake you’ll notice over in the action column that you can receive a payment this is the received payment window and the first thing you’ll notice is it pulled in my customer in my job I don’t need to change that unless I happen to want to pick a different customer and job I can look for an invoice by invoice number if I want to I can click there just type in the invoice number and hit find and it will search for it for me the next thing is the payment date I’m going to say this was received on February the 28th and here’s the payment method now here’s where you can pick the way that the customer actually paid you did they pay you with cash did they pay you with MasterCard Visa PayPal if you happen to take other payment methods you’d like to add like venmo or square or even Bitcoin just come up here to add new and all you have to do is type in that new payment and then just hit save and from now on that payment method will actually be on the list there now I’m just going to say in this case it was a check though and I’ll put it in the reference number that would be the check number and then just notice the money is going to go to an account called undeposited funds now hold that for a moment we’ll come back I want to finish the rest of this and explain this part to you now over here it assumed that my customer paid me the entire balance they owe for all of their invoices and we know that’s not always the case here I’m gonna put in the amount that the customer did pay me let’s say the customer paid me a hundred and seventy nine dollars now if you notice down at the bottom these are all of the invoices that are still open even if the customer owes me a penny you’ll notice what QuickBooks does is assumes the customer is paying all of the first one the rest of the money goes to the next one and then the balance of the money goes down to the next one all the way down now that’s not always how the customer has asked you to apply their payments let’s say in this case they’re not paying the first one they’re paying one hundred and seventy five dollars on this last one and they’re gonna pay the four dollars on this one and that’s why it was a hundred and seventy nine dollars always make sure that you have the correct invoices checked off and their correct amount over here that the customer is paying towards each of the invoices a couple of other things to notice when you look down at the bottom there’s going to be a hundred and seventy nine dollars worth of money that’s applied and there’s no credit memos right now but if you had one you had issued for this customer then you can apply that credit memo to one of these employees that would be open here if you want to clear the payment you could that would let you start all over filling this form out and the notice at the bottom there’s a place for a memo over on the left and there’s also a place where any attachments if you wanted to add something here and that’s all you need to do to receive payments it’s pretty easy process but I do want to go back up to this right here with sister – and talk to you about what your options are currently if you receive payments the money’s going into this account called undeposited funds I’m going to go ahead and save this real quick and then I want to show you where undeposited funds is and then we’re going to come back in a second so I can show you where your other options are now if I close the receive payment window and head back to the chart of accounts I’m gonna go down here to accounting chart of accounts you’ll notice that if I go down the list there’s this account called undeposited funds currently there’s two thousand two hundred forty one dollars and fifty two cents in that account this is where money sits that you’ve received but have not yet deposited into the bank a good way to keep a check on yourself if you know that everything’s been deposited this should be zero let’s look at this for a second and see if we can figure out what money happens to be sitting in here notice you can click to view the register over on the right and what you’re going to notice is that right now it looks like there are three payments sitting and undeposited funds one of them is being the one that we just received none of these three are in the checkbook yet because they have not yet been deposited okay so let’s head back over to our payment that we just looked at I’m going to go to sales and go back to customers and let’s go down and find our customer Freeman Sporting Goods 55 Twin Lake and I’m just going to click on that for a moment and here you will see the payment that we just received I’m gonna go ahead and click on that just to open it back up here were your other choices I could go ahead and put the money right in the checking account and this will skip the next step that we’re going to do but let me tell you why you may or may not want to do this if the hundred and seventy nine dollars is the only thing that’s going to be in that deposit then you can click checking hits save and close at the bottom and you are done with the whole process but if you think you might receive another payment possibly from another customer and this one and the new payment are going to be together in the same deposit that’s when you want to pick undeposited funds and this will make more sense once we go through and make the deposit over in the next section but I’m going to go ahead and click Save and close at the bottom here and let’s see if that invoice shows that it’s been paid when I go down the list and look at the invoice for 175 dollars it does show that it’s been paid in full if there was one penny left it would not say paid right here that’s how you receive a payment for a customer when you’ve sent out an invoice the next step in the process would be to actually take that money and make a deposit why don’t we head over into section 5 and I’ll show you how to make deposits now that we’ve made a sale for our business we’ve actually invoiced a customer in this case we got paid and now we want to take that money and put it in the bank and that’s where the make deposits option comes in it’s always going to be the last step in this process no matter how you receive the payment whether it is a Visa card cash a cheque you’re going to have to make deposits and you want to make sure that your deposits and quickbooks match what actually happened at the bank let’s go ahead and flip over to QuickBooks and talk about the make deposits option the easiest way to record that deposit is to click the new button right here and over on the right here under other you’ll see bank deposit this window here is going to be your actual deposit slip a couple things you’ll want to double check on is make sure you have the correct bank account chosen here it’s very easy to have the bank account that you last use show up in that field and then you can’t find your deposit notice that the balance in the checking account is one thousand two hundred and one dollars and this is the date of the deposit let’s say I’m going to make this deposit on March the second now down at the bottom these are the three sets of monies that we saw they were sitting in undeposited funds what you’re going to do is check off all of the ones that are going in this deposit if all three are going to be in this deposit you check them all off if maybe the first two we’re gonna be in that deposit and then maybe this last one was in a separate deposit do them separately because you want these to match what actually happened at the bank let’s say in this case though all three are going to be deposited a couple of things when you’re looking at this list here you can go and change the payment type if you didn’t do it when you were actually receiving the payment you’ve also got a place for a memo if you’d like to fill that in and then you can see there’s the reference number column and then the amount column over on the right my deposit will be two thousand two hundred forty one dollars and fifty two cents now right down here it says cashback goes to if you happen to have a business bank account you’re not going to be able to get cash back but as a sole proprietor you could if you’re going to keep some cash then you would say cashback goes to this account and you would pick whichever account this went to you would also be able to have a memo and if you were going to keep 20 bucks you could type that in and it would deduct it from this total right up here there’s also a place to add funds to this deposit if I click this little arrow it’s gonna open up this part here and I can add some additional monies now this could be something like maybe you got a rebate from Staples you could type that in if that was the situation it would say received from Staples the account would be office expenses or office supplies pick whichever account you actually use when you purchased the items for that rebate and put it back to the same account you’ve got a place for a description the method and the amount of money it could be you’re also going to put some personal money into the business if that’s the case then the account you want to choose is that owner equity if your members talking about that in an earlier module but remember that everything that goes into a deposit is not always income to the business so make sure that this goes back to the correct account if you’re adding additional funds notice if you need more than the two lines you could add additional lines and have as many lines as you’d like here you can also add a memo to this deposit if you’d like or add an attachment down at the bottom and that’s all you need to do as far as making a deposit now couples just other options you could print this deposit out down at the bottom or make it recurring it could be that you have a customer set up on automatic draft where they actually pay you $1,000 a month let’s say and this would be that deposit lots of different scenarios there I’m going to go ahead and hit save and close down at the bottom and at this point the money is actually going to be in my checking account remember it’s two thousand to forty one fifty two now that whole process of invoicing a customer receiving a payment and making that deposit has been taken care of now let’s go look in the checking account and see if we can find it it just so happens that on the overview right over here where we are the checking account is here that is one way to link to it to look at the balance another way would be going down to accounting to our chart of accounts and just opening it that way any of this would work I’m going to go ahead and view the register when I look in the register you’ll notice that there’s my deposit right there notice it says split because it split amongst multiple line items in this case we had three different transactions that went on the deposit itself I’m gonna go ahead and cancel that and that’s the process of actually making a deposit the next thing I want to do is take you over into section six and show you how to set up credit memos for customers there are times when you will want to issue a credit memo to an invoice let’s say you have a customer that just isn’t happy with your services and they refuse to pay one of your invoices you can actually leave it on the books for awhile if you’d like but eventually you might want to credit that off let me go ahead and show you how to create a credit memo the first thing that you want to do is look up the original invoice and see what it is that you charge them for to begin with I’m going to look at Red Rock diner and you’ll see there’s an invoice for $70 here I’ll just go ahead and open it up and you’re going to notice that we charged them for pest control it looks like probably two hours at $35 an hour for total of $70 now let’s say the customer just wasn’t happy with us and we’re going to just credit that invoice when we create the credit memo we need to use the exact same product or service that we charge for to begin with the way you’re going to create the credit memo is come up here and click on new underneath customers you’re going to see credit memo plug in the customers name in this case it is Red Rock diner you’ll see it populates their email their billing address and it’s going to have the current date for the credit memo date just make sure you put the date that you would like we’re going to be looking at tags over in section nine let’s just hold that for a moment and let’s go down to product or service here’s where we’re going to put in pest control remember you want to credit the same product or service that you invoice for to begin with we’re going to choose the quantity of two at 35 and that’s going to give us a total of 70 all we have to do now is go ahead and go down to save and close now that the credit memo has been created I want to show you two things that happen on your customers account notice here’s the credit memo and it says it’s closed and then there’s a payment that wasn’t there before now this payment is where you’re going to go to actually apply the 70 dollars to the correct invoice because see how the invoice is still open over here I’m going to click on the payment now if it sees an exact to match it we’ll go ahead and check it often but if it doesn’t come down and choose the correct invoice and then notice the credit memos at the bottom so you want to make sure those two are checked so they apply to each other so you’ll notice down here the amount to apply is $70 and that’s all we have to do we’re going to save and close at the bottom and because this transaction is linked to others it will ask us if we’re sure we want to modify this and the answer is yes and now when we go back and look we’ll see that the credit memo is closed the payment is closed and if the invoice is actually paid so remember this is a two-step process you have to create the credit memo they go back to the payment and actually apply that credit memo to the correct invoice now that you know how to create credit memos I want to show you over in section seven how to actually give your customers a refund there are times when you want to issue a refund to a customer and that would be if a customer has purchased something and paid in full and you want to actually give them their money back that’s the difference in a refund and a credit a credit usually sits in their account until you just credit the money off of your books whereas refunds you actually give customers than running back let me go ahead and show you how to create a refund we’re going to create a refund receipt but before we can do that we need to go ahead and look up our customer and see what it is that we’re actually going to refund them for this is Duke’s basketball camp if you notice they have an invoice here for four hundred and sixty dollars and forty cents that is paid in full I’m going to click on invoice to actually open this up and you’ll see that the second line are some garden rocks that they purchase from us they purchased six of them at twelve dollars and let’s say that they’re going to return three of them at twelve dollars because they didn’t need all six of these we’re going to go ahead and close this now and now we’re going to create our refund receipt we’re going to go over to the new option on the navigation pane we’re going to come down to refund receipt here we’re going to pick our customers name in this case it’s going to be Duke’s basketball camp you can see it pulls in their email and their billing address and we just need to make sure we have the correct refund receipt date down here which says payment method this is how the customer actually paid you they wrote us a check let’s say and we’re going to refund them from our checking account if you’re going to actually print them a check then it’s going to let you print this later or if you want to go ahead and print it from here you could leave that check number now let’s go ahead and put in the correct product or service and we decided that this was garden rocks and so we’re going to go ahead and choose that and remember they’re returning three at twelve dollars and that makes thirty six dollars if the item was subject to sales tax when the purchase was originally made then QuickBooks will automatically choose the tax option to give them their tax back as well you’ll notice this equates to thirty six dollars the total amount refunded will be thirty eight dollars and eighty-eight cents I’m going to go ahead and hit save and new at the bottom and now that refund receipt is done I’m going to click OK here what it says it was successful and now let’s go back and look at their account if I’m looking at Duke’s basketball camp you’ll see here’s the refund right here and you’ll notice that it says it is paid now if you want to actually go ahead and print a check then all you have to do is over here it says print check and you’ll notice that it automatically has Dukes basketball camp and a checked awaiting to be printed for thirty eight dollars and eighty-eight cents just double check that you have the correct checking account at the top and make sure you have the correct check number that your check is going to be now if you were giving them cash you would have chosen cash from the option back over in the refund receipt and then that would have just been done that’s really all you have to do at this point you can actually go down and you can preview and print this and then that will be the end of it there’s the preview you would hit print and it would print out and that’s how you create a refund for a customer it’s called a refund receipt let’s go ahead and take a peek now at creating statements for your customers one of the things you have the ability to do in QuickBooks is send statements to your customers a statement is basically a gentle reminder to your customers that they owe you some money typically statements are sent at the end of each month and they show the activity that happened during that month you don’t have to send out statements but it’s a nice little feature to keep your customers abreast of what’s going on with their account let’s go ahead and flip over to QuickBooks and we’ll see how statements are created when you’re ready to create statements for your customers just go to your navigation pane and choose the new option over here where you see other if you look down you’ll see statement the first thing you have to do is pick a statement type you can choose a balance for word any open items for the last gear basically and then you can also choose a transaction statement I’ll choose balance for word for the statement date you generally want to pick the end of the month that means that in this case the start date would be January 1 and the end date would be January 31 for the customer balance status you can choose all open or overdue I’m going to choose all and then apply and these are all of my customers who met the criteria they call this the recipients list if you’re looking down this list and you see one that you don’t want to send a statement to just come over here and uncheck the box now when you’re ready you can print or preview these down here in the middle I’m going to click on print or preview so that we can see what a statement looks like now I’m going to have one here for each customer you’ll see as I go down the list there you go and for each one you’re gonna be able to see all of the activity for January 1 through January 31 the first thing you’ll always see is the balance forward from the previous month notice up here tells you the total due and there’s a place where the customer can actually send you a check and if they want to type in the amount closed or write it in right there they can do that and then down at the bottom of the statement it shows you how much of this is in the currently due category how much is in each of these categories and then again the total over on the right and that’s what a statement looks like you can pick any date range you like when you’re creating statements if you just want to send one to one customer you can do that but that’s an overview of what statements look like and how they work I’m going to go ahead and close this and you really don’t need to save or save send us once you’ve printed these out you can go ahead and just X out at the top and then it’s ready and you can print them the next time well let’s go ahead now and look over in section 9 and talk a little bit about how a new feature of QuickBooks called tags is going to work there is a brand new feature in QuickBooks Online that they’re rolling out right now called tags and what tags will allow you to do is create certain words that will appear on a drop-down when you’re in different transactions in QuickBooks and you can choose those and later you can use those to search for things or to run reports based on those tags if you’re familiar with Gmail we’ve got something similar in there where we can create a list and tag different emails and then search for anything that would have that particular tag we’re looking for this is still in beta right now if you happen to not see it when you open up your QuickBooks Online and just know it’s coming they’re just rolling out in stages right now and you may not have all the options related to tags yet but just know it will be coming somewhere down the line let me give you an example of how you might use this feature currently we have a feature in QuickBooks called classes and we’ve kind of been using that in the way that tags will work but let’s say that you have an attorney’s office and you have four different attorneys in that office you might want to run reports on the company as a whole but you might also want to run reports on each attorney if you had this list of classes set up you could just pick from the drop-down list in each transaction you’re in which attorney that this should be tagged to and we’re going to use tags in the exact same way I don’t know if they’re going to get rid of classes down the road somewhere but tags are going to be a really nice feature so let me flip over and show you what’s in there now and like I said if you don’t see these options or you see something new down the road it’s because they’re rolling it out it’s still in beta the way you’re going to access your tags option is through the gear icon on the top right hand side of your Green and underneath the list right here you’ll see tags now currently we don’t have any tags set up but once we do set up our first tag you’re going to see the top of the screen change and you’ll see a section that says money in and money out let me give you an example of what we’re going to do with our tags this is a company called Craig’s design and landscape services they actually do two different things they do design work and they do pest control and as part of their design work they have three different areas they focus on they focus on fountains landscaping and sprinklers if I wanted to put my tags in a group then I can do that as well and you will see the group’s listed right here along with the tags but let’s start with just a tag I’m going to come over here and under new I’m going to choose tag and let’s say that I use fountains as my first tag if I wanted to put it in a group I could but I don’t have any groups set up yet so right now I’m just gonna hit safe at the bottom and now you’ll see my first tag called fountains and notice it’s ungrouped it’s not part of a group now here’s what I was saying a second ago about the money in and money out once I start applying these tags to different transactions I can come here and see the money in or out based on those tags I have now let me go ahead and create a group to show you how this works I’m going to create a tag group and I want to create a group called design and I’m going to create another one in a minute called pest control now you’ll notice that from this screen here if I wanted to add a tag I can do it right from here without having to go back out and hit new tag I’m gonna add two more because I have fans and I want to add landscaping and we’re also going to add sprinklers and I’ll just hit add tag there now let me go ahead and click done at the bottom and now what you’re going to see is design is a group and notice the down arrow in order to see the two tags in there I click the arrow and then I see those two now famines are still ungrouped if I wanted to add it to this design group I can come over here what says edit tag and then I can select the group I’d like it to belong to in this case design and when I save it now you’ll see design has three tags underneath now let me create one more tag group I’m going to create one called pest control and let’s say under pest control that I’m going to create two tags I’m going to create one for residential and one for commercial customers I’ll add that one then come back and add commercial and then add that and now I’m going to say done at the bottom and now you can see at the bottom I’ve got two different tags I’ve got one that’s pest control and one that’s design now the other thing is notice the color blue I can leave it like this but if you want each tag group can have a different color scheme going on if I come over here to edit the group you’ll notice that here I can change the color maybe this one can be this yellow color and I can save that and notice it also made all the tags below it that same color and that way they just stand out a little bit when I’m looking at different reports or things now let me show you where you’re going to use these tags or tag groups this will be in any transaction let’s say that I go over and I create a new invoice you’ll notice that in here you have an option that says tags you can choose from the drop-down list and you can choose more than one if you need to this might have fountains and it might also have some pest control and there’s your two tags that we’re going to be using now I will be able to look up reports based on the product or service but I can also look at the reports based on fountains or commercial now let me just go ahead and set something up here so you can see how this works I’ll pick Tom Allen we’re going to go down and pick for a product or service we’re going to go ahead and say this is and we’re gonna say one at $50 and then let’s see for the next one here we pick fountains we’ll do a rock fountain and that one was 275 now let’s say also we’re gonna do some pest control around this rock fountain so that we don’t have bugs in there and now we’ve got a couple of different products and services here now when I go ahead and click Save and close here we’re gonna go back to our tags and see if we have any money that’s in or out of these and now you’ll see that there’s three hundred and eighty two dollars money in because remember QuickBooks considers at the time you create the invoice it to be part of your income when you actually write a check use your credit card that sort of thing that will be on the money outside so if you had to actually buy some materials related to one of these and you tagged those transactions you would see the money out show up over here and that’s basically how tags are going to work it’s going to be a great new feature that’s really going to help you drill down a little bit deeper than you can now to see where your money is coming in or money is going out let’s go ahead and do one more thing in this module we’re going to look at some of the reports that have to do with your customers and sales QuickBooks has a ton of different reports related to your customers and your sales and I want to take you through and show you some of these different ones that you will want to run on a regular basis to see how your company is doing in these different areas let me go ahead and flip over to QuickBooks and I will show you a couple of these different reports I’m going to head over to the navigation pane and I’m going to click on reports there are several different categories of reports here but I want to focus right now on the one that says who owes you and then below it are your sales and customers underneath who owes you probably one of the most common reports is the open invoices right here which you’ve seen before and this is just a list of all of your customers who still owe you money even if they owe you a penny you’ll notice that it shows you all the information you need about the transaction like the date you can see the amount and if you’re on that line and you just point to any of these pieces of information you’ll see that you can click and actually go to that transaction if you actually change that transaction and then get out of it when you come back here as long as you’re safe the transaction the report will be updated another one I’m going to go back to reports that you’ll want to look at is going to be under who owes you customer balance detail this report will show you all the transactions that occurred for each customer and each job or sub customer when you first come in it might look like you’re just looking at the invoices anything open what you need to do is go up to the top right and choose customize come down to where you see filter and you’ll notice that where it says AR paid it says unpaid right now go ahead and choose all from the list and then run the report at the bottom and now you’ll see each transaction that happened for each customer sub customer end or job here I’m going to go ahead and go back to reports we’ll look at a few more here back down to who owes you there are some other ones that you might want to look at for example you might want to run a collections report this one is going to show you all of the information about the customer this time you’ll notice there’s a phone number here as well so if you needed to make some phone calls and call some of these people you’ve got that information right here on this report I’m going back to reports some other ones just to notice you do have the ability to run an accounts receivable aging detail and an aging summary anytime you see a summary and a detail the summary will show you the line item at one total whereas the aging detail will show every single option that made up that category or that line item that you would normally see you can see an invoice list here if you like you can see a terms list there’s a statement list just all kinds of things you can look at underneath who owes you now down under sales and customer here’s where you can run things like a customer contact list this is just going to give you each customer their phone number their email that sort of thing you can also go in and look at estimates by customer you might want to see if you have any income by customer you might want to see all your payment methods product lists and services your sales you can look at those by customer you can look at them by product and you can also look at them by time or activities so just know that there’s a lot of different reports under those two options right there now most of your reports can be customized if you happen to run for example a sales by customer detail you’ll notice that you can come up here and change the report period I can look at all dates and then I can hit run report and I’ll see all of the information for each customer I can group these by customer I can group them by product I’ve got all different kind of ways I can group this report and also something else to notice is that all of your reports are automatically run on the cruel basis not a cash basis and you can change it per report if you need to accrual basically means that as soon as you invoice a customer it’s going to show as income to your business in QuickBooks whether they’ve paid it or not if you had any expenses let’s say you entered a bill it would show it as an expense whether you paid that bill or not we’re gonna see how this really works when we look at a profit and loss a little bit later but let’s go ahead and just kind of wrap this up I just wanted you to see the reports that were available for customers and for your sales and most of them will be under these two headings let’s go ahead now and move over to module six and talk a little bit about products and services we’re just starting module six now and in this module I want to talk to you about how products and services work in QuickBooks a product or service is something that you either sell your customer or sometimes you purchase those products and services as well and you want to set those up and make sure you set the correctly so that you have accurate reports as far as inventory or as far as some of your profit and loss those types of things let’s go ahead and flip over to QuickBooks and start talking a little bit about how products and services work I’m going to give you a quick overview and then I’ll take you into section two and show you how to add some of those products and services to get to a list of your products and services go to the gear icon on the top right of your screen then underneath the list you’ll see products and services this is a list of all the products and services that you have set up remember that sometimes you buy these and sometimes you sell these and there are different types of products and services you can create you’ll notice currently minors sorted by type if I want to sort by any of these other columns I would click on the name and just sort by that column you’ll see there are services you provide like landscaping trimming you’ll see that there are different pest control those are all services you provide when you get past the service items you’re going to see that there are actual inventory items as well inventory means that you actually sell physical products and you count how many you have for example when I look at rock fountain you’ll notice that it looks like I have two on hand and I can buy more and add to my inventory or I can sell these and that will take it out of my inventory there are other types of items that you can have as well you can have non inventory items those are actually items that you don’t want to check them and you have in the back but they’re physical items that you either buy or sell you’ll notice when you’re looking at this list that you can see the name of the item if you’re using SKU numbers and we got those set up you’d be able to see that here the item type a description and this is the description that automatically appears when you pull that item onto an invoice or some sort of form in QuickBooks you’ve got the sales price if there’s one set up sometimes it’s different for every customer so they just don’t set up a price you just do it when you’re actually invoicing the customer or if you happen to buy this whenever you’re purchasing it if this item is subject to sales tax you would see that here if it’s inventory we saw that you can see the quantity on hand and the reorder point that basically means that when you get down to a certain number that QuickBooks will pop up and tell you you need to order some more and you can see that they did not set that up in this exercise the last column that you see is the action column here’s where you can edit to one of these items if you need to make it inactive adjust the quantity that you might have on-hand those types of things but this is where your list of products and services is going to live what I want to do now is show you how to set up some of these products and services so let’s head on over to section two so that you can see how to do that now that you’ve had a quick overview of what the products and services screen looks like I want to take you in and show you how to create your own products and services some of you may only have six or seven in your business other businesses might have thousands it just really depends on what your business does let’s go ahead and flip over and talk about how to add those new products and services the way you’re going to add a new product or service is head up to the new option in the products and services window the first thing you need to tell QuickBooks is what type of product or service is this that you’re adding is it going to be inventory inventory means that you want to keep some on hand and then have QuickBooks remind you when you get down to a low number so that you can order some more that’s called true inventory you can track how many you sold and how many purchased sometimes you don’t want to keep any in the back room and that’s what we call non inventory it might be a physical product that you buy or sell but you just run reports when you need to to see how many you bought or sold you don’t really need to keep any in the back room a service is a service you provide and then you have the OP take any of those three and put them into what’s called a bundle the example they use here is a gift basket of fruit cheese and wine you might actually add something else to that gift basket like a spoon or a cup or something like that and you can actually set those up as one of these three types and then you can create a bundle which includes those three items let’s go ahead for now and say that we’re going to set up a service the first thing we’re going to do is go ahead and give our service a name and I’m just going to call this maintenance you have the ability if you have SKU numbers for your products and services to put that number in here and also you can add a picture of that particular product or service from over here where this little pencil is this would have to be a picture that’s already in your computer and then you can go and grab and pull in you can also put your products and services in different categories there’s a few already created for the exercise but if you wanted to add a new category you could do that by hitting the add new option and creating a category like you see here they’ve got design landscaping and pest control as categories the next thing is the description when you actually put this on an invoice which means you’re selling this to your customer what is the description that appears let’s say that it says quarterly maintenance and then the next thing is going to be the sales price if you have a flat rate you charge for this then you can type that in and it will pre-populate for you but if it’s different every single time then you’ll want to just leave this blank nothing happens here it’s only when you buy or sell the product or service that numbers play into your reports but let’s just say that we have a flat rate of $250 a quarter we charge for this and then the next thing which is the most important thing on this screen is the income account that you want this money to go back to when you put this on an invoice in this case they’ve got it automatically going back to services income which is where I would probably leave it but if you wanted to put this in any other account feel free it’s just it needs to be an income account now if you don’t pick an income account QuickBooks will not say anything to you about it but you’ll look at reports and they’ll be really wrong and you can’t figure out why look at the word the word is income meaning it needs to go to an income account if this was a particular product or service that you were going to charge sales tax on then here’s where you tell QuickBooks this is a taxable product or service or non-taxable product or service typically services you provide are non-taxable and physical items you sell are taxable now if this happens to be a particular product or service that you buy from a vendor that you like you can check the box and put in the vendor information but I’m going to go ahead and uncheck that and click Save and close at the bottom and now you’ll notice that I have a new service in my list here it’s called maintenance and you can see all of the information all the way across now if I needed to edit that information I can click on edit here that will take me back to this screen and I can change whatever I need to and save and close again and then it will be updated you do have a couple of other actions you can take under this drop-down arrow here you can make this service inactive if you need to you can also run a report on this service or you can duplicate it that’s a quick way to go ahead and set up your new products and serve says now that you know how to set up a service let’s go ahead and look at setting up an inventory product that way you can see how to tell QuickBooks how many you currently have on hand and then you can see how inventory is added to or deducted from that number now that you know how to add new products and services and QuickBooks let’s talk specifically about adding inventory products true inventory means that you want to keep a count on how many of these products you have in your office you want QuickBooks to let you know when you get low so that you can order some more you’ll want to actually know how many you have on hand when you first set up your new inventory product and once you’ve done that then as you invoice customers that is how your products will get out of inventory and as you purchase them that’s how your products will get back into inventory let’s go ahead and flip over to QuickBooks and I will show you how to add an inventory product you’re going to add an inventory product the same way we added the new products and services over in section to go to the top of your products and services list and choose the new option this time we’re going to choose inventory the first thing you’re going to do is give your inventory a name I’m going to call this one sprinkler clamps and then we’re going to give it a SKU I’ll call this one 55 and then we’ll choose a category and let’s say in this case that we’re going to put it under landscaping now here’s where you put in the initial quantity on hand this means you’re going to do a count before you set up your product and if you have 10 in the back room you’re going to put that in here and that gives it a starting number you also want to have a date to start this with and let’s just say in this case that I want to go back to the beginning of February reorder point what this means is what number do you want to get down to before QuickBooks pops up and tells you that you need to order some more let’s just say in this case when we get down two three the next thing you’re going to see is inventory asset account now do not change this this is the account that the value of the inventory will actually go into in your chart of accounts remember that inventory is an asset to your business you are worth more because you have it right now but your goal is to sell it and get it out the door this is the asset account the inventory will sit in and then we’re going to put in a description now I would put in the same thing will for new sprinkler clamps and then if you have a set rate than you charge for this you’ll want to type this in if you don’t have one that’s different every single time then you can just leave a blank let’s say that we sell it for two dollars and seventy five cents you don’t want to change this either because this is the income account that this will go into when you make a sale when I put sprinkler clamps on an invoice and I sell this it will go into the sales of product income account if this is a taxable product you’ll want to make sure that this says taxable and now we have the purchasing information this was the selling information up here this is when you purchase it down here the first thing it asks for is a description when you order this from whatever company you order them from what is their description and sometimes it’ll be the same other times it might have a part number at the end there’s just all kinds of different things that this could say what is the cost and this means on average what do you buy it for it does not mean that the last time you purchase this it was a dollar seventy-five let’s just say on average though it is a dollar seventy-five and it will go to an expense account called cost of goods sold if you have a preferred vendor then you can pick them from the list here it could be that you like to get these from Hicks hardware and that’s all you need to tell it I’m going to go ahead and click Save and close at the bottom and now I should see my sprinkler clamps right here you can see the SKU number we typed in the sale price the cost there’s ten of these currently and when we get down to three it’s going to pop up and ask us if we want to order some more don’t forget you have some options over here under your action column if you wanted to go into just the quantity maybe you discovered there’s really only nine in the back room you’ll be able to do that you also have the ability to adjust the starting value and that’s really all there is to adding inventory products let’s go ahead now and move over to section four and talk a little bit about purchase orders if your company buys a lot of products you might want to create a purchase order system for your business when you do this it’s a way of actually tracking everything you have ordered and that way you can see what’s come in if there’s anything back ordered that sort of thing and this is also going to be a way to start the process of receiving your items into inventory let me go ahead and show you how to create a purchase order before we get started there’s a couple things that you need to know first of all if you’d like to use the purchase order feature in QuickBooks you have to be enrolled in the QuickBooks Online Plus edition that’s the Edition that actually handles purchase orders the other thing is you’re going to have to actually turn on the purchase order feature in the account settings let me show you where to go for that you go up to the gear icon you’re going over to accountant settings make sure you’re clicked on expenses and here’s where you see purchase orders if this is not on just come over here to this pencil and then make sure you check the box here to use purchase orders as long as that’s good then you should be fine I’m going to go ahead and close with the X and let’s go and look real quick at our products and services because I want to show you how we’re going to order some more and put it into our inventory I’m going to click on the gear icon under the list the second column I’m going to click products and services if you remember we talked about some of these being inventory and one of these that I want to talk about right here is going to be this rock fell now let’s say we have two of these but we’re getting ready to do a new job and we need to order two more to have a total of four this is what we’re going to order to create a new purchase order I’m going to go to the navigation bar and click on new I’m going to go down in the second column and click on purchase order and the first thing I need to do when creating a purchase order is to pick my vendor I’m going to go down the list here and we’re gonna pick Hicks hardware if you had Hicks hardware’s email it would be pulled in right here you can see there’s the mailing address and then let’s talk about the ship – for a second if you want to have Hicks Hardware ship these directly to your customer you can choose your customer from here if not then it’s just going to come to your office you don’t need to choose anything there here’s the date of your purchase order and in this case they’re using the crew number field so we’re going to plug something in there you can also set a ship via which would say USPS FedEx you can also set a sales rep if you had those as well now looking down the list you want to use the item details not the category details here and remember we’re getting ready to order some more rock fountains now let’s take the other ones out of the list we’re just going to go ahead and click the little trash can over on the right and I want to get two of these so that I have a total of four when I’m done again if it’s related to a particular customer you’ll want to plug that information in right here if you were ordering other things as well you can go ahead and put all of these in here you have a place to put a message to your vendor a memo and at the bottom some attachments once this is done you’re going to go ahead and send this over to your vendor I’m going to go ahead and say save and close and that’s how that works if you have the vendors email address you could have emailed this directly to them other than that maybe you called them on the phone and ordered it but you do have your Pio in here now so that whenever you go to receive these items you have something to receive it against that’s how you actually create a purchase order the next step in the process is that your products actually come in and you’re going to go in and receive those products into your inventory let’s go ahead and head over to section 5 so I can show you how that works now that you’ve created a purchase order you can actually receive the items into your inventory the logical process is that once you order the items from your vendor they’re going to come in the next week 10 days probably and you’re going to want to receive them into your inventory let’s go ahead and flip over to QuickBooks so I can show you how that process works let’s head back to our products and services for a moment I want to show you that if we go down and look at rock film we still just have two and that’s because all we’ve done at this point is order two more once we get through going through this receiving products into inventory feature then you’re going to notice that this number will go up to four all you have to do is head over to the navigation bar and click on new and we’re going to create a new bill the first thing it asks you is who is your vendor and this is where I’m going to pick Hicks Hardware and you’ll notice as soon as I do that that this little window pops up over on the right and this is letting me know that I have an open purchase order if you want to actually add the items on this purchase order to this bill just click at and if you look down here it’s added the rock fountains it’s added two of them and it’s got a rate amount and everything we talked about here because this is an actual bill from the vendor we want to make sure that their rate and the amount and all of that is correct if there happened to be a sale and that’s why we had ordered two of these we would change the rate and of course the amount would change in that case going back up to the top you’ll see that it pulled in our mailing address for Hicks hardware we’re going to want to choose the terms that are on that bill we’re going to say thirty here’s the build date – meaning the date that it was actually printed and the due date meaning the date it was actually due we’ll also want to plug in our bill number over here and that’s really all we need to do there’s a place for a memo down on the bottom left we can add attachments if we want and when we’re finished we’re going to save and close now let’s go see how many we have in inventory now and if we’re looking at rock fountain we have four of those and that’s one of the ways that things get into inventory through a purchase order now we’ll be looking at some other ways things get into inventory it could be you’ve written a check it could be that you’ve actually gone in a debit card but this is a way of creating an order and then receiving that order I want to go ahead and look at the last section in module six here I want to look at some reports related to product and services and then we’ll be done with module six the last thing I wanted to do with you in this particular module is go through some of the reports related to products and services there are a ton of reports in here I want you take some time after watching this video and just go back through some of the ones that we didn’t talk about just to see what’s available we’re going to go ahead and flip now over to QuickBooks and I will show you how to get to those product and service reports you want to head over to your navigation pane and click on reports if you had saved some of these as your favorites they would show up at the top here but let’s scroll down until you see a heading that says expenses and vendors here are your purchase order reports right here one is a list and one is the purchase order detail let’s start with the list you’ll notice these are all of the open purchase orders and they’re listed by vendor if you’ve already received your items from the purchase order it’s not considered open anymore and it won’t show up in this list you’ve got a couple of options up here right now we’re showing purchase orders for all the dates which is what you want and they’re grouped by vendor you can also come over here and customize this a little bit if you wanted to actually look at some filter options you can go down the list and show just specific vendors or if you want to see all vendors we’ll go ahead and choose all from the list and you can see these other options here as well I’m going to go ahead and run the report and I get the same one because I was looking at the open purchase orders all of them now let me go back to the reports list and show you the difference in that one and what we call the open purchase order detail this one here I’m going to change the dates because look how there’s nothing in the report because it’s only reflecting March first but if I choose all dates and then run the report now I can see the purchase orders that are in here and the details about each one and what that means is it’s going to show me every line item in that purchase order I’m grouping this currently by product or service I might group them by vendor and run that report and of course there’s only one and then also I have the same customized options that I showed you just a minute ago if you wanted to choose some filter options you could if you wanted to go down and choose some options for the header and footer which is this area up here you could edit that and then you could run the report once you’ve made your changes now let me go ahead and go back to the report list I want to just mention some other ones here that don’t have to do with purchase orders but you are going to see that if you want to look at things like the purchases by vendor you could do that you might look at your purchases by product or you might look at a transaction list by vendor vendor contact list you can kind of see those reports there there are lots of these reports and you’ll want to run them on a regular basis just so you can see what’s going on and make sure you’ve done things correctly in QuickBooks well that’s going to wrap up module six where we talked about products and services let’s head on over to module seven and change focus and talk a little bit about vendors and expenses if you’re not a subscriber click down below to subscribe so you get notified about similar videos we upload to get a free QuickBooks Online essential keyboard shortcuts infographic click over there and click over there to watch more QuickBooks videos from Simon Says it

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Data Science and Machine Learning Foundations

    Data Science and Machine Learning Foundations

    This PDF excerpt details a machine learning foundations course. It covers core concepts like supervised and unsupervised learning, regression and classification models, and essential algorithms. The curriculum also explores practical skills, including Python programming with relevant libraries, natural language processing (NLP), and model evaluation metrics. Several case studies illustrate applying these techniques to various problems, such as house price prediction and customer segmentation. Finally, career advice is offered on navigating the data science job market and building a strong professional portfolio.

    Data Science & Machine Learning Study Guide

    Quiz

    1. How can machine learning improve crop yields for farmers? Machine learning can analyze data to optimize crop yields by monitoring soil health and making decisions about planting, fertilizing, and other practices. This can lead to increased revenue for farmers by improving the efficiency of their operations and reducing costs.
    2. Explain the purpose of the Central Limit Theorem in statistical analysis. The Central Limit Theorem states that the distribution of sample means will approximate a normal distribution as the sample size increases, regardless of the original population distribution. This allows for statistical inference about a population based on sample data.
    3. What is the primary difference between supervised and unsupervised learning? In supervised learning, a model is trained using labeled data to predict outcomes. In unsupervised learning, a model is trained on unlabeled data to find patterns or clusters within the data without a specific target variable.
    4. Name three popular supervised learning algorithms. Three popular supervised learning algorithms are K-Nearest Neighbors (KNN), Decision Trees, and Random Forest. These algorithms are used for both classification and regression tasks.
    5. Explain the concept of “bagging” in machine learning. Bagging, short for bootstrap aggregating, involves training multiple models on different subsets of the training data, and then combining their predictions. This technique reduces variance in predictions and creates a more stable prediction model.
    6. What are two metrics used to evaluate the performance of a regression model? Two metrics used to evaluate regression models include Residual Sum of Squares (RSS) and R-squared. The RSS measures the sum of the squared differences between predicted and actual values, while R-squared quantifies the proportion of variance explained by the model.
    7. Define entropy as it relates to decision trees. In the context of decision trees, entropy measures the impurity or randomness of a data set. A higher entropy value indicates a more mixed class distribution, and decision trees attempt to reduce entropy by splitting data into more pure subsets.
    8. What are dummy variables and why are they used in linear regression? Dummy variables are binary variables (0 or 1) used to represent categorical variables in a regression model. They are used to include categorical data in linear regression without misinterpreting the nature of the categorical variables.
    9. Why is it necessary to split data into training and testing sets? Splitting data into training and testing sets allows for training the model on one subset of data and then evaluating its performance on a different, unseen subset. This prevents overfitting and helps determine how well the model generalizes to new, real-world data.
    10. What is the role of the learning rate in gradient descent? The learning rate (or step size) determines how much the model’s parameters are adjusted during each iteration of gradient descent. A smaller learning rate means smaller steps toward the minimum. A large rate can lead to overshooting or oscillations, and is not the same thing as momentum.

    Answer Key

    1. Machine learning algorithms can analyze data related to crop health and soil conditions to make data-driven recommendations, which allows farmers to optimize their yield and revenue by using resources more effectively.
    2. The Central Limit Theorem is important because it allows data scientists to make inferences about a population by analyzing a sample, and it allows them to understand the distribution of sample means which is a building block to statistical analysis.
    3. Supervised learning uses labeled data with defined inputs and outputs for model training, while unsupervised learning works with unlabeled data to discover structures and patterns without predefined results.
    4. K-Nearest Neighbors, Decision Trees, and Random Forests are some of the most popular supervised learning algorithms. Each can be used for classification or regression problems.
    5. Bagging involves creating multiple training sets using resampling techniques, which allows multiple models to train before their outputs are averaged or voted on. This increases the stability and robustness of the final output.
    6. Residual Sum of Squares (RSS) measures error while R-squared measures goodness of fit.
    7. Entropy in decision trees measures the impurity or disorder of a dataset. The lower the entropy, the more pure the classification for a given subset of data and vice-versa.
    8. Dummy variables are numerical values (0 or 1) that can represent string or categorical variables in an algorithm. This transformation is often required for regression models that are designed to read numerical inputs.
    9. Data should be split into training and test sets to prevent overfitting, train and evaluate the model, and ensure that it can generalize well to real-world data that it has not seen.
    10. The learning rate is the size of the step taken in each iteration of gradient descent, which determines how quickly the algorithm converges towards the local or global minimum of the error function.

    Essay Questions

    1. Discuss the importance of data preprocessing in machine learning projects. What are some common data preprocessing techniques, and why are they necessary?
    2. Compare and contrast the strengths and weaknesses of different types of machine learning algorithms (e.g., supervised vs. unsupervised, linear vs. non-linear, etc.). Provide specific examples to illustrate your points.
    3. Explain the concept of bias and variance in machine learning. How can these issues be addressed when building predictive models?
    4. Describe the process of building a recommendation system, including the key challenges and techniques involved. Consider different data sources and evaluation methods.
    5. Discuss the ethical considerations that data scientists should take into account when working on machine learning projects. How can fairness and transparency be ensured in the development of AI systems?

    Glossary

    • Adam: An optimization algorithm that combines the benefits of AdaGrad and RMSprop, often used for training neural networks.
    • Bagging: A machine learning ensemble method that creates multiple models using random subsets of the training data to reduce variance.
    • Boosting: A machine learning ensemble method that combines weak learners into a strong learner by iteratively focusing on misclassified samples.
    • Central Limit Theorem: A theorem stating that the distribution of sample means approaches a normal distribution as the sample size increases.
    • Classification: A machine learning task that involves predicting the category or class of a given data point.
    • Clustering: An unsupervised learning technique that groups similar data points into clusters.
    • Confidence Interval: A range of values that is likely to contain the true population parameter with a certain level of confidence.
    • Cosine Similarity: A measure of similarity between two non-zero vectors, often used in recommendation systems.
    • DB Scan: A density-based clustering algorithm that identifies clusters based on data point density.
    • Decision Trees: A supervised learning algorithm that uses a tree-like structure to make decisions based on input features.
    • Dummy Variable: A binary variable (0 or 1) used to represent categorical variables in a regression model.
    • Entropy: A measure of disorder or randomness in a dataset, particularly used in decision trees.
    • Feature Engineering: The process of transforming raw data into features that can be used in machine learning models.
    • Gradient Descent: An optimization algorithm used to minimize the error function of a model by iteratively updating parameters.
    • Heteroskedasticity: A condition in which the variance of the error terms in a regression model is not constant across observations.
    • Homoskedasticity: A condition in which the variance of the error terms in a regression model is constant across observations.
    • Hypothesis Testing: A statistical method used to determine whether there is enough evidence to reject a null hypothesis.
    • Inferential Statistics: A branch of statistics that deals with drawing conclusions about a population based on a sample of data.
    • K-Means: A clustering algorithm that partitions data points into a specified number of clusters based on their distance from cluster centers.
    • K-Nearest Neighbors (KNN): A supervised learning algorithm that classifies or predicts data based on the majority class among its nearest neighbors.
    • Law of Large Numbers: A theorem stating that as the sample size increases, the sample mean will converge to the population mean.
    • Linear Discriminant Analysis (LDA): A dimensionality reduction and classification technique that finds linear combinations of features to separate classes.
    • Logarithm: The inverse operation of exponentiation, used to find the exponent required to reach a certain value.
    • Mini-batch Gradient Descent: An optimization method that updates parameters based on a subset of the training data in each iteration.
    • Momentum (in Gradient Descent): A technique used with gradient descent that adds a fraction of the previous parameter update to the current update, which reduces oscillations during the search for local or global minima.
    • Multi-colinearity: A condition in which independent variables in a regression model are highly correlated with each other.
    • Ordinary Least Squares (OLS): A method for estimating the parameters of a linear regression model by minimizing the sum of squared residuals.
    • Overfitting: When a model learns the training data too well and cannot generalize to unseen data.
    • P-value: The probability of obtaining a result as extreme as the observed result, assuming the null hypothesis is true.
    • Random Forest: An ensemble learning method that combines multiple decision trees to make predictions.
    • Regression: A machine learning task that involves predicting a continuous numerical output.
    • Residual: The difference between the actual value of the dependent variable and the value predicted by a regression model.
    • Residual Sum of Squares (RSS): A metric that calculates the sum of the squared differences between the actual and predicted values.
    • RMSprop: An optimization algorithm that adapts the learning rate for each parameter based on the root mean square of past gradients.
    • R-squared (R²): A statistical measure that indicates the proportion of variance in the dependent variable that is explained by the independent variables in a regression model.
    • Standard Deviation: A measure of the amount of variation or dispersion in a set of values.
    • Statistical Significance: A concept that determines if a given finding is likely not due to chance; statistical significance is determined through the calculation of a p-value.
    • Stochastic Gradient Descent (SGD): An optimization algorithm that updates parameters based on a single random sample of the training data in each iteration.
    • Stop Words: Common words in a language that are often removed from text during preprocessing (e.g., “the,” “is,” “a”).
    • Supervised Learning: A type of machine learning where a model is trained using labeled data to make predictions.
    • Unsupervised Learning: A type of machine learning where a model is trained using unlabeled data to discover patterns or clusters.

    AI, Machine Learning, and Data Science Foundations

    Okay, here is a detailed briefing document synthesizing the provided sources.

    Briefing Document: AI, Machine Learning, and Data Science Foundations

    Overview

    This document summarizes key concepts and techniques discussed in the provided material. The sources primarily cover a range of topics, including: foundational mathematical and statistical concepts, various machine learning algorithms, deep learning and generative AI, model evaluation techniques, practical application examples in customer segmentation and sales analysis, and finally optimization methods and concepts related to building a recommendation system. The materials appear to be derived from a course or a set of educational resources aimed at individuals seeking to develop skills in AI, machine learning and data science.

    Key Themes and Ideas

    1. Foundational Mathematics and Statistics
    • Essential Math Concepts: A strong foundation in mathematics is crucial. The materials emphasize the importance of understanding exponents, logarithms, the mathematical constant “e,” and pi. Crucially, understanding how these concepts transform when taking derivatives is critical for many machine learning algorithms. For instance, the material mentions that “you need to know what is logarithm what is logarithm at the base of two what is logarithm at the base of e and then at the base of 10…and how does those transform when it comes to taking derivative of the logarithm taking the derivative of the exponent.”
    • Statistical Foundations: The course emphasizes descriptive and inferential statistics. Descriptive measures include “distance measures” and “variational measures.” Inferential statistics requires an understanding of theories such as the “Central limit theorem” and “the law of large numbers.” There is also the need to grasp “population sample,” “unbiased sample,” “hypothesis testing,” “confidence interval,” and “statistical significance.” The importance is highlighted that “you need to know those Infamous theories such as Central limit theorem the law of uh large numbers uh and how you can um relate to this idea of population sample unbias sample and also u a hypothesis testing confidence interval statistical sign ific an uh and uh how you can test different theories by using uh this idea of statistical”.
    1. Machine Learning Algorithms:
    • Supervised Learning: The course covers various supervised learning algorithms, including:
    • “Linear discriminant analysis” (LDA): Used for classification by combining multiple features to predict outcomes, as shown in the example of predicting movie preferences by combining movie length and genre.
    • “K-Nearest Neighbors” (KNN)
    • “Decision Trees”: Used for both classification and regression tasks.
    • “Random Forests”: An ensemble method that combines multiple decision trees.
    • Boosting Algorithms (e.g. “light GBM, GBM, HG Boost”): Another approach to improve model performance by sequentially training models. The training of these algorithms incorporates “previous stump’s errors.”
    • Unsupervised Learning:“K-Means”: A clustering algorithm for grouping data points. Example is given in customer segmentation by their transaction history, “you can for instance use uh K means uh DB scan hierarchal clustering and then you can evaluate your uh clustering algoritms and then select the one that performs the best”.
    • “DBScan”: A density-based clustering algorithm, noted for its increasing popularity.
    • “Hierarchical Clustering”: Another approach to clustering.
    • Bagging: An ensemble method used to reduce variance and create more stable predictions, exemplified through a weight loss prediction based on “daily calorie intake and workout duration.”
    • AdaBoost: An algorithm where “each stump is made by using the previous stump’s errors”, also used for building prediction models, exemplified with a housing price prediction project.
    1. Deep Learning and Generative AI
    • Optimization Algorithms: The material introduces the need for “Adam W RMS prop” optimization techniques.
    • Generative Models: The course touches upon more advanced topics including “variation Auto encoders” and “large language models.”
    • Natural Language Processing (NLP): It emphasizes the importance of understanding concepts like “n-grams,” “attention mechanisms” (both self-attention and multi-head self-attention), “encoder-decoder architecture of Transformers,” and related algorithms such as “gpts or Birch model.” The sources emphasize “if you want to move towards the NLP side of generative Ai and you want to know how the ched GPT has been invented how the gpts work or the birth mode Ro uh then you will definitely need to uh get into this topic of language model”.
    1. Model Evaluation
    • Regression Metrics: The document introduces “residual sum of squares” (RSS) as a common metric for evaluating linear regression models. The formula for the RSS is explicitly provided: “the RSS or the residual sum of square or the beta is equal to sum of all the squar of y i minus y hat across all I is equal to 1 till n”.
    • Clustering Metrics: The course mentions entropy, and the “Silo score” which is “a measure of the similarity of the data point to its own cluster compared to the other clusters”.
    • Regularization: The use of L2 regularization is mentioned, where “Lambda which is always positive so is always larger than equal zero is the tuning parameter or the penalty” and “the Lambda serves to control the relative impact of the penalty on the regression coefficient estimates.”
    1. Practical Applications and Case Studies:
    • Customer Segmentation: Clustering algorithms (K-means, DBScan) can be used to segment customers based on transaction history.
    • Sales Analysis: The material includes analysis of customer types, “consumer, corporate, and home office”, top spending customers, and sales trends over time. There is a suggestion that “a seasonal Trend” might be apparent if a longer time period is considered.
    • Geographic Sales Mapping: The material includes using maps to visualize sales per state, which is deemed helpful for companies looking to expand into new geographic areas.
    • Housing Price Prediction: A linear regression model is applied to predict house prices using features like median income, average rooms, and proximity to the ocean. An important note is made about the definition of “residual” in this context, with the reminder that “you do not confuse the error with the residual so error can never be observed error you can never calculate and you will never know but what you can do is to predict the error and you can when you predict the error then you get a residual”.
    1. Linear Regression and OLS
    • Regression Model: The document explains that the linear regression model aims to estimate the relationship between independent and dependent variables. In the context, it emphasizes that “beta Z that you see here is not a variable and it’s called intercept or constant something that is unknown so we don’t have that in our data and is one of the parameters of linear regression it’s an unknown number which the linear regression model should estimate”.
    • Ordinary Least Squares (OLS): OLS is a core method to minimize the “sum of squared residuals”. The material states that “the OLS tries to find the line that will minimize its value”.
    • Assumptions: The materials mention an assumption of constant variance (homoscedasticity) for errors, and notes “you can check for this assumption by plotting the residual and see whether there is a funnel like graph”. The importance of using a correct statistical test is also highlighted when considering p values.
    • Dummy Variables: The need to transform categorical features into dummy variables to be used in linear regression models, with the warning that “you always need to drop at least one of the categories” due to the multicolinearity problem. The process of creating dummy variables is outlined: “we will use the uh get uncore d function in Python from pandas in order to uh go from this one variable to uh five different variable per each of this category”.
    • Variable Interpretation: Coefficients in a linear regression model represent the impact of an independent variable on the dependent variable. For example, the material notes, “when we look at the total number of rooms and we increase the number of rooms by uh one additional unit so one more room added to the total underscore rooms then the uh house value uh decreases by minus 2.67”.
    • Model Summary Output: The materials discuss interpreting model output metrics such as R-squared which “is the Matrix that show cases what is the um goodness of fit of your model”. It also mentions how to interpret p values.
    1. Recommendation Systems
    • Feature Engineering: A critical step is identifying and engineering the appropriate features, with the recommendation system based on “data points you use to make decisions about what to recommend”.
    • Text Preprocessing: Text data must be cleaned and preprocessed, including removing “stop words” and vectorizing using TF-IDF or similar methods. An example is given “if we use no pen we use no action pack we use denture once we use movies once you 233 use Inspire once and you re use me once and the rest we don’t use it SWS which means we get the vector 0 0 1 1 1 1 0 0 zero here”.
    • Cosine Similarity: A technique to find similarity between text vectors. The cosine similarity is defined as “an equation of the dot product of two vectors and the multiplication of the magnitudes of the two vectors”.
    • Recommending: The system then recommends items with the highest cosine similarity scores, as mentioned with “we are going to provide we are going to recommend five movies of course you can recommend many or 50 movies that’s completely up to [Music] you”.
    1. Career Advice and Perspective
    • The Importance of a Plan: The material emphasizes the value of creating a career plan and focusing on actionable steps. The advice is “this kind of plan actually make you focus because if you are not focusing on that thing you could just going anywhere at that lose loose loose loose lose your way”.
    • Learning by Doing: The speaker advocates doing smaller projects to prove your abilities, especially as a junior data scientist. As they state, “the best way is like yeah just do the work if like a smaller like as you said previously youly like it might be boring stuff it might be an assum it might be not leading anywhere but those kind of work show”.
    • Business Acumen: Data scientists should focus on how their work provides value to the business, and “data scientist is someone who bring the value to the business and making the decision for the battle any business”.
    • Personal Branding: Building a personal brand is also seen as important, with the recommendation that “having a newsletter and having a LinkedIn following” can help. Technical portfolio sites like “GitHub” are recommended.
    • Data Scientist Skills: The ability to show your thought process and motivation is important in data science interviews. As the speaker notes, “how’s your uh thought process going how’s your what what motivated you to do this kind of project what motivated you to do uh this kind of code what motivated you to present this kinde of result”.
    • Future of Data Science: The future of data science is predicted to become “invaluable to the business”, especially given the current rapid development of AI.
    • Business Fundamentals: The importance of thinking about the needs-based aspect of a business, that it must be something people need or “if my roof was leaking and it’s raining outside and I’m in my house you know and water is pouring on my head I have to fix that whether I’m broke or not you know”.
    • Entrepreneurship: The importance of planning, which was inspired by being a pilot where “pilots don’t take off unless we know where we’re going”.
    • Growth: The experience at GE emphasized that “growing so fast it was doubling in size every three years and that that really informed my thinking about growth”.
    • Mergers and Aquisitions (M&A): The business principle of using debt to buy underpriced assets that can be later sold at a higher multiple for profit.
    1. Optimization
    • Gradient Descent (GD): The update of the weight is equal to the current weight parameter minus the learning rate times the gradient and so “the same we also do for our second parameter which is the bias Factor”.
    • Stochastic Gradient Descent (SGD): HGD is different from GD in that it “uses the gradient from a single data point which is just one observation in order to update our parameters”. This makes it “much faster and computationally much less expensive compared to the GD”.
    • SGD With Momentum: SGD with momentum addresses the disadvantages of the basic SGD algorithm.
    • Mini-Batch Gradient Descent: A trade-off between the two, and “it tries to strike a balance by selecting smaller batches and calculating the gradient over them”.
    • RMSprop: RMSprop is introduced as an algorithm for controlling learning rates, where “for the parameters that will have a small gradients we will be then controlling this and we will be increasing their learning rate to ensure that the gradient will not vanish”.

    Conclusion

    These materials provide a broad introduction to data science, machine learning, and AI. They cover mathematical and statistical foundations, various algorithms (both supervised and unsupervised), deep learning concepts, model evaluation, and provide case studies to illustrate the practical application of such techniques. The inclusion of career advice and reflections makes it a very holistic learning experience. The information is designed to build a foundational understanding and introduce more complex concepts.

    Essential Concepts in Machine Learning

    Frequently Asked Questions

    • What are some real-world applications of machine learning, as discussed in the context of this course? Machine learning has diverse applications, including optimizing crop yields by monitoring soil health, and predicting customer preferences, such as in the entertainment industry as seen with Netflix’s recommendations. It’s also useful in customer segmentation (identifying “good”, “better”, and “best” customers based on transaction history) and creating personalized recommendations (like prioritizing movies based on a user’s preferred genre). Further, machine learning can help companies decide which geographic areas are most promising for their products based on sales data and can help investors identify which features of a house are correlated with its value.
    • What are the core mathematical concepts that are essential for understanding machine learning and data science? A foundational understanding of several mathematical concepts is critical. This includes: the idea of using variables with different exponents (e.g., X, X², X³), understanding logarithms at different bases (base 2, base e, base 10), comprehending the meaning of ‘e’ and ‘Pi’, mastering exponents and logarithms and how they transform when taking derivatives. A fundamental understanding of descriptive (distance measures, variational measures) and inferential statistics (central limit theorem, law of large numbers, population vs. sample, hypothesis testing) is also essential.
    • What specific machine learning algorithms should I be familiar with, and what are their uses? The course highlights the importance of both supervised and unsupervised learning techniques. For supervised learning, you should know linear discriminant analysis (LDA), K-Nearest Neighbors (KNN), decision trees (for both classification and regression), random forests, and boosting algorithms like light GBM, GBM, and XGBoost. For unsupervised learning, understanding K-Means clustering, DBSCAN, and hierarchical clustering is crucial. These algorithms are used in various applications like classification, clustering, and regression.
    • How can I assess the performance of my machine learning models? Several metrics are used to evaluate model performance, depending on the task at hand. For regression models, the residual sum of squares (RSS) is crucial; it measures the difference between predicted and actual values. Metrics like entropy, also the Gini index, and the silhouette score (which measures the similarity of a data point to its own cluster vs. other clusters) are used for evaluating classification and clustering models. Additionally, concepts like the penalty term, used to control impact of model complexity, and the L2 Norm used in regression are highlighted as important for proper evaluation.
    • What is the significance of linear regression and what key concepts should I know? Linear regression is used to model the relationship between a dependent variable (Y) and one or more independent variables (X). A crucial aspect is estimating coefficients (betas) and intercepts which quantify these relationships. It is key to understand concepts like the residuals (differences between predicted and actual values), and how ordinary least squares (OLS) is used to minimize the sum of squared residuals. In understanding linear regression, it is also important not to confuse errors (which are never observed and can’t be calculated) with residuals (which are predictions of errors). It’s also crucial to be aware of assumptions about your errors and their variance.
    • What are dummy variables, and why are they used in modeling? Dummy variables are binary (0 or 1) variables used to represent categorical data in regression models. When transforming categorical variables like ocean proximity (with categories such as near bay, inland, etc.), each category becomes a separate dummy variable. The “1” indicates that a condition is met, and a “0” indicates that it is not. It is essential to drop one of these dummy variables to avoid perfect multicollinearity (where one variable is predictable from other variables) which could cause an OLS violation.
    • What are some of the main ideas behind recommendation systems as discussed in the course? Recommendation systems rely on data points to identify similarities between items to generate personalized results. Text data preprocessing is often done using techniques like tokenization, removing stop words, and stemming to convert data into vectors. Cosine similarity is used to measure the angle between two vector representations. This allows one to calculate how similar different data points (such as movies) are, based on common features (like genre, plot keywords). For example, a movie can be represented as a vector in a high-dimensional space that captures different properties about the movie. This approach enables recommendations based on calculated similarity scores.
    • What key steps and strategies are recommended for aspiring data scientists? The course emphasizes several critical steps. It’s important to start with projects to demonstrate the ability to apply data science skills. This includes going beyond basic technical knowledge and considering the “why” behind projects. A focus on building a personal brand, which can be done through online platforms like LinkedIn, GitHub, and Medium is recommended. Understanding the business value of data science is key, which includes communicating project findings effectively. Also emphasized is creating a career plan and acting responsibly for your career choices. Finally, focusing on a niche or specific sector is recommended to ensure that one’s technical skills match the business needs.

    Fundamentals of Machine Learning

    Machine learning (ML) is a branch of artificial intelligence (AI) that builds models based on data, learns from that data, and makes decisions [1]. ML is used across many industries, including healthcare, finance, entertainment, marketing, and transportation [2-9].

    Key Concepts in Machine Learning:

    • Supervised Learning: Algorithms are trained using labeled data [10]. Examples include regression and classification models [11].
    • Regression: Predicts continuous values, such as house prices [12, 13].
    • Classification: Predicts categorical values, such as whether an email is spam [12, 14].
    • Unsupervised Learning: Algorithms are trained using unlabeled data, and the model must find patterns without guidance [11]. Examples include clustering and outlier detection techniques [12].
    • Semi-Supervised Learning: A combination of supervised and unsupervised learning [15].

    Machine Learning Algorithms:

    • Linear Regression: A statistical or machine learning method used to model the impact of a change in a variable [16, 17]. It can be used for causal analysis and predictive analytics [17].
    • Logistic Regression: Used for classification, especially with binary outcomes [14, 15, 18].
    • K-Nearest Neighbors (KNN): A classification algorithm [19, 20].
    • Decision Trees: Can be used for both classification and regression [19, 21]. They are transparent and handle diverse data, making them useful in various industries [22-25].
    • Random Forest: An ensemble learning method that combines multiple decision trees, suitable for classification and regression [19, 26, 27].
    • Boosting Algorithms: Such as AdaBoost, light GBM, GBM, and XGBoost, build trees using information from previous trees to improve performance [19, 28, 29].
    • K-Means: A clustering algorithm [19, 30].
    • DB Scan: A clustering algorithm that is becoming increasingly popular [19].
    • Hierarchical Clustering: Another clustering technique [19, 30].

    Important Steps in Machine Learning:

    • Data Preparation: This involves splitting data into training and test sets and handling missing values [31-33].
    • Feature Engineering: Identifying and selecting the most relevant data points (features) to be used by the model to generate the most accurate results [34, 35].
    • Model Training: Selecting an appropriate algorithm and training it on the training data [36].
    • Model Evaluation: Assessing model performance using appropriate metrics [37].

    Model Evaluation Metrics:

    • Regression Models:
    • Residual Sum of Squares (RSS) [38].
    • Mean Squared Error (MSE) [38, 39].
    • Root Mean Squared Error (RMSE) [38, 39].
    • Mean Absolute Error (MAE) [38, 39].
    • Classification Models:
    • Accuracy: Proportion of correctly classified instances [40].
    • Precision: Measures the accuracy of positive predictions [40].
    • Recall: Measures the model’s ability to identify all positive instances [40].
    • F1 Score: Combines precision and recall into a single metric [39, 40].

    Bias-Variance Tradeoff:

    • Bias: The inability of a model to capture the true relationship in the data [41]. Complex models tend to have low bias but high variance [41-43].
    • Variance: The sensitivity of a model to changes in the training data [41-43]. Simpler models have low variance but high bias [41-43].
    • Overfitting: Occurs when a model learns the training data too well, including noise [44, 45]. This results in poor performance on unseen data [44].
    • Underfitting: Occurs when a model is too simple to capture the underlying patterns in the data [45].

    Techniques to address overfitting:

    • Reducing model complexity: Using simpler models to reduce the chances of overfitting [46].
    • Cross-validation: Using different subsets of data for training and testing to get a more realistic measure of model performance [46].
    • Early stopping: Monitoring the model performance and stopping the training process when it begins to decrease [47].
    • Regularization techniques: Such as L1 and L2 regularization, helps to prevent overfitting by adding penalty terms that reduce the complexity of the model [48-50].

    Python and Machine Learning:

    • Python is a popular programming language for machine learning because it has a lot of libraries, including:
    • Pandas: For data manipulation and analysis [51].
    • NumPy: For numerical operations [51, 52].
    • Scikit-learn (sklearn): For machine learning algorithms and tools [13, 51-59].
    • SciPy: For scientific computing [51].
    • NLTK: For natural language processing [51].
    • TensorFlow and PyTorch: For deep learning [51, 60, 61].
    • Matplotlib: For data visualization [52, 62, 63].
    • Seaborn: For data visualization [62].

    Natural Language Processing (NLP):

    • NLP is used to process and analyze text data [64, 65].
    • Key steps include: text cleaning (lowercasing, punctuation removal, tokenization, stemming, and lemmatization), and converting text to numerical data with techniques such as TF-IDF, word embeddings, subword embeddings and character embeddings [66-68].
    • NLP is used in applications such as chatbots, virtual assistants, and recommender systems [7, 8, 66].

    Deep Learning:

    • Deep learning is an advanced form of machine learning that uses neural networks with multiple layers [7, 60, 68].
    • Examples include:
    • Recurrent Neural Networks (RNNs) [69, 70].
    • Artificial Neural Networks (ANNs) [69].
    • Convolutional Neural Networks (CNNs) [69, 70].
    • Generative Adversarial Networks (GANs) [69].
    • Transformers [8, 61, 71-74].

    Practical Applications of Machine Learning:

    • Recommender Systems: Suggesting products, movies, or jobs to users [6, 9, 64, 75-77].
    • Predictive Analytics: Using data to forecast future outcomes, such as house prices [13, 17, 78].
    • Fraud Detection: Identifying fraudulent transactions in finance [4, 27, 79].
    • Customer Segmentation: Grouping customers based on their behavior [30, 80].
    • Image Recognition: Classifying images [14, 81, 82].
    • Autonomous Vehicles: Enabling self-driving cars [7].
    • Chatbots and virtual assistants: Providing automated customer support using NLP [8, 18, 83].

    Career Paths in Machine Learning:

    • Machine Learning Researcher: Focuses on developing and testing new machine learning algorithms [84, 85].
    • Machine Learning Engineer: Focuses on implementing and deploying machine learning models [85-87].
    • AI Researcher: Similar to machine learning researcher but focuses on more advanced models like deep learning and generative AI [70, 74, 88].
    • AI Engineer: Similar to machine learning engineer but works with more advanced AI models [70, 74, 88].
    • Data Scientist: A broad role that uses data analysis, statistics, and machine learning to solve business problems [54, 89-93].

    Additional Considerations:

    • It’s important to develop not only technical skills, but also communication skills, business acumen, and the ability to translate business needs into data science problems [91, 94-96].
    • A strong data science portfolio is key for getting into the field [97].
    • Continuous learning is essential to keep up with the latest technology [98, 99].
    • Personal branding can open up many opportunities [100].

    This overview should provide a strong foundation in the fundamentals of machine learning.

    A Comprehensive Guide to Data Science

    Data science is a field that uses data analysis, statistics, and machine learning to solve business problems [1, 2]. It is a broad field with many applications, and it is becoming increasingly important in today’s world [3]. Data science is not just about crunching numbers; it also involves communication, business acumen, and translation skills [4].

    Key Aspects of Data Science:

    • Data Analysis: Examining data to understand patterns and insights [5, 6].
    • Statistics: Applying statistical methods to analyze data, test hypotheses and make inferences [7, 8].
    • Descriptive statistics, which includes measures like mean, median, and standard deviation, helps in summarizing data [8].
    • Inferential statistics, which involves concepts like the central limit theorem and hypothesis testing, help in drawing conclusions about a population based on a sample [9].
    • Probability distributions are also important in understanding machine learning concepts [10].
    • Machine Learning (ML): Using algorithms to build models based on data, learn from it, and make decisions [2, 11-13].
    • Supervised learning involves training algorithms on labeled data for tasks like regression and classification [13-16]. Regression is used to predict continuous values, while classification is used to predict categorical values [13, 17].
    • Unsupervised learning involves training algorithms on unlabeled data to identify patterns, as in clustering and outlier detection [13, 18, 19].
    • Programming: Using programming languages such as Python to implement data science techniques [20]. Python is popular due to its versatility and many libraries [20, 21].
    • Libraries such as Pandas and NumPy are used for data manipulation [22, 23].
    • Scikit-learn is used for implementing machine learning models [22, 24, 25].
    • TensorFlow and PyTorch are used for deep learning [22, 26].
    • Libraries such as Matplotlib and Seaborn are used for data visualization [17, 25, 27, 28].
    • Data Visualization: Representing data through charts, graphs, and other visual formats to communicate insights [25, 27].
    • Business Acumen: Understanding business needs and translating them into data science problems and solutions [4, 29].

    The Data Science Process:

    1. Data Collection: Gathering relevant data from various sources [30].
    2. Data Preparation: Cleaning and preprocessing data, which involves:
    • Handling missing values by removing or imputing them [31, 32].
    • Identifying and removing outliers [32-35].
    • Data wrangling: transforming and cleaning data for analysis [6].
    • Data exploration: using descriptive statistics and data visualization to understand the data [36-39].
    • Data Splitting: Dividing data into training, validation, and test sets [14].
    1. Feature Engineering: Identifying, selecting, and transforming variables [40, 41].
    2. Model Training: Selecting an appropriate algorithm, training it on the training data, and optimizing it with validation data [14].
    3. Model Evaluation: Assessing model performance using relevant metrics on the test data [14, 42].
    4. Deployment and Communication: Communicating results and translating them into actionable insights for stakeholders [43].

    Applications of Data Science:

    • Business and Finance: Customer segmentation, fraud detection, credit risk assessment [44-46].
    • Healthcare: Disease diagnosis, risk prediction, treatment planning [46, 47].
    • Operations Management: Optimizing decision-making using data [44].
    • Engineering: Fault diagnosis [46-48].
    • Biology: Classification of species [47-49].
    • Customer service: Developing troubleshooting guides and chatbots [47-49].
    • Recommender systems are used in entertainment, marketing, and other industries to suggest products or movies to users [30, 50, 51].
    • Predictive Analytics are used to forecast future outcomes [24, 41, 52].

    Key Skills for Data Scientists:

    • Technical Skills: Proficiency in programming languages such as Python and knowledge of relevant libraries. Also expertise in statistics, mathematics, and machine learning [20].
    • Communication Skills: Ability to communicate results to technical and non-technical audiences [4, 43].
    • Business Skills: Understanding business requirements and translating them into data-driven solutions [4, 29].
    • Problem-solving skills: Ability to define, analyze, and solve complex problems [4, 29].

    Career Paths in Data Science:

    • Data Scientist
    • Machine Learning Engineer
    • AI Engineer
    • Data Science Manager
    • NLP Engineer
    • Data Analyst

    Additional Considerations:

    • A strong portfolio demonstrating data science project is essential to showcase practical skills [53-56].
    • Continuous learning is necessary to keep up with the latest technology in the field [57].
    • Personal branding can enhance opportunities in data science [58-61].
    • Data scientists must be able to adapt to the evolving landscape of AI and machine learning [62, 63].

    This information should give a comprehensive overview of the field of data science.

    Artificial Intelligence: Applications Across Industries

    Artificial intelligence (AI) has a wide range of applications across various industries [1, 2]. Machine learning, a branch of AI, is used to build models based on data and learn from this data to make decisions [1].

    Here are some key applications of AI:

    • Healthcare: AI is used in the diagnosis of diseases, including cancer, and for identifying severe effects of illnesses [3]. It also helps with drug discovery, personalized medicine, treatment plans, and improving hospital operations [3, 4]. Additionally, AI helps in predicting the number of patients that a hospital can expect in the emergency room [4].
    • Finance: AI is used for fraud detection in credit card and banking operations [5]. It is also used in trading, combined with quantitative finance, to help traders make decisions about stocks, bonds, and other assets [5].
    • Retail: AI helps in understanding and estimating demand for products, determining the most appropriate warehouses for shipping, and building recommender systems and search engines [5, 6].
    • Marketing: AI is used to understand consumer behavior and target specific groups, which helps reduce marketing costs and increase conversion rates [7, 8].
    • Transportation: AI is used in autonomous vehicles and self-driving cars [8].
    • Natural Language Processing (NLP): AI is behind applications such as chatbots, virtual assistants, and large language models [8, 9]. These tools use text data to answer questions and provide information [9].
    • Smart Home Devices: AI powers smart home devices like Alexa [9].
    • Agriculture: AI is used to estimate weather conditions, predict crop production, monitor soil health, and optimize crop yields [9, 10].
    • Entertainment: AI is used to build recommender systems that suggest movies and other content based on user data. Netflix is a good example of a company that uses AI in this way [10, 11].
    • Customer service: AI powers chatbots that can categorize customer inquiries and provide appropriate responses, reducing wait times and improving support efficiency [12-15].
    • Game playing: AI is used to design AI opponents in games [13, 14, 16].
    • E-commerce: AI is used to provide personalized product recommendations [14, 16].
    • Human Resources: AI helps to identify factors influencing employee retention [16, 17].
    • Fault Diagnosis: AI helps isolate the cause of malfunctions in complex systems by analyzing sensor data [12, 18].
    • Biology: AI is used to categorize species based on characteristics or DNA sequences [12, 15].
    • Remote Sensing: AI is used to analyze satellite imagery and classify land cover types [12, 15].

    In addition to these, AI is also used in many areas of data science, such as customer segmentation [19-21], fraud detection [19-22], credit risk assessment [19-21], and operations management [19, 21, 23, 24].

    Overall, AI is a powerful technology with a wide range of applications that improve efficiency, decision-making, and customer experience in many areas [11].

    Essential Python Libraries for Data Science

    Python libraries are essential tools in data science, machine learning, and AI, providing pre-written functions and modules that streamline complex tasks [1]. Here’s an overview of the key Python libraries mentioned in the sources:

    • Pandas: This library is fundamental for data manipulation and analysis [2, 3]. It provides data structures like DataFrames, which are useful for data wrangling, cleaning, and preprocessing [3, 4]. Pandas is used for tasks such as reading data, handling missing values, identifying outliers, and performing data filtering [3, 5].
    • NumPy: NumPy is a library for numerical computing in Python [2, 3, 6]. It is used for working with arrays and matrices and performing mathematical operations [3, 7]. NumPy is essential for data visualization and other tasks in machine learning [3].
    • Matplotlib: This library is used for creating visualizations like plots, charts, and histograms [6-8]. Specifically, pyplot is a module within Matplotlib used for plotting [9, 10].
    • Seaborn: Seaborn is another data visualization library that is known for creating more appealing visualizations [8, 11].
    • Scikit-learn (psyit learn): This library provides a wide range of machine learning algorithms and tools for tasks like regression, classification, clustering, and model evaluation [2, 6, 10, 12]. It includes modules for model selection, ensemble learning, and metrics [13]. Scikit-learn also includes tools for data preprocessing, such as splitting the data into training and testing sets [14, 15].
    • Statsmodels: This library is used for statistical modeling and econometrics and has capabilities for linear regression [12, 16]. It is particularly useful for causal analysis because it provides detailed statistical summaries of model results [17, 18].
    • NLTK (Natural Language Toolkit): This library is used for natural language processing tasks [2]. It is helpful for text data cleaning, such as tokenization, stemming, lemmatization, and stop word removal [19, 20]. NLTK also assists in text analysis and processing [21].
    • TensorFlow and PyTorch: These are deep learning frameworks used for building and training neural networks and implementing deep learning models [2, 22, 23]. They are essential for advanced machine learning tasks, such as building large language models [2].
    • Pickle: This library is used for serializing and deserializing Python objects, which is useful for saving and loading models and data [24, 25].
    • Requests: This library is used for making HTTP requests, which is useful for fetching data from web APIs, like movie posters [25].

    These libraries facilitate various stages of the data science workflow [26]:

    • Data loading and preparation: Libraries like Pandas and NumPy are used to load, clean, and transform data [2, 26].
    • Data visualization: Libraries like Matplotlib and Seaborn are used to create plots and charts that help to understand data and communicate insights [6-8].
    • Model training and evaluation: Libraries like Scikit-learn and Statsmodels are used to implement machine learning algorithms, train models, and evaluate their performance [2, 12, 26].
    • Deep learning: Frameworks such as TensorFlow and PyTorch are used for building complex neural networks and deep learning models [2, 22].
    • Natural language processing: Libraries such as NLTK are used for processing and analyzing text data [2, 27].

    Mastering these Python libraries is crucial for anyone looking to work in data science, machine learning, or AI [1, 26]. They provide the necessary tools for implementing a wide array of tasks, from basic data analysis to advanced model building [1, 2, 22, 26].

    Machine Learning Model Evaluation

    Model evaluation is a crucial step in the machine learning process that assesses the performance and effectiveness of a trained model [1, 2]. It involves using various metrics to quantify how well the model is performing, which helps to identify whether the model is suitable for its intended purpose and how it can be improved [2-4]. The choice of evaluation metrics depends on the specific type of machine learning problem, such as regression or classification [5].

    Key Concepts in Model Evaluation:

    • Performance Metrics: These are measures used to evaluate how well a model is performing. Different metrics are appropriate for different types of tasks [5, 6].
    • For regression models, common metrics include:
    • Residual Sum of Squares (RSS): Measures the sum of the squares of the differences between the predicted and true values [6-8].
    • Mean Squared Error (MSE): Calculates the average of the squared differences between predicted and true values [6, 7].
    • Root Mean Squared Error (RMSE): The square root of the MSE, which provides a measure of the error in the same units as the target variable [6, 7].
    • Mean Absolute Error (MAE): Calculates the average of the absolute differences between predicted and true values. MAE is less sensitive to outliers compared to MSE [6, 7, 9].
    • For classification models, common metrics include:
    • Accuracy: Measures the proportion of correct predictions made by the model [9, 10].
    • Precision: Measures the proportion of true positive predictions among all positive predictions made by the model [7, 9, 10].
    • Recall: Measures the proportion of true positive predictions among all actual positive instances [7, 9, 11].
    • F1 Score: The harmonic mean of precision and recall, providing a balanced measure of a model’s performance [7, 9].
    • Area Under the Curve (AUC): A metric used when plotting the Receiver Operating Characteristic (ROC) curve to assess the performance of binary classification models [12].
    • Cross-entropy: A loss function used to measure the difference between the predicted and true probability distributions, often used in classification problems [7, 13, 14].
    • Bias and Variance: These concepts are essential for understanding model performance [3, 15].
    • Bias refers to the error introduced by approximating a real-world problem with a simplified model, which can cause the model to underfit the data [3, 4].
    • Variance measures how much the model’s predictions vary for different training data sets; high variance can cause the model to overfit the data [3, 16].
    • Overfitting and Underfitting: These issues can affect model accuracy [17, 18].
    • Overfitting occurs when a model learns the training data too well, including noise, and performs poorly on new, unseen data [17-19].
    • Underfitting occurs when a model is too simple and cannot capture the underlying patterns in the training data [17, 18].
    • Training, Validation, and Test Sets: Data is typically split into three sets [2, 20]:
    • Training Set: Used to train the model.
    • Validation Set: Used to tune model hyperparameters and prevent overfitting.
    • Test Set: Used to evaluate the final model’s performance on unseen data [20-22].
    • Hyperparameter Tuning: Adjusting model parameters to minimize errors and optimize performance, often using the validation set [21, 23, 24].
    • Cross-Validation: A resampling technique that allows the model to be trained and tested on different subsets of the data to assess its generalization ability [7, 25].
    • K-fold cross-validation divides the data into k subsets or folds and iteratively trains and evaluates the model by using each fold as the test set once [7].
    • Leave-one-out cross-validation uses each data point as a test set, training the model on all the remaining data points [7].
    • Early Stopping: A technique where the model’s performance on a validation set is monitored during the training process, and training is stopped when the performance starts to decrease [25, 26].
    • Ensemble Methods: Techniques that combine multiple models to improve performance and reduce overfitting. Some ensemble techniques are decision trees, random forests, and boosting techniques such as Adaboost, Gradient Boosting Machines (GBM), and XGBoost [26]. Bagging is an ensemble technique that reduces variance by training multiple models and averaging the results [27-29].

    Step-by-Step Process for Model Evaluation:

    1. Data Splitting: Divide the data into training, validation, and test sets [2, 20].
    2. Algorithm Selection: Choose an appropriate algorithm based on the problem and data characteristics [24].
    3. Model Training: Train the selected model using the training data [24].
    4. Hyperparameter Tuning: Adjust model parameters using the validation data to minimize errors [21].
    5. Model Evaluation: Evaluate the model’s performance on the test data using chosen metrics [21, 22].
    6. Analysis and Refinement: Analyze the results, make adjustments, and retrain the model if necessary [3, 17, 30].

    Importance of Model Evaluation:

    • Ensures Model Generalization: It helps to ensure that the model performs well on new, unseen data, rather than just memorizing the training data [22].
    • Identifies Model Issues: It helps in detecting issues like overfitting, underfitting, and bias [17-19].
    • Guides Model Improvement: It provides insights into how the model can be improved through hyperparameter tuning, data collection, or algorithm selection [21, 24, 25].
    • Validates Model Reliability: It validates the model’s ability to provide accurate and reliable results [2, 15].

    Additional Notes:

    • Statistical significance is an important concept in model evaluation to ensure that the results are unlikely to have occurred by random chance [31, 32].
    • When evaluating models, it is important to understand the trade-off between model complexity and generalizability [33, 34].
    • It is important to check the assumptions of the model, for example, when using linear regression, it is essential to check assumptions such as linearity, exogeneity, and homoscedasticity [35-39].
    • Different types of machine learning models should be evaluated using appropriate metrics. For example, classification models use metrics like accuracy, precision, recall, and F1 score, while regression models use metrics like MSE, RMSE, and MAE [6, 9].

    By carefully evaluating machine learning models, one can build reliable systems that address real-world problems effectively [2, 3, 40, 41].

    AI Foundations Course – Python, Machine Learning, Deep Learning, Data Science

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • How A Soul Chooses Next Parents & Soulmate After One’s Death Reincarnation, Karma, and the Journey of the Soul

    How A Soul Chooses Next Parents & Soulmate After One’s Death Reincarnation, Karma, and the Journey of the Soul

    The source explores the concept of reincarnation and the soul’s journey after death from various spiritual, philosophical, and scientific perspectives. It examines the choices souls make in choosing their next life, including parents and soulmates, and how karma, attachments, and awareness influence this process. The text discusses the Tibetan Bardo states as transitional phases where the soul navigates visions shaped by its own consciousness. It highlights the importance of mindfulness, meditation, and detachment in shaping the soul’s trajectory and breaking free from the cycle of rebirth. Furthermore, the document suggests that preparing for death involves mastering the present moment and cultivating self-awareness. The material draws on traditions like Buddhism, Hinduism, Christianity, and even quantum physics to provide a comprehensive look into life, death, and the potential for spiritual evolution.

    Death, Rebirth, and the Journey of the Soul: A Comprehensive Study Guide

    I. Short Answer Quiz

    1. According to Tibetan teachings, describe the process of dissolution of the physical body at death.
    2. What is the “clear light” and its significance in the context of death and the afterlife?
    3. How does the Quran view the transition of souls after death, and how does it differ from the Buddhist perspective on rebirth?
    4. Explain the concept of the “Bardo of Becoming” and its role in determining a soul’s next experience.
    5. What is Samsara and its significance in Hindu, Buddhist, and Jain traditions?
    6. How does Karma influence the cycle of Samsara?
    7. According to the text, what is the role of past life regression studies, like those conducted by Brian Weiss, in understanding the choice of parents by the soul?
    8. What is reanu bandha in Hindu philosophy, and how does it relate to the concept of soulmates?
    9. How can practices like lucid dreaming and meditation prepare individuals for death, according to the text?
    10. Explain how attachments, desires, and fears shape our next step after death.

    II. Quiz Answer Key

    1. The dissolution process is gradual. First, earth dissolves (heaviness), then water (dryness), then fire (loss of warmth), and then air (cessation of breath), and finally space dissolves, leading to a luminous awareness.
    2. The “clear light” is a state of pure Consciousness encountered at death, representing the soul’s purest form. If recognized, it can lead to liberation; if not, the soul drifts onward.
    3. The Quran affirms that life continues beyond what we can perceive, while Buddhism speaks of rebirth as a natural consequence of karma. The Quran sees death as not the end while Buddhism sees it as a continuation.
    4. The “Bardo of Becoming” is a transitional phase where the soul, now disembodied, drifts through realms encountering visions reflecting its subconscious mind. Attachment to old identities can pull it back into the cycle of samsara.
    5. Samsara is the cycle of birth, death, and rebirth, central to Hindu, Buddhist, and Jain traditions, where the soul is caught in a loop of existence shaped by past actions and decisions.
    6. Karma, an intricate law, ensures every action, thought, and intention leaves an imprint that determines where and how the soul moves next within Samsara, influencing the conditions of future lives.
    7. Past life regression studies suggest individuals recall choosing their parents before birth to heal old wounds or learn new lessons, highlighting the soul’s active role in selecting its family.
    8. Reanu bandha suggests every relationship, harmonious or difficult, results from past karmic debts. It implies we are drawn to others in future lives to heal, complete, or refine connections.
    9. Practices like lucid dreaming and meditation help individuals become aware of illusions and attachments, training the mind to remain conscious during transitions, mirroring the Bardo experiences.
    10. At death, unresolved attachments, desires, and fears act as forces of attraction, drawing the soul toward a new life that reflects those unresolved patterns.

    III. Essay Questions

    1. Discuss the concept of karma as it relates to reincarnation and the soul’s journey across lifetimes. How do different spiritual traditions view the influence of karma on an individual’s past, present, and future existences?
    2. Compare and contrast the descriptions of the afterlife and transitional states (e.g., Bardos) found in at least three different spiritual or philosophical traditions. What common themes or differences emerge regarding the soul’s experience after death?
    3. Explore the idea of soulmates and karmic relationships. According to various spiritual traditions, what factors contribute to the reunion of souls across lifetimes, and what is the purpose of these connections?
    4. Analyze the role of awareness and detachment in preparing for death and navigating the transitional states between lives. How can practices like meditation, mindfulness, and lucid dreaming influence the soul’s journey after death?
    5. To what extent does the conscious or subconscious influence the course of our Soul’s Journey after death? Support your answer with evidence from religious traditions or scientific thinkers.

    IV. Glossary of Key Terms

    • Atman: In Hinduism, the individual soul or self, which is ultimately seeking reunion with Brahman.
    • Bardo: In Tibetan Buddhism, the transitional state between death and rebirth, characterized by various visions and experiences.
    • Brahman: In Hinduism, the supreme reality or ultimate principle of the universe, with which the Atman seeks to reunite.
    • Clear Light: In Tibetan Buddhism, the radiant, luminous state of pure Consciousness experienced at the moment of death.
    • Karma: The principle of cause and effect, where actions, thoughts, and intentions influence one’s future experiences and rebirth.
    • Liberation (Moksha/Nirvana): Freedom from the cycle of Samsara and suffering, representing the ultimate goal in Hinduism and Buddhism.
    • Lucid Dreaming: The state of being aware that one is dreaming, allowing for conscious control and exploration of the dream world.
    • Reincarnation: The belief that the soul undergoes a series of births, deaths, and rebirths, evolving over time.
    • Reanu bandha: A Hindu concept explaining that every relationship in our life, whether good or bad, is a result of past karmic debts.
    • Samsara: The cycle of birth, death, and rebirth, driven by karma and attachment, that binds the soul to repeated existence.
    • Soulmates: Souls that travel together across lifetimes, bound by karmic ties, and reunite in various roles to facilitate spiritual growth.

    Reincarnation, Karma, and the Soul’s Journey

    Briefing Document: Reincarnation, Karma, and the Journey of the Soul

    This document summarizes the main themes and ideas presented in the provided text, which explores the concept of reincarnation and the soul’s journey through various spiritual and philosophical traditions. The document emphasizes the cyclical nature of existence, the role of karma, the soul’s choice in rebirth, and the importance of awareness in navigating the transitions of life and death.

    I. Core Themes and Ideas:

    • Death as a Transition: The document challenges the common misconception of death as an absolute end. Instead, it presents death as a transition or doorway through which consciousness moves.
    • “Ancient wisdom tells us that death is not an end but a transition, a doorway through which Consciousness moves shaped by past choices and future possibilities.”
    • The Bardo States: Drawing heavily from Tibetan Buddhism, the text highlights the concept of the “bardos,” transitional states between death and rebirth, as a crucial period for the soul’s transformation.
    • “Perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergo a profound transformation before it moves forward.”
    • Karma and Rebirth: The principle of karma is central, suggesting that actions, thoughts, and intentions create imprints that shape the soul’s future experiences and influence the next incarnation.
    • “This cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next.”
    • The Soul’s Choice: The text explores the idea that the soul actively chooses its next life, influenced by karmic patterns, unresolved attachments, and lessons yet to be learned.
    • “It is not simply assigned to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now.”
    • Soulmates and Karmic Relationships: The document suggests that souls travel together across lifetimes, bound by karmic ties, reuniting as lovers, family, friends, or even rivals, to facilitate spiritual growth.
    • “Many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again.”
    • “The purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn.”
    • The Luminous Awareness (Clear Light): A key concept is the “clear light,” a luminous state of pure consciousness encountered at the moment of death, which offers an opportunity for liberation if recognized.
    • “This luminous awareness is described as the clear light a state where the soul encounters its purest form.”
    • Importance of Present Awareness: The text emphasizes that the afterlife journey is shaped by the inner journey undertaken in life, highlighting the significance of cultivating awareness, mindfulness, and detachment in the present moment.
    • “If heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices.”
    • Breaking the Cycle of Samsara: The ultimate goal, according to many traditions, is liberation from the cycle of birth, death, and rebirth (samsara), achieved through self-awareness, understanding attachments, and cultivating wisdom.
    • “Many spiritual Traditions agree that the goal is not endless rebirth but liberation.”
    • The Subconscious Mind: The influence of the subconscious mind extends beyond our waking reality, shaping the course of the Soul’s journey after death.
    • “The Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it.”
    • Preparing for Death in Daily Life: The document advocates that practical methods exist to help prepare for the transitions of both life and death; meditation, lucid dreaming, and self-reflection as tools to shape the Soul’s Journey Beyond this life.
    • “If the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path.”

    II. Key Supporting Details and Quotes:

    • Gradual Dissolution: Tibetan wisdom describes death as a gradual process involving the dissolution of the elements, leading to a luminous awareness.
    • “The process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself.”
    • Afterlife as a State of Consciousness: The text posits that heaven and hell are not fixed locations but states of consciousness, shaped by our inner world.
    • “These are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward”
    • Vision of Adamnun: Suggesting a universal pattern in how humans have perceived the afterlife, it provides a journey where a soul is guided through various Realms of purification and learning before reaching its next phase.
    • “An early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife.”
    • The Power of Subconscious Impressions: Joseph Murphy’s idea that deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death is highlighted.
    • “If this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death.”
    • Breaking Free from Karma: The life we lead today is actively creating the blueprint for our next Incarnation.
    • “If attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara.”
    • Reincarnation Goal: The goal is not endless rebirth but Liberation.
    • “Many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called MOA freedom from samsara in Buddhism it is Nana the cessation of suffering.”
    • Karma: Every action every thought and every intention leaves an imprint that determines where and how the soul moves next.
    • ” Unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next.”
    • Reuniting Souls: The purpose of these reunions isn’t mere companionship it is spiritual growth.
    • “These Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn.”
    • Soulmate Karma: Reanubandha suggests that every relationship is a result of past karmic debts.
    • “It suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection.”
    • Practice in Daily Life:“We must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear.”
    • “If the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path.”

    III. Implications and Considerations:

    • The document encourages a shift in perspective on life and death, urging readers to consider the impact of their thoughts, actions, and emotions on their future existence.
    • It suggests that present-day practices like meditation, lucid dreaming, and self-reflection can serve as training for navigating the afterlife and making conscious choices about future incarnations.
    • The exploration of karmic relationships and soulmates prompts reflection on the purpose of connections and the importance of resolving past debts for spiritual growth.
    • The concept of breaking free from the cycle of samsara challenges readers to examine their attachments and cultivate detachment to achieve ultimate liberation.

    Reincarnation, Karma, and the Journey of the Soul

    Reincarnation & the Journey of the Soul: A Comprehensive FAQ

    1. What happens to consciousness after death, according to various spiritual traditions?

    Different traditions offer varied perspectives, but a common thread suggests death isn’t an end but a transition. Tibetan Buddhism describes the “bardos,” transitional states where the soul undergoes profound transformations. The dissolution of the physical body happens gradually, culminating in “luminous awareness” or “clear light,” a state of pure consciousness. Mystical traditions propose that the afterlife is a state of consciousness, a reflection of one’s inner world projected outward. Islamic teachings in the Quran affirm that life continues beyond what we can perceive, and the early medieval Irish Christian text, the “Vision of Adamnan,” mirrors themes found in Tibetan and Hindu teachings.

    2. How does Karma influence the cycle of rebirth (Samsara), and how does it shape future experiences?

    Karma is the law of cause and effect that governs the cycle of birth, death, and rebirth (Samsara). Every action, thought, and intention leaves an imprint that determines where and how a soul moves next. Unresolved attachments, desires, and fears act as a magnet, pulling the soul towards a new life that reflects these patterns. The Upanishads, Zoroastrianism, and the Book of Enoch all highlight that the goal is to ultimately break free from this cycle through self-awareness and ethical conduct.

    3. What are the “bardos” in Tibetan Buddhism, and how do they relate to our subconscious mind and daily life?

    The “bardos” are transitional states between death and rebirth, described as realms where the soul encounters visions reflecting its subconscious mind. If a soul remains attached to its old identity, it may cling to illusions and be pulled back into Samsara. Joseph Murphy argued that deep impressions in our subconscious shape both our waking reality and our soul’s journey after death, influencing our experiences in the bardos. It is suggested that there are bardos experienced in life: the waking, dream, and meditative states.

    4. Is it possible to consciously influence or choose our next incarnation, or is it entirely determined by Karma?

    The soul is not passively assigned to a new body, but actively chooses. This choice is influenced by karmic imprints, unresolved attachments, and lessons yet to be learned. According to Tibetan teachings, a soul is drawn towards the vibrations of certain families and individuals based on past thoughts, actions, and emotions. Brian Weiss’s past life regression studies support the idea that individuals choose their parents to heal old wounds or learn new lessons.

    5. What role do soulmates and karmic relationships play in our spiritual evolution across multiple lifetimes?

    Soulmates and karmic relationships are connections between souls that travel together across lifetimes, bound by karmic ties. These connections can manifest as deep friendships, family bonds, or intense rivalries. The purpose of these reunions is spiritual growth, helping souls evolve, challenge each other, and learn unaddressed lessons. Hindu philosophy’s “reanu bandha” states that all relationships, harmonious or difficult, are results of past karmic debts. Buddhism believes that souls make agreements before birth to reunite for love, support, or even as teachers.

    6. How can we consciously prepare for death and navigate the transitional states (bardos) with greater awareness?

    Being mindful of death is a path to liberation, and the more we understand it, the less we fear it and the more consciously we can choose our next experience. Tibetan Buddhism considers death awareness a powerful spiritual practice, and the Bardo Thodol is a guide for the living, teaching that if one can remain aware at the moment of death and recognize the clear light, one can transcend the cycle of rebirth. The more we cultivate stillness, self-inquiry, and detachment, the more we prepare ourselves for the moment when the body dissolves and the soul faces the great unknown.

    7. What practical steps can we take in daily life to prepare for the transitions between life and death and to shape our soul’s path?

    Practical methods include meditation, lucid dreaming, and self-reflection. Meditation trains the mind to recognize illusions, a skill needed in the bardos. Lucid dreaming mirrors the Bardo of Becoming, allowing the soul to remain conscious as it moves between realms. Cultivating stillness, self-inquiry, and detachment prepares us for the soul’s journey. Living in alignment with justice and compassion also refines our karmic path.

    8. Do all souls experience the afterlife and reincarnation process in the same way, or are there cultural and individual variations?

    While different traditions offer unique descriptions of the afterlife, many share common themes, suggesting a structured process in which the soul moves through various states before reaching its next incarnation. The specific experiences within these states, however, may vary depending on an individual’s cultural background, spiritual beliefs, and karmic imprints. Some cultures, like Tibetan Buddhism, provide detailed maps of the afterlife realms, while others emphasize the subjective nature of these experiences, highlighting how one’s inner state shapes their journey after death.

    The Rebirth Process: Karma, Dissolution, and Incarnation

    The rebirth process, also known as reincarnation or samsara, is a central concept in many spiritual traditions, including Hinduism, Buddhism, and Jainism. It posits that after death, the soul undergoes a cycle of birth, death, and rebirth, driven by karma. Here’s an overview of the process:

    • Initial Dissolution: Death is not an instantaneous event but a gradual process where the physical body dissolves in stages. The earth element dissolves first, leading to a feeling of heaviness, followed by water, fire, air, and finally space.
    • Luminous Awareness: As the body dissolves, a “luminous awareness” or “clear light” emerges, representing the soul’s purest form. Recognizing this light can lead to liberation, but if unrecognized, the soul moves forward, influenced by past experiences and karmic imprints.
    • Bardo States: In Tibetan Buddhism, the soul enters the “bardos,” transitional states where it encounters visions reflecting its subconscious mind. One such state is the “Bardo of becoming,” where the soul, now disembodied, drifts through realms and confronts these visions.
    • Karma and Attachments: Karma, the law of cause and effect, plays a crucial role in determining the soul’s next experience. Unresolved attachments, desires, and fears act as magnets, drawing the soul toward a new life that mirrors those patterns.
    • Choice and Incarnation: The soul is not forced into reincarnation but is drawn by its cultivated energies. It chooses its next incarnation based on karmic connections, seeking circumstances that facilitate its spiritual growth. This choice involves selecting new parents and relationships that align with its karmic blueprint.
    • Breaking the Cycle: The ultimate goal in many traditions is to break free from the cycle of samsara. In Hinduism, this is called moksha, while in Buddhism, it is nirvana, both representing liberation from suffering. Self-awareness, mindfulness, and detachment are key to reducing karmic imprints and making conscious choices, paving the way for liberation.

    Additionally, different spiritual philosophies and traditions offer various perspectives on the afterlife journey, often describing a structured process where the soul moves through different states before reaching its next incarnation.

    Karmic Patterns: Rebirth, Relationships, and Spiritual Evolution

    Karmic patterns play a central role in the cycle of rebirth, influencing a soul’s journey through lifetimes. These patterns are created by actions, thoughts, and intentions, shaping future experiences and relationships.

    Key aspects of karmic patterns include:

    • Formation: Every action, thought, and intention leaves an imprint, creating a karmic link that influences future incarnations. Moral and spiritual choices actively shape future existence.
    • Influence on Rebirth: Unresolved attachments, desires, and fears act as a magnet, drawing the soul towards a new life reflecting those patterns. Souls are drawn to parents and families based on karmic imprints, unresolved attachments, and lessons yet to be learned.
    • Relationships: Karmic patterns influence the relationships encountered across lifetimes. Past karmic debts result in souls being drawn together to heal, complete, or refine connections. These connections can manifest as deep friendships, family bonds or even intense rivalries.
    • Breaking Free: Breaking free from toxic cycles involves understanding and overcoming attachments. Recognizing the forces that bind the soul to repetition is essential. Mindfulness, presence, and detachment allow one to remain awake and choose the next incarnation with clarity.
    • Awareness and Choice: Awareness in life prepares for awareness in death, enabling a conscious choice of the next incarnation. By cultivating stillness, self-inquiry, and detachment, individuals prepare for the moment when the body dissolves and the soul faces the unknown.
    • Spiritual Evolution: Navigating relationships with awareness shapes spiritual evolution and future reunions. Love is seen as a force that transcends time, drawing souls together and shaping experiences in the next incarnation.

    Soul Choices: Karma, Rebirth, and Conscious Evolution

    The soul’s choices are a significant aspect of the reincarnation process, influencing its journey and future experiences. Instead of aimlessly drifting, the soul follows a mysterious path that leads to new relationships and experiences.

    Key aspects of soul choices:

    • Active Selection: Many spiritual traditions suggest that a soul’s next incarnation isn’t random but is actively selected based on karmic imprints, unresolved attachments, and lessons to be learned. The soul actively selects the circumstances of its next birth.
    • Influences on Choice:
    • Karmic imprints.
    • Unresolved attachments.
    • Lessons yet to be learned.
    • Vibrations of certain families and individuals.
    • Past thoughts, actions, and emotions.
    • Choosing Parents and Soulmates: The soul is drawn towards parents based on karmic connections and what it needs for its next stage of growth, often to heal old wounds or learn new lessons. This extends to soulmates, with souls traveling in groups and reuniting in different roles to support and challenge each other’s spiritual evolution. Encounters with others are not accidental, but part of a deeper pattern.
    • Navigating the Bardos: Tibetan teachings reveal that after death, the soul enters a state where deepest fears, desires, and karmic patterns manifest. If the soul remains unaware, it’s drawn back into the cycle of birth and rebirth by unresolved attachments and past actions. However, recognizing the luminous reality of consciousness allows the soul to move beyond compulsive reincarnation and choose its next experience with clarity and wisdom.
    • Importance of Awareness: Awareness in life prepares individuals for awareness in death, allowing them to consciously choose their next incarnation.
    • Factors Influencing the Soul’s Trajectory: The final trajectory of the soul is determined by the power of recognition, seeing beyond illusion, and embracing the vast nature of existence.
    • Choice and Preparation: Souls may return to familiar pain due to attachments, desires, or fears. Mindful preparation for death is essential. By navigating transitions in life with awareness and purpose, individuals can prepare to navigate transitions beyond it.
    • Shaping the Next Life: Every moment presents an opportunity to shape the next life through choices, thoughts, love, and forgiveness.

    Death Awareness: Perspectives from Ancient Wisdom and Modern Psychology

    Death awareness involves recognizing and contemplating mortality, which many traditions consider a path to liberation rather than a morbid preoccupation. It suggests that understanding death helps diminish the fear of it, enabling more conscious choices about one’s experiences.

    Key aspects of death awareness include:

    • Mindfulness and Preparation: Mindfulness of death, as taught by spiritual traditions, is a path to liberation, not depression. Preparing for death makes sense if death is a transition rather than an end.
    • Tibetan Buddhism: In Tibetan Buddhism, death awareness is a potent spiritual practice. The Bardo Thodol, or Tibetan Book of the Dead, serves as a guide for the living, not just the dying. Remaining aware and recognizing the clear light at the moment of death allows one to transcend the cycle of rebirth.
    • Ancient Chinese Perspective: The 13th-century mystical text, Aman Ababa, describes consciousness as eternal and blissful, advocating death as a merging with the greater whole rather than annihilation.
    • Confucianism: Confucius believed contemplating death leads to moral wisdom by understanding impermanence, fostering compassion and detachment from fleeting desires.
    • Modern Psychology: Modern psychology is catching up with ancient wisdom. Brené Brown argues that embracing mortality allows for more courageous living. Wayne Dyer suggests self-inquiry and introspection reduce karmic burdens, easing the transition into the afterlife.
    • Awareness in Life and Death: Awareness in life prepares individuals for awareness in death. Practicing mindfulness, presence, and detachment allows one to remain awake during the transition and consciously choose the next incarnation.
    • Shaping the Soul’s Trajectory: Every act of mindfulness, detachment, kindness, and integrity shapes the soul’s trajectory, increasing the likelihood of moving forward with clarity.
    • Three Bardos: The Tibetan Bardo Thodol suggests there are three primary Bardos experienced in life: the waking state, the dream state, and the meditative state.
    • Practical Methods: Practical methods exist to prepare for life and death transitions, including meditation and lucid dreaming.

    Evolution of Consciousness: A Spiritual and Philosophical Journey

    Consciousness evolution is a central theme in many spiritual and philosophical traditions, referring to the ongoing refinement and transformation of awareness, both during life and after death. It involves breaking free from limitations, cultivating self-awareness, and consciously shaping one’s spiritual path.

    Key aspects and principles related to the evolution of consciousness include:

    • Transformation Beyond Death: Consciousness does not merely continue but evolves. The journey after death is an extension of the inner journey undertaken in life.
    • Spiritual Practices: Throughout history, spiritual masters, philosophers, and modern thinkers have suggested that consciousness does not end with death.
    • Karma’s Role: Karma influences the journey of consciousness, but awareness and choices can shape its trajectory. By understanding impermanence, one becomes more compassionate, present, and less attached to fleeting desires.
    • Importance of Awareness: Awareness in life prepares individuals for awareness in death, allowing them to consciously choose their next incarnation.
    • Breaking Free From Samsara: The key to breaking the cycle of rebirth is self-awareness.
    • Mindfulness, Meditation, and Detachment: Traditions emphasize mindfulness, meditation, and detachment to prepare for stepping beyond life.
    • Luminous State: Recognizing the luminous reality of consciousness allows souls to move beyond compulsive reincarnation and choose their next experience with clarity.
    • Bardo States as Training Grounds: The bardos are not just states after death but states experienced every day. The Tibetan Bardo Thodol suggests three primary bardos experienced in life: the waking state, the dream state, and the meditative state.
    • Moral and Spiritual Choices: Moral and spiritual choices actively shape future existence. Living in alignment with justice and compassion refines the self and the collective energy of the world.
    • Role of Relationships: Relationships shape our very being; encounters in life are not accidental but part of a deeper pattern.
    • Self-Inquiry and Introspection: Self-inquiry and introspection reduce karmic burdens, making the transition into the afterlife smoother and more conscious.
    • Shaping the Future: Every moment presents an opportunity to shape the next life through choices, thoughts, love, and forgiveness.
    How A Soul Chooses Next Parents & Soulmate After One’s Death (Explained in detail)

    The Original Text

    [Music] look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choices and future possibilities many Traditions from Tibetan Buddhism to Hindu reincarnation Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen What determines where a soul will be born next and which family it will enter is it Destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the k cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosophy and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past deeds and the pull of future lessons it is not simply aign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergo a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experiences Echo the same theme a radiant presence a deep sense of unity and feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell a paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our life right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that Consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can receive Buddhism in contrast speaks of rebirth as a natural consequence of karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as the BAU of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teachings this is called the clear light an experience of pure Consciousness before the soul moves further into the B some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in quantum mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence Surin kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the Bardo of becoming where the soul unable to recognize the Luminous State moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnation pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giant traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahman the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an unex expected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar Vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called MOA freedom from samsara in Buddhism it is nirvana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus Aurelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and Detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all be part of a larger interconnected karmic Journey this means that the family we are born in into the soulmate we encounter and the challenges we Face are not random but are woven into the fabric of our Soul’s Evolution so how does a soul decide its next Incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the after life was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream B one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bardos with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States Of Consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shenzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then the Bardo States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the bardos are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connections we share across lifetimes choosing parents and soulmates the karmic bonds imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibrations of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the daash an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn towards circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles sometimes as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationship shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear Peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to Liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful F spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in Illusions pulled back into habitual karmic patterns this emphasis on awareness at death is not not unique to Buddhism in ancient China the 13th century mystical text Aman Ababa by janesa describes Consciousness as something Eternal and Blissful urging Seekers to view death not as an Annihilation but as a merging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a homecoming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren a brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self- inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are Mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old karmic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply karmic playing a role in our evolution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of reanu bandha explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an un resolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless While others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the Soul’s search for nosis true knowledge and suggests that repeated lifetimes offer opportunity is to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami vivanda spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emotion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth gr rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to Bic Liberation imagine walking through a vast Hall of Mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you real realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsara the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong craving whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in Surin KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kard speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasize that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bardos are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan bar o ool suggests that there are three primary bardos experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to Liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and harmonious world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the bard of becoming allowing the soul to remain conscious even as it moves between Realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne Dyer also emphasize the power of self-inquiry and intentional living according to him the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unnecessary attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with Clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it enters the new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Karma instead it is a process shaped by awareness attachments subconscious imprints and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experience the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with Clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of repetition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have you you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choices and future possibilities many Traditions from Tibetan Buddhism to Hindu rein aration Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen What determines where a soul will be born next and which family it will enter is it destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the karmic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosophers and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past deeds and the pull of future lessons it is not simply aign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine Realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergos a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experiences Echo the same theme a radiant presence a deep sense of unity and a feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell a parad or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John cimus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself self spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam none presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as the Bardo of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a sign ific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teaching this is called the clear light an experience of pure Consciousness before the soul moves further into the Bardo some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in Quantum Mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence Sur kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the BAU of becoming where the soul unable to recognize the Luminous State moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnations pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle Echo e of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giin traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahma the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an unexpected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but liberation in Hinduism this is called MOA freedom from samsara in Buddhism it is Nana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept cept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus Aurelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and Detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all be part of a larger interconnected karmic Journey this means that the family we are born into the soulmate we encounter and the challenges we Face are not random but are woven into the fabric of our Soul’s Evolution so how does a soul decide its next Incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long-lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream Bardo one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bar with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States of consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shabag Enzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then The Bard States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the bardos are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connections we share across lifetimes choosing parents and soulmates the karmic bonds imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibrations of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the daat an early treaties on moral and ethical teachings while while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn towards circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles times as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationships shape our very being that that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in Illusions pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text Aman Ababa by janesa describes Consciousness as something Eternal and Blissful urging Seekers to view death not as an Annihilation but as a merging with the greater whole this align closely with Sufi teachings where death is seen as a return not a loss but a homecoming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren a brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are mindess in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old karmic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates us some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply karmic playing a role in our Evolution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic Ties That pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of rananda explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless While others are filled with challenges both types serve a higher purpose this idea is echoed in in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the soul search for nosis true knowledge and suggests that repeated lifetimes offer opportunities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami vivand spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the ideaa that our relationships across lifetimes help Define our spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emotion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to Bic Liberation imagine walking through a vast Hall of mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsara the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong Cravings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in Surin KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kard speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasize that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life life and death with awareness the answer lies in understanding that the bardos are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan Bardo thodol suggests that there are three primary bardos experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to Liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and Harmon world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the B of becoming allowing the soul to remain conscious even as it moves between realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne D also emphasized the power of self-inquiry and intentional living according to him the more more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetime smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unnecessary attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with Clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it enters a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Karma instead it is a process shaped by awareness attachments subconscious imprints and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experiences the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with Clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of repetition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined [Music] look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choices and future possibilities many Traditions from Tibetan Buddhism to Hindu reincarnation Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new PA parents new relationships and new experiences but how does this Choice happen What determines where a soul will be born next and which family it will enter is it Destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the kic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosophers and even modern thinkers have sought to understand this process their in sites offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past deeds and the pull of future lessons it is not simply aign to a new body it chooses but how what influences this choice and more importantly what does this mean mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergo a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experiences Echo the same theme a radiant presence a deep sense of unity and a feeling of weightless expansion but this moment is fleeting if the Soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell a paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not eras who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls EXP experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that Consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of Karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as the Bardo of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teachings this is called the clear light an experience of pure Consciousness before the soul moves further into the Bardo some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is the this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in Quantum Mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence Surin kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the Bardo of becoming where the soul unable to recognize the Luminous State moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnation pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giant traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahman the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an unexpected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar Vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called mocka freedom from samsara in Buddhism it is Nana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus Aurelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and Detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all be part of a larger interconnected karmic Journey this means that the family we are born into the soulmate we encounter and the challenges we Face are not random but are wo into the fabric of our Soul’s Evolution so how does a soul decide its next Incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream

    so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream Bardo one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bardos with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States Of Consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shenzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then The Bard States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the BOS are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connection we share across lifetimes choosing parents and soulmates the karmic bonds imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibrations of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the da an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn toward circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles sometimes as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationships shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear Peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to Liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in Illusions pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text amanu by janesa describes Consciousness as something Eternal and Blissful urging Seekers to view death not as an anihilation but as a merging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a homecoming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren Brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are Mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old karmic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply karmic playing a role in our Evolution across multiple existences if Souls travel together then what is the purpose of the these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of reanu bandha explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless While others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the Soul’s search for nosis true knowledge and suggests that repeated lifetimes offer opportunities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami vivanda spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emot but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to Bic Liberation imagine walking through a vast Hall of Mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsara the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong Cravings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in Surin KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kard speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Allan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasized that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bados are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan bodol suggests that there are three primary bardos experienced in life the waking state the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to Liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and harmonious world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the B of becoming allowing the soul to remain conscious even as it moves between Realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne Dyer also emphasize the power of self-inquiry and intentional living according to him the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unnecessary attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with Clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it enters a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Karma instead it is a process shaped by awareness attachments subconscious imp and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experiences the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with Clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of rep ition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choices and future possibilities many Traditions from Tibetan Buddhism to Hindu reincarnation Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen What determines where a soul will be born next and which family it will enter is it Destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the karmic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosophers and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past Deeds s and the pull of future lessons it is not simply aign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergo a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experience experiences Echo the same theme a radiant presence a deep sense of unity and a feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell a paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that Consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding reming Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as The Bard of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teachings this is called the clear light an experience of pure Consciousness before the soul moves further into the Bardo some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully real realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in Quantum Mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence suren kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the BAU of becoming where the soul unable to recognize the Luminous State moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnation pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giant traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahman the Supreme reality but until the soul reaches full realization it continues continues to return shaped by its past experiences this idea finds an unexpected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar Vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called MSHA freedom from samsara in in Buddhism it is nirvana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emmanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our our future existence through our moral and spiritual choices similarly Marcus Aurelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and Detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all will be part of a larger interconnected karmic Journey this means that the family we are born into the soulmate we encounter and the challenges we Face are not random but are woven into the fabric of our Soul’s Evolution so how does a soul decide its next Incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream Bardo one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bardos with Clarity but if they are trapped in fear regret or attachment they may lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States Of Consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shenzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then the Bardo States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the BOS are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connections we share across lifetimes choosing parents and soulmates the karmic bonds imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are atess free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian itic ISM all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibrations of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul Soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the daash an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn towards circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles sometimes as lovers sometimes as family sometimes as friends or even Rivals this is is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationships shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear Peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to Liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in illusion pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text Aman ubava by janesa describes Consciousness as something Eternal and Blissful urging Seekers to view death not as an Annihilation but as a merging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a home coming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren Brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are Mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old karmic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply karmic playing a role in our Evolution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of reanu bandha explains this beautifully it suggests that every relationship in our life whether har harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless While others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the Soul’s search for nosis true knowledge and suggests that repeated lifetimes offer opportunities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami vivanda spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spirit ual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emotion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to Bic Liberation imagine walking through a vast Hall of Mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsi the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong Cravings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in sir KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kard speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasize that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bardos are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan Bardo thodol suggests that there are three primary BOS experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to Liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and harmonious world we also refine our own karmic path Beyond intellectual study prti iCal methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the B of becoming allowing the soul to remain conscious even as it moves between Realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne Dyer also emphasize the power of self-inquiry and intentional living according to him the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unnecessary attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most most important factors in that decision what determines the final trajectory of the Soul before it enters a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Karma instead it is a process shaped by awareness attachments subconscious imprints and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experiences the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of repetition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choic and future possibilities many Traditions from Tibetan Buddhism to Hindu reincarnation Philosophy from sufy mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen what determines where a soul will be born next and which family it will enter is it Destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the baros of Tibetan teachings the karmic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosophers and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past deeds and the pull of future lessons it is not simply a sign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spirit spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergoes a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness touched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experiences Echo the same theme a radiant presence a deep sense of unity and a feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell a paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where where it speaks of a spiritual body that replaces the physical one this implies that Consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of karma a continuation rather than a destination surprisingly this idea is isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as the Bardo of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teachings this is called the clear light an experience of pure Consciousness before the soul moves further into the BAU some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text The Secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where Modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in Quantum Mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence Sur kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the Bardo of becoming where the soul unable to recognize the Luminous state moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnation pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giin traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahman the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an unexpected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar Vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called Moka freedom from samsara in Buddhism it is Nana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus Aurelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all be part of a larger interconnected karmic Journey this means that the family we are born into the soulmate we encounter and the challenges we Face are not random but are wov into the fabric of our Soul’s Evolution so how does a soul decide its next incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream Bardo one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bardos with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States Of Consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shenzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then the Bardo States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary Incarnation if the BOS are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connections we share across lifetimes choosing parents and soulmates the karmic Bond imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibration of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a less known Christian text the daash an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn towards circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life Reg ression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles sometimes as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West the though known for his work in social justice often speaks about how our relationships shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear Peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spirit spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to Liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in Illusions pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text Aman Ababa by janesa describes Consciousness as something Eternal and blissful urg ing Seekers to view death not as an Annihilation but as a merging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a homecoming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren a brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are Mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old kic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply caric playing a role in our Evolution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of reanu bandha explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless while others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the Soul’s search for nosis true knowledge and suggests that repeated lifetimes offer opportunities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami Vivan spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and selfawareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emotion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to bodic Liberation imagine walking through a vast Hall of Mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsara the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong Cravings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices I es it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in Sur and KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kard speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasized that our beliefs shape our reality not just in this

    life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train our elves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bados are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan Bardo thodol suggests that there are three primary bardos experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and harmonious world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the Bardo of becoming allowing the soul to remain conscious even as it moves between Realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne dire also emphasize the power of self-inquiry and intentional living according to him the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unnecessary AR attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with Clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the trans transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it enters a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Karma instead it is a process shaped by awareness attachments subconscious imprints and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos feel that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experiences the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with Clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of repetition returning to the same lessons until we are ready to move Beyond them so what does this mean mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined [Music] look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choices and future possibilities many Traditions from Tibetan Buddhism to Hindu reincarnation Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen What determines where a soul will be born next and which family it will enter is it Destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the isamic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosoph opers and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past deeds and the pull of future lessons it is not simply aign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergoes a profound transformation before moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experiences Echo the same theme a radiant presence a deep sense of unity and and a feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell a paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that Consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as the BAU of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence and aware awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teachings this is called the clear light an experience of pure Consciousness before the soul moves further into The Bard some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in quantum mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence Surin kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the BAU of becoming where the soul unable to recognize the Luminous State moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnation pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giin traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahman the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an expected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar Vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called MOA freedom from samsara in Buddhism it is Nana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus aurelus the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and Detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all be part of a larger interconnected karmic Journey this means that the family we are born in into the soulmate we encounter and the challenges we Face are not random but are woven into the fabric of our Soul’s Evolution so how does a soul decide its next Incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream bar one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bardos with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpect expected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States Of Consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shenzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then The Bard States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the BOS are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if if so what forces influence this Choice the answer May lie in the powerful unseen connections we share across lifetimes choosing parents and soulmates the karmic bonds imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experien and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibrations of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the daat an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn toward circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles sometimes as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationships shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear Peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to Liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most power ful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in Illusions pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text Aman Bava by janesa describes Consciousness as something Eternal and Blissful urging Seekers to view death not as an Annihilation but as a merging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a homecoming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren a brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are Mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old karmic forces but if if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply karmic playing a role in our ever ution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of rananda explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an resolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless While others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes s in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the Soul’s search for nosis true knowledge and suggests that repeated lifetimes offer opportunity ities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami vivanda spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emotion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to Bic Liberation imagine walking through a vast Hall of Mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsara the cycle of birth and rebirth it is not just attachment to people or material things things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong craving ings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in Surin KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kard speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasized that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bardos are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan bar bodol suggests that there are three primary BOS experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to Liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and harmonious world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the bard of becoming allowing the soul to remain conscious even as it moves between Realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne Dyer also emphasize the power of self-inquiry and intentional living according to him the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unnecessary attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with Clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it ENT is a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by instead it is a process shaped by awareness attachments subconscious imprints and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experience es the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with Clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of repetition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shap the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choices and future possibilities many Traditions from Tibetan Buddhism to Hindu re Incarnation Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen What determines where a soul will be born next and which family it will enter is it destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the karmic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosophers and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past deeds and the pull of future lessons it is not simply aign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine Realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergoes a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experiences Echo the same theme a radiant presence a deep sense of unity and a feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell apparent Paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself self spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of none presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as is the Bardo of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a sign scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teaching this is called the clear light an experience of pure Consciousness before the soul moves further into the Bardo some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where modern science enters the conversation quantum physics has long puzzled over the nature of consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in Quantum Mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body C aspects of the Mind might transcend physical existence Sur kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the BAU of becoming where the soul unable to recognize the Luminous State moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnations pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and GI traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an unexpected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but liberation in Hinduism this is called MSHA freedom from samsara in Buddhism it is Nana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus Aurelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and Detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all be part of a larger interconnected karmic Journey this means that the family we are born into the soulmate we encounter and the challenges we Face are not random but are woven into the fabric of our Soul’s Evolution so how does a soul decide its next Incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you real realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream Bardo one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the vardos with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States of consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shenzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then The Bard States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the bardos are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connections we share across lifetimes choosing parents and soulmates the karmic bonds imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibrations of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the daash an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn toward circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles some sometimes as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationships shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the Psy of rebirth altogether but if fear takes over the soul becomes lost in Illusions pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text Aman ubaba by janesa describes Consciousness as something Eternal and Blissful urging Seekers to view death not as an Annihilation but as a merging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a homecoming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren a brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old karmic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply karmic playing a role in our Evolution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of reanu explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless While others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the soul search for nosis true knowledge and suggests that repeated lifetimes offer opportunities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami vivanda spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emotion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to Bic Liberation imagine walking through a vast Hall of mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsara the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong Cravings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in Surin KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kagad speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasize that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bardos are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan Bardo thodol suggests that there are three primary bardos experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to Liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and Harmon ious world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the B of becoming allowing the soul to remain conscious even as it moves between realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne D also emphasized the power of self-inquiry and intentional living according to him the the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unnecessary attachments every time you act with kindness and integrity you are shaping the trajectory of your Soul you are making it more likely that when the time comes you will move forward with Clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it enters a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul will choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Karma instead it is a process shaped by awareness attachments subconscious imprints and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties while mothers seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experiences the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with Clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of repetition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined [Music] look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choices and future possibilities many Traditions from Tibetan Buddhism to Hindu reincarnation Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen What determines where a soul will be born next and which family it will enter is it Destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the karmic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosophers and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past deeds and the pull of future lessons it is not simply aign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergo a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experiences Echo the same theme a radiant presence a deep sense of unity and a feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell a paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that Consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of Karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as the Bardo of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the

    power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teachings this is called the clear light an experience of pure Consciousness before the soul moves further into the Bardo some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the the same profound reality a luminous State Beyond ordinary perception this is where modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in Quantum Mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence Sur kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the BAU of becoming where the soul unable to recognize the Luminous State moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnation pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giin traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahman the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an unexpected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar Vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called mocka freedom from samsara in Buddhism it is Nana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus aelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and Detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all be part of a larger interconnected karmic Journey this means that the family we are born into the soulmate we encounter and the challenges we Face are not random but are w woven into the fabric of our Soul’s Evolution so how does a soul decide its next Incarnation is it purely caric law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream Bardo one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bardos with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States Of Consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shenzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then the Bardo States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the bardos are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these stat is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connection ctions we share across lifetimes choosing parents and soulmates the karmic bonds imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the bar of becoming it is not merely observing different possibilities it is actively drawn toward the vibrations of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the daash an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn towards circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles sometimes as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationships shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moment of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear Peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to Liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in Illusions pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text amanu Ava by janesa describes Consciousness as something Eternal and Blissful urging Seekers to view death not as an Annihilation but as emerging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a homecoming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemp ating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren Brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are Mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old karmic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply karmic playing a role in our Evolution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth the these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of reanu bandha explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless While others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the Soul’s search for nosis true knowledge and suggests that repeated lifetimes offer opportunities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami vivanda spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an motion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to Bic Liberation imagine walking through a vast Hall of Mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attach does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsara the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong Cravings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in suren KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kagad speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasized that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bados are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan B thodol suggests that there are three primary BOS experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to Liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and harmonious world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the B of becoming allowing the soul to remain conscious even as it moves between Realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne Dyer also emphasize the power of self-inquiry and intentional living according to him the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering ing the present every time you practice mindfulness every time you let go of unnecessary attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with Clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it enters a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Cara instead it is a process shaped by awareness attachments subconscious and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experiences the evidence suggests that life continues in ways we may not fully understand the question is is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with Clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of petition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far far greater than we ever imagined look up at the night sky a vast Endless Ocean of stars stretching beyond the limits of human sight have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choices and future possibilities many Traditions from Tibetan Buddhism to Hindu reincarnation Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen What determines where a soul will be born next and which family it will enter is it Destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the karmic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across mult multiple lifetimes as soulmates throughout history spiritual Masters philosophers and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past de needs and the pull of future lessons it is not simply aign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergo a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death EXP experiences Echo the same theme a radiant presence a deep sense of unity and a feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and karmic imprints many people imagine the afterlife as a place Heaven or Hell a paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness at the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies in the interplay between Karma memory and the Deep unconscious forces that shape existence itself spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that Consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of of purification and learning before reaching its next phase the text though obscure mirrors themes found in tietan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines their next experience the Tibetan bardos offer an answer a transitional phase known as the Bardo of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to but also who we find along the way dissolution and Luminosity a scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teachings this is called the clear light an experience of pure Consciousness before the soul moves further into the Bardo some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in Quantum Mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shaping what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence suren kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the Tibetan concept of the Bardo of becoming where the soul unable to recognize the Luminous State moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnation pull imagine waking up in a completely different life in a different body surrounded by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giin traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahman the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an unexpected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar Vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called MSHA freedom from samsara in Buddhism it is nirvana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus Aurelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and Detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face May all be part of a larger interconnected karmic Journey this means that the family we are born into the soulmate we encounter and the challenges we Face are not random but are woven into the fabric of our Soul’s Evolution so how does a soul decide its next Incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on on one’s awareness this is where things become interesting in the dream BAU one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bardos with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States Of Consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shenzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then the Bardo States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the bardos are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connections we share across lifetimes choosing parents and soulmates the karmic bonds imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibrations of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a Soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the daash an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn towards circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles sometimes as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationships shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of your life you are aware that your breath is slowing your body is growing lighter and something vast and unknown is approaching what do you feel fear Peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to Liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in illusion pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text Aman Ababa by janesa describes Consciousness as something Eternal and Blissful urging Seekers to view death not as an Annihilation but as a merging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a hope homec coming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren a brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are Mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will will likely remain unconscious in death simply carried Along by old karmic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply karmic playing a role in our Evolution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of rananda explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless While others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the Soul’s search for nosis true knowledge and suggests that repeated lifetimes offer opportunities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami vivanda spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spirit spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emotion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to Bic Liberation imagine walking through a vast Hall of Mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to Sams Sara the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong Cravings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in Siran KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kard speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasized that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bados are not just States after death death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan Bardo thodol suggests that there are three primary BOS experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experi exp erience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to Liberation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and harmonious world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the B of becoming allowing the soul to remain conscious even as it moves between Realms even herbalism and plant medicine as practiced in many ancient cultures has been used to a in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne Dyer also emphasize the power of self-inquiry and intentional living according to him the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unnecessary attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it enters a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Karma instead it is a process shaped by awareness attachments subconscious imprints and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with with death whether through the lens of quantum physics ancient scriptures or personal spiritual experiences the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of repetition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined look up at the night sky a fast Endless Ocean of stars stretching beyond the limits of human sight have you ever wondered what happens when a soul departs this world where does it go does it simply dissolve into nothingness or does it continue its Journey seeking new experiences new lessons new connections ancient wisdom tells us that death is not an end but a transition a doorway through which Consciousness moves shaped by past choice es and future possibilities many Traditions from Tibetan Buddhism to Hindu reincarnation Philosophy from Sufi mysticism to early Christian teachings describe a process where the soul chooses its next life it doesn’t just drift aimlessly into the void instead it follows an intricate often mysterious path one that leads to new parents new relationships and new experiences but how does this Choice happen what determines where a soul will be born next and which family it will enter is it Destiny Karma a divine plan or something Beyond human comprehension the answer lies in the Unseen dimensions of existence the bardos of Tibetan teachings the karmic cycles of Hindu philosophy and the transformative Journey described in mystical Traditions across the world this video will take you through these fascinating perspectives revealing what happens between death and rebirth we’ll explore how Souls navigate the afterlife Journey how karmic energy shapes their next Incarnation and even how some beings reunite across multiple lifetimes as soulmates throughout history spiritual Masters philosophers and even modern thinkers have sought to understand this process their insights offer a profound glimpse into the nature of Consciousness Destiny and the great Cosmic intelligence that guides all existence imagine standing at the threshold of a new life a soul hovers Between Worlds drawn by unseen forces feeling the weight of past deeds and the pull of future lessons it is not simply assign to a new body it chooses but how what influences this choice and more importantly what does this mean for us here and now we’ll explore the answers in depth bringing together wisdom from Buddhist sutras the upanishads early Christian texts Islamic teachings and even modern perspectives from quantum physics and psychology each tradition offers a piece of the puzzle helping us understand the mechanics of reincarnation the karmic journey and the profound process of spiritual evolution by the end of this journey you may look at life and death in a completely new way you may begin to see how your thoughts actions and emotions shape not just this life but the ones that follow and you may even start to sense that the people you meet the ones who feel strangely familiar may not be strangers at all let’s begin the anatomy of death and correcting common misconceptions imagine for a moment that you are at the very edge of existence your final breath has left your body and everything familiar begins to fade what happens next Many religious traditions and spiritual philosophies attempt to describe this moment some portray it as an entry into a Divine realm While others suggest a blank void but perhaps the most detailed descriptions come from Tibetan teachings on the bardos transitional states where the soul undergo a profound transformation before it moves forward a common misconception about death is that it is an instant total cessation Tibetan wisdom teaches otherwise the process is gradual and Consciousness does not simply switch off instead the dissolution of the physical body happens in stages first the Earth element dissolves leading to a sense of heaviness then water dissolves bringing dryness fire Fades and warmth leaves the body air dissipates and breath ceases finally space itself dissolves and what remains is not emptiness but something far more profound a luminous awareness Untouched by death itself this luminous awareness is described as the clear light a state where the soul encounters its purest form it is here that many near-death experiences Echo the same theme a radiant presence a deep sense of unity and a feeling of weightless expansion but this moment is fleeting if the soul does not recognize it it drifts onward pulled by its past experiences and Cal imprints many people imagine the afterlife as a place Heaven or Hell a paradise or a punishment but across mystical Traditions there is a deeper understanding these are not locations but States Of Consciousness Carl Jung the great psychologist once suggested that the unconscious mind contains Realms Beyond ordinary experience archetypal Landscapes shaped by thought emotion and personal history could it be that the afterlife is just that a reflection of our inner World projected outward this idea is echoed in a lesser known Christian mystical text from the 7th Century the ladder of divine Ascent by John climacus though written for monks its wisdom applies universally each Soul ascends or descends not based on external judgment but by the refinement of its own being if a soul clings to anger it enters a realm of suffering if it cultivates peace it enters Harmony the journey after death is in many ways an extension of the inner Journey we undertake in life so what does this mean for us if heaven and hell are not fixed places but states of mind then we are shaping our afterlife right now through our thoughts emotions and choices death does not erase who we are it reveals it this is why many Traditions emphasize awareness of the moment of passing a peaceful mindful transition allows for a clearer path into the next phase of existence the soul now stripped of its physical form prepares for the next stage choosing its next Incarnation but how does it make this choice is it random is it dictated by external forces or is there a hidden intelligence at work guiding the soul to exactly where it needs to be the answer lies Li in the interplay between Karma memory and the Deep unconscious forces that shape existence itself spiritual blueprints Soul Journeys across cultures picture a soul standing at the crossroads of existence no longer bound by a body yet not fully reborn what happens next do All Souls experience the same transition or does this journey vary across cultures and traditions throughout history different spiritual philosophies have attempted to map the terrain of the afterlife despite their differences many of them describe a structured almost intentional process one in which the soul moves through various States before reaching its next Incarnation whether in the form of judgment reflection or purification this transition is never random in the Bible the concept of transformation beyond death is evident in First Corinthians 15 where it speaks of a spiritual body that replaces the physical one this implies that Consciousness does not merely continue but evolves the Quran affirms this notion in 2154 reminding Believers that those who pass from this world are not truly dead life continues beyond what we can perceive Buddhism in contrast speaks of rebirth as a natural consequence of karma a continuation rather than a destination surprisingly this idea isn’t limited to Eastern traditions an early medieval Irish Christian text the vision of Adam nun presents a strikingly similar Journey where a soul is guided through various Realms of purification and learning before reaching its next phase the text though obscure mirrors themes found in tibetan and Hindu teachings suggesting a universal pattern in how humans have perceived the afterlife if Souls move with purpose what determines next experience the Tibetan bardos offer an answer a transitional phase known as the Bardo of becoming in this state the soul now disembodied drifts through various Realms encountering visions that reflect its subconscious mind if a soul remains attached to its old identity it may cling to illusion and be pulled back into the cycle of samsara endless rebirth this brings us to a fascinating Insight from Joseph Murphy in the power of your subconscious mind he argued that the Deep impressions in our subconscious don’t just shape our waking reality but also extend beyond it if this is true then our deeply rooted beliefs and fears could influence the course of our Soul’s Journey after death the same principle applies to the bardos those who can recognize their experiences as projections of the mind can navigate them with greater Clarity avoiding unnecessary suffering and making a more conscious choice about their next Incarnation this raises a profound question if our subconscious guides us after death then what about those we meet again and again across lifetimes do some Souls travel together could certain relationships be pre-ordained not by Fate but by shared karmic patterns if so how do we recognize them the answers lie in the hidden forces that pull Souls together forces that shape not only who we are born to to but also who we find along the way dissolution and Luminosity a scientific esoteric marriage imagine standing at the threshold between one existence and another the body is gone yet something remains a presence an awareness a Consciousness that seems Untouched by death itself what is this state and could modern science offer any insights into this ancient mystery many spiritual Traditions describe a radiant luminous state that appears at the moment of death in tibetan teachings this is called the clear light an experience of pure Consciousness before the soul moves further into the Bardo some recognize it and merge with it attaining Liberation While others unable to comprehend its nature move forward into rebirth but what exactly is this light interestingly an ancient Chinese alchemical text the secret of the Golden Flower describes something remarkably similar this lesser known toist work speaks of a radiant energy within cultivated through deep meditation which becomes fully realized after death could this be the same phenomenon described in the bardos if so this suggests that different cultures separated by geography and time may have glimpsed the same profound reality a luminous State Beyond ordinary perception this is where Modern science enters the conversation quantum physics has long puzzled over the nature of Consciousness some theories suggest that Consciousness is not just an emergent property of the brain but something more fundamental a field that interacts with reality itself the observer effect in Quantum Mechanics for instance suggests that the mere Act of observation changes physical phenomena if Consciousness has such an effect on reality could it also persist Beyond Death shap what happens next the philosophy of science reminds us that these ideas remain speculative but they challenge the conventional materialist view that Consciousness is purely biological if awareness is more than the brain then perhaps it continues even after the physical body dissolves this would explain why so many Traditions describe a continuation of the Soul’s Journey rather than an Abrupt end even ancient Western philosophers hinted at this possibility Aristotle in his metaphysics proposed that while the soul is deeply connected to the body certain aspects of the Mind might transcend physical existence Sur kard much later suggested that confronting death is not about fear but about transformation an opportunity for existential reflection and self-realization this idea is echoed in the tetan concept of the BAU of becoming where the soul unable to recognize the Luminous state moves into a transitional phase where past Karma and subconscious Impressions take over the soul is not forced into reincarnation it is drawn by the energies it has cultivated if attachments remain unresolved they act as a magnet pulling the soul toward a new life that reflects those patterns if this is true then what we experience at death is deeply shaped by how we live our attachments desires and fears become the very forces that guide our next step could it be that the life we lead today is actively creating the blueprint for our next Incarnation if so how much of this process is within our control the answer lies in the Soul’s greatest challenge Breaking Free from the pull of past Karma the wheel of samsara breaking reincarnation pull imagine waking up in a completely different life in a different body surrounding Ed by people you’ve never met yet somehow there is a familiarity in the air a subtle echo of something long forgotten what if this was not a new beginning but a continuation what if your current life is just another chapter in a story that has been unfolding across lifetimes this is the essence of samsara the cycle of birth death and rebirth that has been at the heart of Hindu Buddhist and giin traditions for thousands of years unlike the Western idea of a singular afterlife samsara suggests that the soul is caught in a loop of existence shaped by past actions and decisions this cycle is not random it follows an intricate law known as karma which ensures that every action every thought and every intention leaves an imprint that determines where and how the soul moves next in the upanishads one of the oldest spiritual texts in the world the soul Atman is said to move through countless lifetimes searching for ultimate reunion with Brahman the Supreme reality but until the soul reaches full realization it continues to return shaped by its past experiences this idea finds an unexpected parallel in Zoroastrianism where moral choices determine the Soul’s Journey after death influencing where and how it will be reborn a lesser known but powerful text The Book of Enoch part of the Ethiopian Orthodox biblical tradition offers a strikingly similar Vision it describes Souls traveling through different Realms learning from their experiences and being prepared for future incarnations though rarely discussed in mainstream Christianity this book suggests that life after death is not a static destination but an evolving process much like the Eastern concept of rebirth but if reincarnation is a cycle can it be broken many spiritual Traditions agree that the goal is not endless rebirth but Liberation in Hinduism this is called MSHA freedom from samsara in Buddhism it is Nana the cessation of suffering the key to Breaking the cycle is self-awareness recognizing the forces that keep the soul bound to repetition Emanuel Kant though not a religious philosopher spoke of the moral imperative the idea that our actions should be guided by a sense of universal ethics rather than personal gain this concept aligns with the idea of karma we are not just reacting to life but actively shaping our future existence through our moral and spiritual choices similarly Marcus Aurelius the stoic philosopher wrote that self-reflection and virtue are essential for Spiritual elevation this aligns with Buddhist thought that by cultivating mindfulness and detachment we reduce the karmic imprints that pull us back into the cycle of rebirth if this is true then the people we meet the experiences we have and even the struggles we Face may all be part of a larger interconnected karmic Journey this means that the family we are born into the soulmate we encounter and the challenges we Face are not random but are woven into the fabric of our Soul’s Evolution so how does a soul decide its next incarnation is it purely karmic law or does it actively choose where it goes next the answer May lie in something even more mysterious the moment between death and rebirth where choices are made Beyond the Veil of physical existence bardos dreams and lucidity a training ground imagine being in a dream so vivid that it feels real you walk through familiar places speak to long lost friends or even fly through the sky until suddenly something shifts you realize you are dreaming in that instant the world around you becomes fluid and you have a choice to control the dream to explore it or to wake up now what if the afterlife was something like this Tibetan Buddhism describes the Bardo States as a space between death and rebirth where the soul navigates Visions memories and illusions that are shaped by its own Consciousness some traditions say this experience lasts 49 days while others suggest that time in the bardos is subjective stretching and Contracting based on one’s awareness this is where things become interesting in the dream Bardo one of the transitional States described in tibetan teachings the experiences of the deceased mirror those of a dreamer if a person has trained their mind in life through meditation awareness and self-inquiry they are more likely to recognize Illusions and move through the bardos with Clarity but if they are trapped in fear regret or attachment they may remain lost in these Visions mistaking them for reality this concept finds an unexpected parallel in phenomenology a branch of philosophy that explores Human Experience Sam Harris a thinker in comparative religion has spoken about lucid dreaming as a rehearsal for death a way to train the mind to remain aware even in Altered States Of Consciousness if true this means that our ability to recognize Illusions in dreams could help us navigate the Afterlife with greater wisdom a lesser known Zen Buddhist text shabag Enzo by dogen takes this idea even further written in the 13th century it describes time itself as an illusion stating that past present and future are not separate realities but different aspects of the same moment if this is true then The Bard States might not just be a passage after death but something accessible in life a dimension we can Glimpse through deep meditation dreams and expanded awareness this is echoed in eart tol’s teachings on mindfulness he speaks of The Watcher the part of you that observes thoughts without becoming them if this practice is developed in life it could allow the soul to remain conscious through the transitions of death avoiding unnecessary reincarnation if the BOS are in a sense a mirror of our subconscious then mastering awareness in life might give us control over what happens next could it be that lucid dreaming meditation and self-reflection are not just spiritual practices but tools to shape the Soul’s Journey Beyond this life if so then understanding these states is not just about preparing for death it is about living with greater Clarity and purpose this brings us to one of the most mysterious aspects of reincarnation how a soul chooses its next parents if the bardos are real then could it be that the soul far from being passively assigned actively selects the circumstances of its next birth and if so what forces influence this Choice the answer May lie in the powerful unseen connections we share across lifetimes choosing parents and soulmates the karmic Bond on imagine standing at a crossroad surrounded by infinite possibilities each path leads to a different family a different body a different life you are weightless free from form yet something deep within you feels a pull a familiar energy guiding you toward a particular lineage a specific set of parents but why what determines this Choice many spiritual Traditions suggest that the Soul’s next Incarnation is not random it is drawn toward parents based on its karmic imprints unresolved attachments and lessons yet to be learned this idea is echoed in Hinduism Buddhism and even lesser known Christian mysticism all of which describe a magnetic pull between Souls shaped by past experiences and spiritual debts according to Tibetan teachings as a soul moves through the B of becoming it is not merely observing different possibilities it is actively drawn toward the vibration of certain families and individuals this attraction is not forced but arises naturally as a consequence of the Soul’s past thoughts actions and emotions if a soul has unresolved Karma with certain individuals it may choose to be reborn into their family to continue that Journey this could explain why some relationships in life feel deeply karmic as though they are part of a story that has been unfolding for lifetimes this concept is mirrored in a lesser known Christian text the daat an early treaties on moral and ethical teachings while it does not speak of reincarnation directly it emphasizes that every action creates ripples that shape future spiritual experiences this aligns with the idea that a soul having cultivated specific energies in one life is naturally drawn towards circumstances that allow it to either resolve or deepen those energies modern spiritual thinkers like Brian Weiss through past life regression Studies have recorded cases where individuals recall choosing their parents before birth often as a way to heal Old Wounds or learn new lessons his work suggests that the soul is not passively assigned to a family it chooses based on what it needs for its next stage of growth this idea extends Beyond parent child relationships what about soulmates are some Souls destined to find each other across lifetimes the answer seems to be yes many Traditions believe that Souls travel in groups reuniting over and over in different roles sometimes as lovers sometimes as family sometimes as friends or even Rivals this is echoed in Swami vivekananda’s teachings where he speaks of a circle of souls that evolve together supporting and challenging one another in their journey toward Enlightenment even in philosophy this idea of interconnected Destinies appears in surprising places Cornell West though known for his work in social justice often speaks about how our relationships shape our very being that who we encounter in life is not accidental but part of a deeper pattern if this is true then the people we meet especially those who profoundly impact us might be Souls we have known before but if the soul has the power to choose then does it always make the right choice what happens when attachments desires or fears influence this decision could it be that some Souls return to familiar pain because they are unable to break free and if so how can one consciously prepare to Choose Wisely in the next life the answer lies in how we navigate death itself Beyond fear mindful preparation for death imagine for a moment that you are at the final moments of your life you are aware that your breath is slowing your body is growing lighter and something vast is unknown is approaching what do you feel fear Peace A desperate clinging to life or a calm surrender to something greater how we experience death just like how we experience life is shaped by our state of consciousness if death is a transition rather than an end then wouldn’t it make sense to prepare for it just as we prepare for any important Journey throughout history many great spiritual Traditions have taught that being mindful of death is not morbid or depressing but a path to Liberation the more we understand it the less we fear it and the more consciously we can choose our next experience in Tibetan Buddhism death awareness is considered one of the most powerful spiritual practices the Bardo thol often translated as the Tibetan Book of the Dead is not just a text for the dying it is a guide for The Living it teaches that at the moment of death if one can remain aware and recognize the clear light one can transcend the cycle of rebirth altogether but if fear takes over the soul becomes lost in Illusions pulled back into habitual karmic patterns this emphasis on awareness at death is not unique to Buddhism in ancient China the 13th century mystical text Aman ubava by janesa describes Consciousness as something Eternal and blissful urging Seekers to view death not as an Annihilation but as a merging with the greater whole this aligns closely with Sufi teachings where death is seen as a return not a loss but a

    homecoming to the Divine even in Western thought this wisdom appears in unexpected places confucious though known for his teachings on ethics and social order believed that contemplating death led to moral wisdom because understanding impermanence makes us more compassionate more Pres present and less attached to fleeting desires modern psychology is now catching up with this ancient knowledge Bren a brown a researcher on vulnerability argues that fully embracing mortality allows us to live more courageously similarly contemporary spiritual thinkers like Wayne Dyer suggest that self-inquiry and introspection reduce karmic burdens making the transition into the Afterlife smoother and more conscious so what does this mean for us it means that our awareness in life prepares us for awareness in death if we are Mindless in life if we suppress our fears avoid self-reflection and cling to Illusions we will likely remain unconscious in death simply carried Along by old karmic forces but if we practice mindfulness presence and Detachment we can remain awake even as we transition allowing us to choose our next Incarnation with Clarity rather than compulsion this brings us to one of the most mysterious aspects of reincarnation soulmates are some beings destined to find each other across lifetimes and if so why could it be that these connections are not just romantic but deeply kic playing a role in our Evolution across multiple existences if Souls travel together then what is the purpose of these reunions the answer May lie in The Invisible yet undeniable forces that pull certain soul Souls toward one another again and again soulmates and Karma why certain beings reunite have you ever met someone for the first time yet felt as if you had known them forever a deep unexplainable connection that goes beyond words Beyond time it’s as if something ancient and familiar recognizes their presence could it be that you’ve met before not in this life but in another many spiritual Traditions suggest that Souls travel together across lifetimes Bound by karmic ties that pull them toward one another again and again these connections aren’t always romantic they can manifest as deep friendships family bonds or even intense rivalries the purpose of these reunions isn’t mere companionship it is spiritual growth these Souls often called soulmates appear in our lives to help us evolve to challenge us and to remind us of the lessons we have yet to learn in Hindu philosophy the concept of reanu bandha explains this beautifully it suggests that every relationship in our life whether harmonious or difficult is a result of past karmic debts if we owe someone an unresolved lesson we are drawn to them again in the next life creating opportunities to heal complete or refine the connection this is why some relationships feel effortless while others are filled with challenges both types serve a higher purpose this idea is echoed in Buddhism where it is believed that certain Souls make agreements before birth to meet again some reunite to offer love and support While others come back into our lives as teachers sometimes in painful ways a person who betrays you may have done so in a past life as well and the unresolved Karma brings you together once more the challenge is to rise above resentment and transform suffering into wisdom a fascinating perspective on this can be found in the book of Thomas the contender a lesser known text from the nag hamadi Library it describes the Soul’s search for nosis true knowledge and suggests that repeated lifetimes offer opportunities to refine our understanding often through relationships that push us toward deeper self-awareness modern thinkers also explore this concept in profound ways Swami Viva Anda spoke of the circle of souls suggesting that we attract people into our lives based on our inner state if we are trapped in ego and illusion we will attract karmic lessons disguised as challenges but if we operate from wisdom and self-awareness we reunite with Souls that uplift and Inspire us even in Western philosophy this theme appears in surprising places Judith Butler a scholar known for her work on identity and relationships argues that who we are is deeply shaped by our connections though she speaks in a more social and political sense this aligns with the idea that our relationships across lifetimes help Define our spiritual Evolution so what does this mean for us it means that every meaningful connection in your life whether joyful or painful has a purpose it means that love is not just an emotion but a force that transcends time drawing certain Souls together again and again and it means that how we navigate our relationships today will shape who we meet and what we experience in our next Incarnation but if Soul connections are governed by karmic patterns then how do we break free from toxic Cycles how do we ensure that our next reunion is one of wisdom and growth rather than repetition and suffering the answer lies in understanding attachment the very force that binds us to the cycle of rebirth overcoming attachments the key to bodic Liberation imagine walking through a vast Hall of Mirrors each one reflecting a different version of yourself some joyful some sorrowful some burdened by regret the mirrors are endless and the more you look the more you realize that you are trapped within them unable to move beyond their grasp this is what attachment does to the soul it binds it to reflection after reflection lifetime after lifetime repeating patterns of Desire fear and longing but what if you could Step Beyond the mirrors and see clearly in Buddhist teachings attachment is considered the primary force that keeps the soul bound to samsara the cycle of birth and rebirth it is not just attachment to people or material things it is attachment to Identity emotions beliefs and even suffering the moment we cling to something we create a karmic link ensuring that we will return to resolve it if we leave this life still grasping at unfinished relationships desires or fears those very same attachments will pull us back into another Incarnation like a magnet drawing iron dust the Tibetan Bardo thol describes this vividly it states that Souls who die with strong Cravings whether for love Revenge recognition or even security are drawn back into life through those Cravings this is why breaking attachments is one of the most essential spiritual practice ices it is not about rejecting the world but about learning to live without being controlled by it this concept is beautifully mirrored in Surin KAG guard’s upbuilding discourses a lesser known but deeply profound philosophical work kard speaks about the need to detach from worldly concerns and place trust in the Eternal He suggests that suffering is not something to escape but something to understand and release much like the Buddhist notion of Liberation from samsara similarly Alan Watts a modern philosopher often spoke about the illusion of control he taught that true Freedom comes not from holding on but from letting go if we die in fear we create more fear if we die in peace we carry that peace into the next phase of our journey but attachment is not just a spiritual concern it is also deeply psychological modern psychospiritual studies suggest that unresolved traumas and emotions do not disappear when we die if anything they become part of the subconscious energy that guides us toward our next Incarnation Bob Proctor in his teachings on the subconscious mind often emphasized that our beliefs shape our reality not just in this life but beyond it so what does this mean for us it means that if we wish to Step Beyond the endless cycle of reincarnation we must begin now we must train our ourselves to observe our thoughts and emotions without being consumed by them we must learn to love without clinging to experience without grasping and to let go without fear if we Master this then when the time comes to leave this world we will do so with Clarity and peace and rather than being pulled into another life by unfulfilled desires we may find ourselves truly free perhaps for the first time but how do we practice this in daily life how do we prepare ourselves to navigate the transitions between life and death with awareness the answer lies in understanding that the bados are not just States after death they are states we experience every day and by mastering them in life we prepare ourselves for what comes next practical steps navigating transitions in daily life if the bardos are not just a phase after death but a state we experience daily then wouldn’t it make sense to train for death while we are still alive if our thoughts emotions and attachments shape our next Incarnation then every moment of awareness becomes an opportunity to consciously shape our Soul’s path the Tibetan Bardo thodol suggests that there are three primary bardos experienced in life the waking State the dream state and the meditative State each of these can be used as a training ground to practice awareness Detachment and Clarity meditation for example is often described as a mini death a temporary dissolution of the ego that allows one to experience a state Beyond attachment this concept is echoed in a lesser known esoteric text light on the path which provides poetic yet practical guidance for Spiritual Seekers it emphasizes that each step of increased awareness moves the soul closer to liberation ation the more we cultivate Stillness self-inquiry and Detachment the more we prepare ourselves for the moment when the body dissolves and the Soul faces the great unknown even in Western philosophy this principle is reflected political philosophy explores how Society influences individual Consciousness and many great thinkers like Jean jaac rouso argued that living in alignment with Justice and compassion refines not just the self but the collective energy of the world could it be that by contributing to a more ethical and harmonious world we also refine our own karmic path Beyond intellectual study practical methods exist to help prepare for the transitions of both life and death meditation for example trains the mind to recognize Illusions which is exactly what is needed in the bardos lucid dreaming where one becomes aware while dreaming mirrors the experience of the the B of becoming allowing the soul to remain conscious even as it moves between Realms even herbalism and plant medicine as practiced in many ancient cultures has been used to Aid in spiritual transitions certain sacred plants such as those used in indigenous Traditions are said to open the mind to deeper awareness helping individuals confront the fear of death and gain insight into their subconscious mind modern thinkers like Wayne Dyer also emphasized the power of self-inquiry and intentional living according to him the more one cultivates self-awareness and releases limiting beliefs the lighter their karmic load becomes making transitions between lifetimes smoother and more conscious so what does all of this mean it means that preparing for death is not about fearing the end it is about mastering the present every time you practice mindfulness every time you let go of unne necessary attachments every time you act with kindness and integrity you are shaping the trajectory of your soul you are making it more likely that when the time comes you will move forward with Clarity rather than confusion and if Souls truly choose their next Incarnation then wouldn’t it be wise to ensure that this choice is made not out of compulsion but out of conscious intention if we can learn to navigate the transitions of this life then perhaps we will be prepared to navigate the transitions Beyond it with full awareness with purpose and with peace this brings us to our final reflection if a soul chooses its next life what are the most important factors in that decision what determines the final trajectory of the Soul before it enters a new existence the answer May lie in the power of recognition of seeing Beyond illusion and embracing the vast Eternal nature of existence itself the way forward Ward as we return to the question posed at the beginning how does a soul choose its next life its parents and its soulmates we now see that the answer is far more intricate than we might have imagined it is not a simple matter of Fate nor is it entirely dictated by Karma instead it is a process shaped by awareness attachments subconscious imprints and the Soul’s ability to recognize truth Beyond illusion the Tibetan bardos reveal that after death the soul enters a state where its deepest fears desires and karmic patterns manifest before it if the soul remains unaware it is pulled back into the cycle of birth and rebirth drawn by unresolved attachments and past actions but if it recognizes the Luminous reality of Consciousness it has the potential to move Beyond compulsive reincarnation and choose its next experience with Clarity and wisdom this choice is Guided by many factors some souls are pulled toward particular families because of Unfinished karmic ties While others seek out parents who will provide the exact circumstances needed for their next phase of growth similarly soulmates are not simply people we are romantically destined to meet but beings with whom we have shared deep transformative experiences across lifetimes these reunions are not always easy sometimes they are filled with love and sometimes with conflict but they always serve a greater to purpose spiritual Evolution throughout history Mystics philosophers and modern thinkers have all pointed toward a singular truth Consciousness does not end with death whether through the lens of quantum physics ancient scriptures or personal spiritual experiences the evidence suggests that life continues in ways we may not fully understand the question is not whether the soul persists but how aware it remains in the process this is why so many Traditions emphasize the importance of mindfulness meditation and Detachment not to escape the world but to prepare for the moment when we will Step Beyond it if we leave this life with Clarity free from the illusions of ego and fear then we enter the next with a sense of purpose and intention but if we are lost in attachments and unconscious patterns we may find ourselves caught in a cycle of repetition returning to the same lessons until we are ready to move Beyond them so what does this mean for us it means that every moment of this life is an opportunity to shape the next it means that the choices we make today how we think how we love how we forgive are planting the seeds for what comes after it means that our greatest teacher is not death but the awareness we bring to life itself perhaps the most profound realization is this if we are choosing our next life then we are also shaping it now in this very moment and if that is true then what kind of existence do you wish to create what kind of energy do you want to carry forward what lessons will you choose to complete these are the questions that transcend life and death they are the questions that shape the Journey of the soul and perhaps in contemplating them we begin to awaken to a reality far greater than we ever imagined

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • India, Pakistan, and the State of Religious Harmony

    India, Pakistan, and the State of Religious Harmony

    This text comprises an interview exploring complex socio-political issues in India and Pakistan. Key themes include religious harmony between Hindus and Muslims, the impact of historical events like the demolition of the Babri Masjid and the revocation of Article 370, economic disparities, and the role of political leadership. The discussion also touches upon the legacies of Gandhi and Jinnah, examining their influence on the partition and subsequent tensions. Finally, the interview concludes by emphasizing the importance of humanity above religious or political affiliations.

    Analyzing Indian Society: A Critical Perspective

    Instructions: Answer each question in 2-3 sentences.

    1. What is the speaker’s perspective on the role of the government and administration in addressing wrongdoing, particularly in the context of communal issues?
    2. How does the speaker connect economic policies and population to the relative success of India compared to Pakistan?
    3. What are the speaker’s arguments concerning Article 370 and its removal?
    4. How does the speaker describe the legacy of Mahatma Gandhi and Nathuram Godse?
    5. What is the speaker’s view on the Uniform Civil Code and why does he suggest caution in its implementation?
    6. How does the speaker understand the relationship between justice, caste and religion?
    7. What is the speaker’s perspective on the comparisons between Rabindranath Tagore and Allama Iqbal?
    8. How does the speaker describe the current political climate and the alleged influence of the Modi government?
    9. What does the speaker mean when they say that “humanity” should come before religious identity?
    10. What is the overall message or plea the speaker tries to communicate at the conclusion of the interview/discussion?

    Quiz Answer Key

    1. The speaker believes that the government and administration should be the first to arrest those doing wrong in communal issues, and that weakness or lack of admission from those in power will only perpetuate negative actions. The speaker also asserts that the administration’s actions will define a state.
    2. The speaker argues that India’s large population has created a large market, which has led to more economic opportunities for the country, unlike Pakistan which has suffered a monopoly from its increased population.
    3. The speaker does not support the removal of Article 370, citing that it recognized Kashmir’s unique demographics, and that its removal has ignored the rights of the people in Kashmir, leading to protest.
    4. The speaker admires both Gandhi and Mahasahab, but finds that Gandhi’s lack of love for “Uday” and his desire to go to Pakistan, angered extremists like Godse, who the speaker links to the RSS.
    5. The speaker suggests that the government should not rush the implementation of the Uniform Civil Code, as the code should be a collective discussion between the government, religious leaders, and the people to ensure fairness for all groups.
    6. The speaker believes that justice should come before caste, religion or other group identities. He suggests that while people often believe that religious leaders have the answers, justice is for everyone.
    7. The speaker does not think that comparisons between Tagore and Iqbal are appropriate. He believes both made valuable contributions in their respective fields and that people prefer the authors they grew up with.
    8. The speaker feels the current political climate under the Modi government has ruined India’s pride by injecting religious division into society. They allege that Modi prioritizes Hindu happiness at the expense of Muslims.
    9. The speaker asserts that humanity is the highest ideal and that religious or any other identity should not come before it. They call for unity, and a focus on how humans should be treating each other.
    10. The speaker concludes by emphasizing the need for love, unity, and humanity over religious division, and asks that people stop following misleading or divisive narratives.

    Essay Questions

    Instructions: Write an essay of approximately 500 words for each prompt.

    1. Analyze the speaker’s critique of the Indian government and administration. How do specific examples they use relate to their overall arguments about justice, equality, and governance?
    2. Discuss the speaker’s understanding of the relationship between religious identity, nationalism, and political power. How does the speaker’s personal perspective inform their interpretation of current events?
    3. Evaluate the speaker’s perspective on the Uniform Civil Code. How does their view on this law connect to their broader concerns about religious diversity and equality in India?
    4. Compare and contrast the speaker’s interpretation of Gandhi and Godse. What do these contrasting figures represent within the broader context of Indian history and identity?
    5. How does the speaker’s use of economic concepts, like market growth and supply chain issues, support their more general political and social commentary? How does this use of economics connect to the other themes discussed in the source?

    Glossary of Key Terms

    Article 370: A special provision in the Indian constitution that granted special autonomous status to the state of Jammu and Kashmir. It was revoked by the Indian government in 2019.

    Babri Masjid: A mosque in Ayodhya that was demolished in 1992, which led to widespread communal violence between Hindus and Muslims.

    Communalism: A concept denoting loyalty to one’s own community or ethnic group rather than to the broader society or nation, often used in the context of religious or cultural divisions, particularly within South Asia.

    Indian National Congress: A major political party in India that played a key role in the country’s independence movement.

    Mahasahab: Refers to a respected elder or leader, used to denote the importance of a figure.

    Mohammed Ghazali: A Turkic conqueror who led several invasions of India during the early 11th century.

    Mughals: The dynasty that ruled much of India from the early 16th century to the mid-18th century, known for its contributions to art, architecture, and culture.

    Nathuram Godse: The assassin of Mahatma Gandhi, motivated by opposition to Gandhi’s policies and views, as well as his perceived bias towards Muslims.

    Rashtriya Swayamsevak Sangh (RSS): A Hindu nationalist organization established in 1925 that is viewed as a far-right Hindu nationalist group. It is often seen as the source of the ideology that assassinated Gandhi.

    Taliban: A fundamentalist Islamic organization, currently the de facto government of Afghanistan.

    Uniform Civil Code (UCC): A proposal to have a single set of laws governing personal matters such as marriage, divorce, and inheritance for all citizens, regardless of their religion.

    Vishwa Hindu Parishad (VHP): A Hindu nationalist organization known for its activism and involvement in various religious and social issues.

    India’s Unrest: A Critical Dialogue

    Okay, here’s a detailed briefing document summarizing the main themes and ideas from the provided text.

    Briefing Document: Analysis of “Pasted Text” Excerpts

    Overall Theme: The text presents a wide-ranging, somewhat disjointed, but passionate discussion of various issues impacting India, particularly focusing on social, economic, political, and religious tensions. The speaker(s) express concerns about justice, equality, and the direction the country is heading. It appears to be an interview or a dialogue with multiple participants, giving rise to conversational flow.

    Key Themes and Ideas:

    1. Religious Tensions & Hindu-Muslim Relations:
    • Allegations of Targeting Muslims: The text opens with a question about Indian Muslims being “the missile of Muslims,” implying a perceived threat or negative stereotype. The speaker refutes this, emphasizing the diversity within the Muslim community.
    • Blame for Discord: The discussion implicates not just the government, but also community leaders and society at large in the creation of disharmony. “Everyone is there, there is the government, there is the administration and there are also those people who are leaders of the community.”
    • Historical Grievances: The Babri Masjid demolition is referenced as a point of contention, and the speaker suggests a need for objective historical analysis.
    • Concerns of Religious Nationalism: There’s a critique of the idea of creating a nation based on religion, suggesting this is a “matter of man and monkey, it should be between God.”
    • Interfaith Harmony: The text stresses the long history of Hindus and Muslims living together in India. However, it acknowledges recent increases in communal tension, particularly during the Holi festival season which has become more polarized.
    • “Hindus and Muslims have been living together in India for thousands of years, you will be surprised, that is not the masala, the masala is the one which has spoiled the atmosphere in the Holi season which is still far away.”
    • Critique of Political Manipulation of Religious Tensions: The speaker suggests the current government, particularly Modi, have injected “poison” into India, leading to polarization. They are particularly concerned that Modi makes Hindus feel happy but seemingly does not cater to the Muslim population.
    1. Critique of Governance and Administration:
    • Weak Administration: The speaker criticizes a perceived weakness in administration, noting how wrongdoing is not always addressed. “If the administration is a state, then it will immediately first arrest those who are doing wrong and if the administration is weak and does not want admission then it leaves them.”
    • Economic Injustice & Inequality: The text highlights the unequal distribution of wealth in India, stating it mostly reaches those already privileged. It states “wealth distribution in India is still not equal, it has come to those people Those who are already good in the eyes of the government.”
    • Economic Disparities and Inflation: The speaker points out economic disparities by citing price differences between India and neighboring countries. The increased prices of essential goods in India is also criticized as a problem of ineffective administration. “The price here is up to ₹300 and up to ₹200 I reached there and asked both of my friends there that in Amritsar it was for ₹30 so the thing is that so much download, so good, you have got this on this only, if your administration is not right…”
    • Lack of Accountability: The speaker criticizes the system for not holding those who profit through corruption accountable, highlighting the need for active oversight. The speaker also stresses the need for immediate action when injustice is reported.
    1. Article 370 & Kashmir:
    • Critique of the Removal: The speaker expresses strong disagreement with the removal of Article 370, stating it was designed to protect the special status of Kashmir, where the majority population is Muslim. “Under Article 370, the people there were told that you are in India but your rights are different from those of common Indians.”
    • Rejection of Terrorism Link: The speaker questions the idea that terrorism in India was linked to Article 370 and calls for conversation as a solution.
    • Emphasis on Kashmiri Pride: The speaker suggests Indian Muslims should feel pride in Kashmir being a part of India and should want to be a part of that heritage.
    1. Historical Figures & Events:
    • Gandhi and Godse: The discussion delves into the assassination of Mahatma Gandhi, with the speaker highlighting that Gandhi was against the formation of Pakistan. They also stress that Gandhi was assassinated by a member of a party that is aligned with Modi’s government and that people who support Modi’s party also killed Gandhi. This is used to suggest a historical association with violence of the political ideology that Modi represents.
    • “I belonged to this party which is supported by Modi, whose Modi has also come and then you yourself say that you also tried to take Congress into the picture, I told you about that What did you say, Modi is from this party, we have come, a man of this party has killed Gandhi…”
    • Jinnah and Partition: The speaker defends Jinnah, arguing he was ready for the formation of Pakistan because there was no other viable leader in the region. This is also framed as a result of a lack of consensus by all parties in India’s transition.
    1. Social Issues:
    • Caste System: The speaker calls for a law to specifically address the discrimination and harm caused by caste. “The thing is that because of caste, a law should be made for heads because of the caste people.”
    • Uniform Civil Code: They raise concerns regarding a Uniform Civil Code, highlighting that it could infringe on the religious freedom of minority groups.
    • “Uniform Civil Code will be issued, the religious scholars here say that Muslims will again get trapped in this…I think that if we are Muslims, we are Hindus, we are Sikhs, we are Buddhists, some of our principles do not fit in the Uniform Civil Code…”
    1. Call for Justice and Equality:
    • Focus on Humanity: There is a strong emphasis on the importance of justice and human rights over religious differences, the speaker emphasizes: “There is nothing above humanity I have no religion, thank you”
    • Emphasis on Common Concerns: The speaker stresses the need to focus on the real problems of ordinary people, rather than being distracted by manufactured religious divisions.
    • Importance of Dialogue: The text ends on a positive note, with a call for continued debate and discussion for social reform, emphasizing that humanity must always come before religion.
    1. Literary and Intellectual Figures
    • Iqbal and Tagore: There is a discussion and comparision of Allama Iqbal and Rabindranath Tagore, two prominent literary figures. The speaker acknowledges that for people of the same language, one may be more loved than the other. There is a stated fondness for both authors and an argument against comparing them or stating one is more important than the other.
    • Javed Akhtar: There’s an opinion given that Javed Akhtar is a ‘thief’ and that the interviewer should have read the work of Javed Iqbal.

    Overall Tone: The tone is passionate, critical, and at times frustrated. The speaker expresses a strong desire for social justice, equality, and a more harmonious society. There’s a sense that India has been led astray by divisive politics and that the common person is suffering because of it.

    Conclusion: The text provides a complex and multi-faceted view of India’s current socio-political landscape. The speaker(s) are not afraid to criticize powerful institutions and figures and are clearly motivated by a deep desire for positive change. The conversation is rich in detail and offers a glimpse into the concerns of at least one segment of Indian society.

    India’s Fractured Soul: A Critical Analysis

    FAQ

    1. The speaker mentioned Indian Muslims being like a “missile.” What does this statement mean and who does the speaker hold accountable for this perception?

    The speaker uses the term “missile” to describe how Indian Muslims are sometimes perceived, implying they are seen as a dangerous or destabilizing force. He clarifies that he does not believe this to be true, rather this perception has arisen from failures across different sections of society. He places blame on multiple factors, not just one entity: the government and administration for failing to act impartially and enforce the law equally, community leaders for not addressing issues proactively, and even, in a complex way, how the actions of individuals are perceived, as he mentions that attacks from the past shouldn’t color how we see people today. He specifically mentions the government’s responsibility to act decisively against wrongdoing, regardless of the community, and for failing to address biases.

    2. What are the speaker’s views on the Babri Masjid demolition and its aftermath?

    The speaker references the Babri Masjid demolition in 1993 as an example of how historical events and their narratives are used to fuel division. He mentions that he himself wrote articles suggesting excavation to uncover the truth about its foundations. He criticizes those who immediately jump to conclusions based on religious identity. He also mentions how the Vishwa Hindu Parishad targets specific sites and communities. He suggests that creating nations on the basis of religion is a flawed premise and that faith should be a personal matter, not a source of societal division. He then points out this applies to other nations like Israel and their religious history.

    3. The speaker discusses the economic situation of India and Pakistan. What comparisons does he draw and what points does he make about government responsibility?

    The speaker compares India and Pakistan, focusing on their economic differences. He notes India’s rapid economic growth and status as the 5th largest power, while Pakistan is struggling. He suggests that India’s population has led to economic growth, especially in the technology sector. He attributes these differences to government policies and administration, citing issues of poor infrastructure, high prices of basic commodities like onions and tomatoes in India. He uses the example of price discrepancies to show how inefficiencies in the administration negatively affect the common citizen. He states that administrations have the responsibility of oversight and to act on complaints.

    4. The speaker expresses concern about rising tensions between Hindus and Muslims in India. What, in his opinion, has caused these divisions and how does he see the situation evolving?

    The speaker is deeply concerned about the rise in Hindu-Muslim tensions, which he sees as a departure from the historical peace and co-existence in India. He attributes the current atmosphere of division to the injection of “poison” by political elements, specifically referencing the current government (though he avoids mentioning any individual directly). He notes a trend where there is an effort by this government to appease Hindus while not doing so with Muslims, which he views as problematic. He laments that a “Hindu vs Muslim” mindset is becoming prevalent, even outside of real conflict or cause. He believes this has damaged the pride of India.

    5. What is the speaker’s perspective on Article 370 in Kashmir and its revocation?

    The speaker opposes the abrogation of Article 370, arguing that it was a special provision for Kashmir, a sensitive state with a Muslim majority. He believes that by stripping Kashmir of its special status, the Indian government is taking away their rights rather than integrating them with India. He also suggests the act of removing Article 370 is not in the interest of Indian unity, and that it may be a cause of the terrorism in the region. He notes that Article 370 did not hinder Kashmiris from living in India, going to school in Delhi, and having access to other parts of the country, as well as suggesting that the government didn’t communicate with them as well as they should have on the issue.

    6. The speaker discusses Gandhi and Godse in the conversation. What does he say about them and their significance?

    The speaker regards both Gandhi and Jinnah as leaders in their respective places and highlights their unique qualities. However, he discusses the circumstances surrounding Gandhi’s assassination. He notes that Gandhi’s assassination was the work of a “special party” with a right-wing ideology. He connects Godse’s actions to a larger movement that he claims is a product of the Rashtriya Swayamsevak Sangh, which he identifies as an extremist organization. He mentions that some people believed Gandhi favored Muslims and that Godse was a product of this sentiment. He also notes that there was a feeling that Jinnah had no choice but to form Pakistan, due to the circumstances. He feels that no one paid attention to his views and that Jinnah did nothing wrong, but that time was an element that caused the events to occur as they did.

    7. The speaker mentions the Uniform Civil Code. What is his opinion on the matter?

    The speaker expresses concern about the potential pitfalls of implementing a Uniform Civil Code without adequate consultation. He suggests that while he agrees people need to be equal in society, the government needs to consult with religious leaders from different communities to understand why certain groups might not be able to follow the Uniform Civil Code. He also makes the point that “religious freedom” does not mean people should follow these laws automatically. He emphasizes that rushing this decision is not good governance. He also makes the point that religious leaders are imperfect. He states that government officials need to approach this matter more thoughtfully, and suggests that this kind of behavior is what “misleads” people.

    8. The speaker talks about the importance of humanity. What does he emphasize when he talks about how people should behave?

    The speaker emphasizes the paramount importance of humanity over religious or political identities. He suggests people should be mindful of misleading information, and that people should trust their own hearts. He argues that the divisions are being fueled by misleading narratives and that people shouldn’t blindly follow these narratives. He also says he wants to see the end of the idea that Hindus and Muslims are at odds, especially in matters of day to day life. He calls for justice to be delivered with strict actions and says that this is why people are being misled. He states that people need to know there are more peace loving people than not, and that humanity is the most important thing, and above all religion. He claims he does not have a religion.

    India-Pakistan Relations: A Conversation

    Okay, here is a timeline and cast of characters based on the provided text:

    Timeline of Main Events/Topics Discussed

    • 1993: Babri Masjid demolition. This event is mentioned as a key point of conflict and is used to illustrate administrative weakness and bias. There was a supposed serial made about this. The speaker also wrote two articles at the time about the site needing excavation.
    • Past (unspecified): Mohammed Ghazali’s attacks on India. This is brought up to challenge the idea that aggression is solely a modern issue or uniquely tied to one religion.
    • Recent past (unspecified): The speaker mentions price gouging and lack of oversight on the sale of basic goods. They also refer to price differences between India and Pakistan, noting that prices in Pakistan can be lower.
    • Recent past (unspecified): Discussion of India becoming the 5th largest economy with a growing population. This is contrasted with Pakistan’s economic struggles.
    • Recent past (unspecified): Kashmiri people are discussed, as well as their educational migration, and the infrastructure of Kashmir. The financial burdens are mentioned, specifically the high cost of living.
    • Recent past (unspecified): Discussion of the removal of Article 370 from Kashmir.
    • Pre-Independence (unspecified, but likely early 20th century): Discussion of Mahatma Gandhi and his political positions and assassination. Nathuram Godse, the assassin, is placed within the context of the RSS.
    • Pre-Independence (unspecified, but likely mid-20th century): The speaker reflects on the creation of Pakistan, Jinnah’s role and how the political leaders of the time are viewed in retrospect.
    • Recent past (unspecified): Discussion of a Uniform Civil Code being considered in India.
    • Present: Discussion about how to properly interview and ask questions, and the necessity of not discriminating against anyone or their religion.
    • Present: Discussion of Allama Iqbal and Rabindranath Tagore, two well known writers.
    • Present: The speaker contrasts Indian and Pakistani people’s mindsets. They are hopeful that both sides can move past conflict and division.
    • Present: Discussion of an upcoming Holi festival and a hope that it will be peaceful.

    Cast of Characters

    1. Unnamed Speaker (Film Sahab): The primary voice in the provided text. They are opinionated, well-read, and speak on a variety of subjects, from religious conflict and history to economics and social justice. They seem to strive for equality and an end to religious and nationalistic strife.
    2. Afzal Sahab: A person who is labeled as a criminal and taken out in old times, referenced in connection to the Vishwa Hindu Parishad website. He is used as an example of biased media reporting and targeting. There is another reference to an Afzal Rehan, which might be the same person, but is unclear.
    3. Mohammed Ghazali: Historical figure. An invader of India. His attacks are used as an argument that violence is not a new concept, and not unique to one religion.
    4. Subhashree: A person who is referenced in connection to price gouging, she paid an inflated price for gas at the pump.
    5. Usman: Is referenced in connection to inflated gas prices.
    6. Modi (Sahab): Current Prime Minister of India. He is criticized for creating division between Hindus and Muslims, and for actions in Kashmir. However the speaker later admits that he believes the average Indian has a sense of pride in Modi’s India, as they have a habit of respecting their leader.
    7. Mahatma Gandhi: Indian independence leader. His political views and death are discussed in detail. He is portrayed as being non-sectarian, but the speaker also acknowledges the narrative that he was killed because some thought he favored Muslims.
    8. Nathuram Godse: Gandhi’s assassin. He is described as being tied to the Rashtriya Swayamsevak Sangh (RSS).
    9. Jinnah (Sahab): Leader of the Muslim League, the individual primarily responsible for the creation of Pakistan. He is presented as a leader with few options and that was simply following the will of the people.
    10. Allama Iqbal: A well known writer.
    11. Rabindranath Tagore: A well known writer.
    12. Javed: The son, or son-in-law of a famous writer, who isn’t well known. The speaker says he doesn’t want to have his thinking spoiled by such nonsense and claims that he prefers to read people like Bal.
    13. Bal: A writer who has been read by the speaker and whom the speaker is very impressed by.
    14. Swami Vyas: Someone whom the interviewer did not speak with.
    15. Unnamed interviewer (You): The person conducting the interview with the primary speaker, and is frequently addressed by the primary speaker to clarify their point.

    Additional Notes: *The text is from a conversational setting, the speaker often digresses into different topics. *Some of the names could be misspelled, given the nature of the conversation.

    • There are varying levels of specificity as to when events happened. Some have specific dates, some have a general time frame, some are completely unclear as to when they occured.

    I hope this is helpful! Let me know if you have any other questions.

    India-Pakistan Relations: Conflict and Hope

    India-Pakistan relations are complex and have a history of conflict and tension [1, 2]. Here’s an overview of the key points discussed in the sources:

    • Historical tensions: The partition of India led to violence and displacement, with Hindus and Muslims being selectively killed [3]. The creation of Pakistan was not universally agreed upon [4].
    • Kashmir: Kashmir is a sensitive region with a majority Muslim population [2]. Article 370, which granted special rights to the people of Kashmir, was removed [2, 4]. This action has been a point of contention, with some arguing that it was not necessary for the unity of India [4].
    • Accusations and mistrust: Some accuse Pakistan of being India’s biggest enemy [1]. Some believe that India’s current government has injected “poison” into the country by creating divisions between Hindus and Muslims [2]. There is also a sense of mistrust between the two countries [1].
    • Economic disparities: Pakistan’s economy is struggling, while India’s is growing rapidly [1, 5]. India’s population size is seen as an economic advantage, while Pakistan’s economy suffers from a lack of resources [1]. The prices of basic goods like onions and tomatoes are much higher in India than in Pakistan [1].
    • Calls for peace and understanding: Despite the conflicts, there are calls for justice, peace, and understanding between the two countries [5, 6]. Some people believe that the focus should be on humanity and not on religious differences [7]. There is a desire to move past the divisions and focus on the common problems faced by both countries [6]. There are people who feel that Pakistan is like India and they don’t consider religion or politics important [3].
    • Internal issues: The sources also address issues within India, such as the unequal distribution of wealth [5], unemployment [5], and the mistreatment of minorities [2]. It is argued that these problems are not caused by Pakistan but are internal to India [5].

    In summary, the sources reveal that India-Pakistan relations are marred by historical conflicts, territorial disputes, economic disparities, and internal issues. Despite these challenges, there are also voices calling for peace, understanding, and a focus on shared humanity.

    Hindu-Muslim Relations in India

    The sources discuss religious harmony in the context of India, primarily focusing on the relationship between Hindus and Muslims. Here’s a breakdown of the key points:

    • Historical Coexistence: Hindus and Muslims have lived together in India for thousands of years [1]. There was peace in India even before the Mughals [2]. This long history of coexistence suggests an underlying potential for harmony.
    • Divisions and Tensions: Despite the historical coexistence, there are tensions between the two communities [2]. Some feel that the current government has created divisions between Hindus and Muslims, injecting “poison” into the country [2]. The sources suggest that the atmosphere has been spoiled, with people identifying each other primarily by their religious affiliation (“you are a Hindu, I am a Muslim”) [1, 2]. This division is a cause of concern for some [1].
    • Calls for Unity: There are calls for unity, with people expressing the view that religion should not be a primary identifier [3]. They emphasize that humanity is paramount and that all people should be treated equally, regardless of their religion [3]. Some individuals see all Indian Muslims and Hindus as their own [1].
    • Misguided Actions and Misinformation: Some believe that misleading writings have divided the people and that they should not be misled by these things [3]. There is also the idea that people should not follow a particular “push” or agenda that divides them [4].
    • Importance of Justice and Equality: The sources stress the importance of justice and equality for all, regardless of caste or religion [5]. There is concern that the government is not treating all citizens equally and that some groups are being marginalized [2]. There are calls for the government to consult with religious leaders before making decisions that could affect their communities [6].
    • Uniform Civil Code Concerns: There are concerns about the implementation of a Uniform Civil Code, with some religious scholars fearing that Muslims will be trapped by it [6]. Some feel that the government should consult with religious leaders before implementing such a code [6]. The concern is that some principles of various religions might not align with a uniform code [6].
    • Focus on Humanity: Many believe that humanity should be the guiding principle, rather than religious divisions [3]. They believe that if there is humanity, then there is no need for concern about religious differences [3].

    In summary, while the sources acknowledge the existence of religious harmony in India’s past, they also highlight the present tensions and divisions. However, there are also strong calls for unity, justice, and a focus on shared humanity over religious identity. The sources emphasize that the path to religious harmony involves overcoming misinformation, promoting equality, and prioritizing the common good over divisive agendas.

    India’s Political Climate: Government, Citizens, and the Future

    The sources touch on political discourse in India, particularly concerning the relationship between the government and its citizens, as well as the broader political climate. Here’s a breakdown of the key themes:

    • Government Accountability and Actions: There is a significant focus on the actions and responsibilities of the government. The sources discuss the government’s role in maintaining law and order, ensuring justice, and managing the economy [1, 2]. There are concerns that the government is not always effective in these areas. For example, it is suggested that a weak administration may fail to arrest wrongdoers, and that the government isn’t doing enough to control rising prices [1, 2].
    • Criticism of the Current Government: The sources express criticism of the current government, with some claiming that it has “ruined the pride of India” and injected “poison” into the country by creating divisions between Hindus and Muslims [3]. Some believe that the government favors Hindus, while neglecting Muslims, and there is a view that the government’s actions have made it hard for Muslims to be happy [3]. The sources suggest that the government needs to address the concerns of all citizens, not just specific groups [3, 4].
    • Article 370 and Kashmir: The removal of Article 370, which granted special rights to Kashmir, is discussed as a controversial political move [3]. Some argue that this action was not necessary for the unity of India and that it has led to unrest in the region [3].
    • Unequal Wealth Distribution: The sources highlight the issue of unequal wealth distribution in India [5]. It is argued that the government’s policies have favored those who are already wealthy, leaving the common man struggling with unemployment and financial hardship [5]. This is a theme throughout the discussion, where the economic policies of the government are being scrutinized as well as their affect on citizens [2, 5].
    • Importance of Citizen’s Rights: The sources emphasize the importance of protecting the rights of all citizens [6]. It is argued that the Indian Constitution is a blessing for everyone and that the state should protect the rights of every citizen [6]. There is a concern that these rights are not being adequately protected.
    • Calls for Dialogue and Consultation: There is a call for the government to engage in dialogue with religious leaders and other stakeholders before making major policy decisions [4]. This is particularly relevant in the discussion about the Uniform Civil Code [4]. Some believe that the government is rushing into these decisions and that it needs to consult with people to understand their concerns [4].
    • The Legacy of Gandhi: The sources discuss the legacy of Mahatma Gandhi, who is portrayed as a leader who did not favor one group over another [7, 8]. He is contrasted with current political figures and policies and there is some discussion around the circumstances surrounding his death [7, 8].
    • Political Parties and Ideologies: There is reference to the Rashtriya Swayamsevak Sangh (RSS) as an extreme organization [7]. The sources also discuss how some people view the current government as aligned with the ideology of Gandhi’s assassin [8]. There’s a discussion about how supporting a political party is different from adopting its policies [8].

    In summary, the sources reveal a critical perspective on the current political discourse in India. There is a strong emphasis on government accountability, equal treatment of all citizens, and the importance of dialogue and consultation in the decision-making process. The sources suggest that there are concerns about the government’s actions and policies, as well as calls for a more inclusive and just approach to governance.

    Social Justice in India

    The sources address social justice in India, particularly focusing on issues of equality, fairness, and the treatment of marginalized groups. Here’s a breakdown of the key points related to social justice:

    • Equality and Discrimination: The sources highlight concerns about discrimination and inequality within Indian society [1-3]. There’s a perception that the government favors certain groups (Hindus) while neglecting others (Muslims) [4]. The discussion about the Uniform Civil Code raises concerns that it may disproportionately affect Muslims [5]. There are also concerns that certain people are being targeted and singled out because of their religious affiliation [1].
    • Unequal Wealth Distribution: The sources indicate that there is an unequal distribution of wealth in India, with the benefits of economic growth not reaching the common man [2]. This economic disparity leads to unemployment and financial hardship for many [2]. The government’s policies are criticized for allegedly favoring those who are already wealthy, exacerbating the problem of inequality [2].
    • Justice System and Administration: The sources discuss the importance of a fair and effective justice system [6]. There are concerns that the administration may be weak or biased, failing to arrest wrongdoers and enforce the law equally [1, 6]. There is the suggestion that when the administration is weak, it does not address wrongdoings, and that this can lead to injustice [1].
    • Marginalized Groups: The sources emphasize the importance of protecting the rights of all citizens, particularly those of marginalized groups [4]. The discussion about Article 370 highlights the concerns about the rights of the people of Kashmir, who are a majority Muslim community [4]. There are references to the mistreatment of Muslims in India [1].
    • The Role of Religion: The sources touch on how religious identity can be a source of both unity and division [4]. The sources suggest that some people are being treated differently based on their religious affiliation [1]. However, there are also calls for unity, with people expressing the view that humanity is paramount, and that all people should be treated equally, regardless of their religion [7]. The sources emphasize that there should be justice for all, irrespective of religion [1].
    • Calls for Reform: The sources reveal calls for social and economic reforms to address these injustices [6, 7]. There is an emphasis on the importance of dialogue and consultation with religious leaders and other stakeholders before making major policy decisions that may affect their communities [5]. There are discussions about the need to address the root causes of division and inequality in the country [7].
    • Need for a Just Society: The sources indicate that there is a desire for a just society where all citizens are treated fairly and equally, where the government protects the rights of all people, and where justice is applied to all regardless of religious affiliation [1, 6].

    In summary, the sources reveal significant concerns about social justice in India. These include issues of religious discrimination, economic inequality, an ineffective justice system, and the mistreatment of marginalized groups. The sources also highlight calls for reforms and a more just society where all people are treated equally. The overall message is that India has significant challenges to address to ensure that it lives up to its ideals of equality and justice for all.

    India’s Wealth Inequality: A Critical Analysis

    The sources discuss wealth distribution in India, highlighting concerns about inequality and its impact on various segments of society. Here’s a breakdown of the key points:

    • Unequal Distribution: The sources indicate that wealth distribution in India is not equal [1]. It is suggested that the benefits of economic growth are not reaching the common man and are primarily going to those who are already wealthy and “good in the eyes of the government” [1].
    • Economic Hardship for the Common Man: The unequal distribution of wealth leads to unemployment and financial hardship for many ordinary people [1]. The sources suggest that there is a significant gap between the wealthy and the working class, with many people struggling to make ends meet.
    • Government’s Role: The government’s economic policies are criticized for allegedly favoring the already wealthy, which exacerbates the problem of inequality [1]. The sources suggest that the government is not doing enough to address the economic struggles of the common man and that the current system reinforces existing wealth disparities.
    • Rising Prices: The sources discuss the issue of rising prices of essential commodities, like onions and potatoes, which can cause significant hardship for ordinary people [2]. It is suggested that these prices are not being effectively regulated by the government and that this disproportionately affects those with fewer resources.
    • Economic Growth vs. Equity: While India’s economy is said to be growing rapidly and is now the 5th largest in the world, the sources question whether this growth is benefiting all citizens [2]. The sources imply that economic growth alone is not sufficient if it is not accompanied by equitable distribution of wealth. There is a concern that the benefits of economic growth are not reaching the working class [1].
    • Monopolies and Economic Manipulation: The sources reference the idea of creating a “monopoly” to increase profits, suggesting that some businesses may be manipulating the economy to their own advantage [2]. There is a concern that the government may not be doing enough to prevent these kinds of practices.
    • Comparison with Other Countries: The sources compare the prices of certain goods in India to those in other countries, such as Pakistan, Bangladesh and Nepal, suggesting that India’s economic performance is not as good as it might seem [1, 2]. This highlights that relative economic metrics may not tell the whole story.
    • Lack of Representation: The sources indicate a lack of representation of the working class in society [1]. This suggests that those most affected by unequal wealth distribution may not have a voice in the decision making process.

    In summary, the sources portray a situation where wealth is not being distributed fairly in India, leading to economic hardship for many. The sources suggest that the government’s policies and actions may be contributing to the problem, rather than solving it. There’s a clear emphasis on the need for economic reforms that promote a more equitable distribution of wealth and ensure that the benefits of economic growth are shared by all citizens.

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • Muridke My Beloved City from my Childhood Sheikhupura Tehsil Muridke: A Tour and Notable Figures

    Muridke My Beloved City from my Childhood Sheikhupura Tehsil Muridke: A Tour and Notable Figures

    This source presents an overview of Tehsil Muridke, located in the Sheikhpura district. The speaker in the video describes the tehsil’s history, including its former name and the establishment of a town by the British government near the railway station. The video also mentions key locations within the tehsil, such as Galla Mandi, Rail Bazar, and Kala Shah Kaku. It highlights the presence of various government institutions, hospitals, schools, and a sports complex. Finally, the video names prominent figures from the area As Rana Tanvir Hussain, primarily cricketers who have gained international recognition for Pakistan. The speaker hopes the video will be well received and promises future informative content.

    Rana Tanvir Hussain

    Tanveer Hussain: Public Accounts, Politics, and Personal Reflections

    This source presents a wide-ranging interview with Tanveer Hussain, a Pakistani politician. The discussion spans topics from his personal life and political career to broader issues facing Pakistan. Hussain shares anecdotes about his childhood, reflects on his time in public office, and offers his opinions on contemporary political figures and events. He addresses allegations of corruption, discusses challenges facing the country, and reveals his preferences in food, entertainment, and personal philosophy. Throughout the interview, Hussain offers insights into his character and worldview, providing a glimpse into the complexities of Pakistani politics and society.

    Tanveer Hussain: A Study Guide

    Quiz

    Instructions: Answer the following questions in 2-3 sentences each, based on the provided excerpts from “Tanveer Hussain: Public Accounts, Politics, and Personal Reflections.”

    1. What position did Ajay hold in the Muslim League of Nations, and who was his senior leader?
    2. What is Tanveer Hussain’s perceived public persona regarding his temperament, and how does he respond to this perception?
    3. According to Tanveer Hussain, what role did his family, particularly “Balo sahab,” play in his career?
    4. What issue regarding changes around New Delhi does Tanveer Hussain mention, and how does it relate to his political career?
    5. What percentage of deep change was made when Tanveer Hussain left his role?
    6. What is Tanveer Hussain’s approach to project completion, and how does it differ from the perceived norm?
    7. What examples of martial law during his grandfather’s and his time does Tanveer Hussain recall?
    8. What does Tanveer Hussain say regarding the conscience and what should be given so that Raghavan knows?
    9. According to Tanveer Hussain, what was one of the reasons for the People’s Party wanting to give a dharna?
    10. What was one of Tanveer Hussain’s favorite actors and one of his favorite actresses from that era?

    Quiz Answer Key

    1. Ajay was the Chairman of the Public Accounts Committee of the Muslim League of Nations. His senior leader was Tanveer Hussain.
    2. Tanveer Hussain is perceived as strict and bitter, easily saying harsh words. He acknowledges being an angry man but claims he tries to avoid “massage” (conflict) even in normal situations.
    3. His family, especially “Balo sahab,” played a significant role in putting him in the field and influencing his political career, including some “Adani treatment political.”
    4. He mentions that when changes around New Delhi are written about, the “A of change” gets suppressed or finished. He talks about how things can be improved, but there is a little resistance in it.
    5. When Tanveer Hussain came to his role, the percentage was at 12%, but when he left, it was 4%. Therefore, 8% was the total amount of deep change.
    6. Tanveer Hussain’s approach was to focus on ensuring every project in his area, like those started by the Delhi government, gets completed according to the rules. He did not want one project to be completed and others to be left undone.
    7. He recalls martial law being imposed during his grandfather’s time and again during his time, mentioning the imposition of 200 “Vimaanchaan” (restrictions) in March.
    8. Tanveer Hussain says that whatever you know about the conscience, you should give so that Raghavan till today knows.
    9. Tanveer Hussain states that he cannot say if the People’s Party and the establishment are on the same page, but the way the People’s Party wanted to give a dharna might explain that they are not.
    10. One of Tanveer Hussain’s favorite actors was Ibrani the great, and his favorite actress was Meena.

    Essay Questions

    Instructions: Choose one of the following essay questions and write a well-structured essay based on the provided source material.

    1. Analyze Tanveer Hussain’s leadership style and political philosophy as revealed in the interview. Support your analysis with specific examples from the text.
    2. Discuss the challenges and obstacles Tanveer Hussain faced during his political career, drawing on evidence from the excerpts.
    3. Explore the role of family and personal background in shaping Tanveer Hussain’s political identity and trajectory.
    4. Examine Tanveer Hussain’s views on governance, corruption, and social change, providing textual evidence to support your claims.
    5. Evaluate Tanveer Hussain’s self-perception and public image, comparing and contrasting his own assessment with the interviewer’s perspective.

    Glossary of Key Terms

    • Public Accounts Committee: A legislative committee responsible for examining the government’s expenditures and financial accounts.
    • Muslim League of Nations: A political party (as identified in the text).
    • Adani Treatment Political: An apparent reference to specific political treatments or situations involving or like Adani (needs more context to be specific).
    • Dhanush Yagya: A specific administrative plan or project (as identified in the text).
    • Vimaanchaan: Restrictions or limitations (as identified in the text).
    • Ehsaas Program: A specific social welfare or poverty alleviation program (as identified in the text).
    • Langar Khana: A community kitchen or free food distribution center, often associated with religious institutions.
    • Vote Bank: A group of voters who consistently support a particular political party or candidate.
    • Dharna: A form of protest or sit-in demonstration.
    • PTI Cats: Reference to political party debt.

    Tanveer Hussain: Politics, Governance, and Personal Reflections

    Okay, here’s a briefing document summarizing the main themes and important ideas from the provided excerpt of “Tanveer Hussain: Public Accounts, Politics, and Personal Reflections.”

    Briefing Document: Tanveer Hussain Interview Analysis

    Source: Excerpts from “Tanveer Hussain: Public Accounts, Politics, and Personal Reflections” (translated)

    Main Themes:

    • Political Life and Career: The interview provides insights into Tanveer Hussain’s political career, focusing on his role as Chairman of the Public Accounts Committee of the Muslim League of Nations, and various political events that shaped his trajectory.
    • Personal Philosophy and Character: The interview explores Tanveer Hussain’s personality, his approach to leadership, his values, and his reflections on life experiences.
    • Governance and Development: The conversation touches upon topics related to governance, development, and specific projects undertaken during his time in power, including discussions about infrastructure, education, and social welfare.
    • Party Politics and Alliances: The interview delves into the dynamics of party politics, including pressures faced within the party, defections, alliances, and the ever shifting political landscape.
    • Elections and Electoral Processes: There is considerable discussion of elections, including concerns about electronic voting machines, rigging allegations, and the integrity of the electoral process.
    • Social and Cultural Reflections: The interview also touches upon social and cultural aspects, including reflections on women, entertainment, and personal preferences.

    Key Ideas and Facts:

    • Personal Traits: Tanveer Hussain acknowledges being perceived as “strict and bitter” and “an angry man,” but claims he tries to avoid unnecessary conflict.
    • “You are a very strict and bitter man. How can you say harsh words very easily? I think people should understand that I am a very angry man, but this promise is also correct. I try to avoid massage even in normal ways…”
    • Early Life and Influences: He mentions being born in Shahpura and credits his family for his involvement in politics and public service.
    • “Born in Shahpura and reached the wire fences what kind of environment was around you in your childhood which helped you in deciding the self of life we ​​will increase things, we will make arrangements now we did it in between 10-12 I did it but later I came to know that there are changes around New Delhi…”
    • Development Efforts: He highlights efforts made during his tenure to improve infrastructure, electricity access, and education enrollment, claiming significant progress in these areas.
    • “…with Bhargava’s vision we tried to work in the social sector relief to the people these facilities so basic they should also be given a lot of lettuce and in that the account was less successful the second infrastructure is the matter of electricity fixed enrollment or people got inflation the whole thing will be that when we came the total percentage was made 12 per cent so when we left 4 percent we made deep change…”
    • Project Management: He emphasizes his focus on ensuring projects are completed on time and according to regulations, preventing selective focus on certain projects over others.
    • “Subhash, the project on which you used to focus, it used to get completed before time, my point was that till Rajanpur Chilli, every project or every place is getting delivered as per the rules, evening, if any 20 projects have started in my area by the Delhi government, if I focus on one then it should get completed, but the other one should not be completed, this should not happen in front, that is called Bigg Boss, who is delivering a behavior to every gram individual…”
    • Martial Law memories: Hussain recalls the era of martial law and the imposition of restrictions during his grandfather’s and his own time.
    • “…I will tell you one interesting thing that all the March holidays that were imposed when martial law was imposed, you take that in my grandfather’s time and while filling 98100 in my time, 200 Vimaanchaan was imposed that in nine March, the statue was run, if our family saw, then we in order Ghagra because we made it too and it is said that you have very good people with you so different sir both are hot fruits of recovery correction market second was theirs general they had hair of love type so Ghagra accident happened, birth story is being written second is doing it from top and from top to bottom and according to their own so these people are and channel and according to their work we should move forward…”
    • Party Defections: He addresses the issue of people leaving the party, mentioning potential offers and the importance of conscience.
    • “…till today someone knows that I am myself now how much symptoms maybe in the party itself If we finish then because of two statements that how difficult it is for the leadership and on which side do you feel yourself to stand, Mohammad is a word of love, it was a protected statement due to the media asking questions…”
    • Allegations of Corruption: The interview references allegations against political figures, including accusations of corruption and money laundering.
    • “…the way People’s Party wanted to give a dharna, when we wanted to talk, the way they have retreated a little from there, if the arrest is made, then today you would not have got any opinion, they would have done it, they must have some thinking, but the way this thing is going on, this prayer you help matter, give honey and People’s Party in any of their shops, first in Punjab and then in the next phase, Markaz also had an India, then why did you people like me, Ramesh, it could be an explanation of the role Punjab played during that period…”
    • Views on Imran Khan: He critiques Imran Khan’s governance and his actions, specifically regarding electricity pricing.
    • “you used to say that if there were Chinese banks, then the Prime Minister is a thief, you wanted electricity to be expensive, cars, chillies and all these things, will we do it? No, now we will do it, right? People are calling it thief, you tell us the formula, because if the rate of electricity is increased, then the Prime Minister is a thief, if petrol is expensive, then the Prime Minister is a thief, and if the dollar is expensive, then the Prime Minister is a thief, let’s talk about it…”
    • Electronic Voting Machines: Concerns are raised about the reliability and vulnerability of electronic voting machines.
    • “… talks of this hand have been going on in your race also but now what do you people have to do with the electronic voting machines, the British Raw Race which we brought, we had a lot of management but we did some 40 crores on which the total position was right in the intoxication, rich parliament I took refuge in their consensus, why is CTI fighting with us, so a committee was formed, Jasmine skin was expensive, it was such a Dungar, the CSP was clear, they said yes to it, we did 401 cream, the rest we did not do and we had also tried the voting machine once, but we saw that it is not that strong and its rejection is what we want to do, the answer is that a correct election poll cannot be done under election alarms and many other things can be done under it, under this the election commission can do the post only on the voting machine because it is stuck…”
    • Personal Preferences: He shares his enjoyment of music and movies, mentioning old Indian films and favorite actresses. He also expresses a fondness for certain foods and places.
    • “Let me tell you what can be shown on camera, it is painful but the thing is that I am very fond of some things, that is to say ginger, when this path is full, to the launch network, many songs should be sung, it is good and there are songs of a cycle and many more songs are also there in me today and I listen, I used to keep a record player in college also and then came the tape recorder, I used to keep that too, so long play, that they used to consider India Se Swagat, clock play in which there are more songs of singer, so that Mumtaz was not made near our college and it was available nearby, so we used to take from there, Akshay, Bomb, Prateek, Rafi’s all these are false and good games…”

    Overall Assessment:

    The interview provides a multifaceted glimpse into the life and career of Tanveer Hussain, offering valuable insights into Pakistani politics, governance challenges, and personal reflections. However, due to the fragmented nature of the transcript and potential translation issues, some aspects may require further clarification. The interview reveals a politician who is both reflective and opinionated, willing to engage in discussions about controversial topics and share personal anecdotes.

    Tanveer Hussain: Public Accounts, Politics, and Personal Reflections

    Tanveer Hussain FAQ: Public Accounts, Politics, and Personal Reflections

    1. Can you describe your personal approach to your role as Chairman of the Public Accounts Committee, particularly when dealing with sensitive issues?

    My style is direct and complete. I am known for being strict and perhaps even bitter, but I believe in avoiding superficialities. While I strive to be fair, I also don’t shy away from harsh words when necessary. I try to work as part of a team, focusing on achieving results, and making sure that projects are delivered on time.

    2. What are some of the key changes or reforms you attempted to implement during your time in power?

    We tried to work on the social sector providing relief to the people with basic facilities. Some of the key areas we focused on included infrastructure, electricity, and fixed enrollments. We managed to significantly reduce the percentage of inflated costs in projects from 12% to 4%.

    3. You mentioned focusing on project completion. How did you ensure projects were completed on time and according to regulations?

    My priority was ensuring every project, from Rajanpur to Chilli, adhered to regulations and timelines. If the government of Delhi initiated twenty projects in my area, my focus was on ensuring every project was completed on time and according to regulations.

    4. What is your opinion on the current state of Pakistan’s political leadership and governance, particularly concerning corruption and debt?

    The current state of political leadership and governance leaves something to be desired. I question the transparency of financial arrangements with entities like Chinese banks, and believe that the current method of how the Prime Minister is deemed a “thief” is not being properly addressed.

    5. What is your stance on electronic voting machines and the fairness of elections in Pakistan?

    I have concerns about the reliability of electronic voting machines. I believe a correct and fair election process cannot be guaranteed if the election commission only relies on voting machines.

    6. The interview touches on pressure from within the party and offers you may have received. Can you elaborate on these experiences and why you remained committed to your path?

    Yes, I have faced pressure from within the party and received offers that would compromise my ideals. However, my loyalty lies with my conscience and standing up for justice, this has caused me to remain committed to my principles even amidst difficulties.

    7. What are your thoughts on the role of family legacy and inherited privilege in politics?

    I acknowledge that family legacy can be a tool, but it does not guarantee capability. The son of a doctor may not necessarily become a doctor, and the sons of landowners might pursue different paths. Ultimately, individual merit and competence are essential.

    8. What are some of your personal interests and leisure activities that provide you with a break from the pressures of politics?

    Away from politics, I appreciate solitude and enjoy listening to music. I am fond of old Indian films and music, and I also enjoy spending time with friends.

    Tanveer Hussain: Politics, Governance, and Personal Reflections

    Tanveer Hussain is a senior leader associated with Ajay, who is the Chairman of the Public Accounts Committee of the Muslim League of Nations. The source text provides insights into his background, personality, political views, and personal preferences:

    • Personality and Approach: Tanveer Hussain acknowledges being perceived as strict and bitter, admitting he can use harsh words easily. He describes himself as an angry person but also someone who avoids flattery.
    • Political Involvement and Reflections:He was born in Shahpura and discusses his journey to higher political positions.
    • He reflects on changes that occurred during his rule, particularly in the social sector and infrastructure, such as improvements in electricity and enrollment rates. He notes that while they achieved a decrease in a certain percentage from 12 to 4 percent, he felt they could have done more.
    • Hussain mentions his focus on ensuring projects were completed on time and delivered to every individual, highlighting his attention to detail and execution.
    • Views on Governance and Leadership:He expresses concern over corruption and the need for accountability.
    • Hussain talks about the qualities and labels of delivery being attached to the claimant government of Delhi.
    • He reflects on the challenges of working with elected officials and the importance of leaders completing their terms.
    • Personal Preferences and Interests:He enjoys being alone and away from people.
    • He has an interest in music, particularly old songs, and used to keep a record player and tape recorder.
    • He enjoys watching movies and reminisces about going to see Indian films with friends.
    • Encounters and Views on Prominent Figures:He shares anecdotes about his interactions with various political figures and his perspectives on their actions.
    • He mentions figures like Imran Khan, Nawaz Sharif, and Bilawal Bhutto Zardari, offering brief assessments of their political standing and actions.
    • Views on Elections and Political Processes:He expresses skepticism about electronic voting machines and discusses the importance of fair elections.
    • Hussain touches on the role of the Election Commission and the potential for manipulation in the electoral process.
    • Social and Cultural Observations: He reflects on societal changes, cultural preferences, and the importance of community support.

    Tanveer Hussain’s Political Reflections

    Tanveer Hussain’s political reflections, as presented in the source text, cover a range of topics, including his personal experiences, observations on governance, and views on prominent political figures and processes.

    Key aspects of his political reflections include:

    • Governance and Leadership Hussain reflects on his efforts to bring about change during his time in power, specifically in the social sector and infrastructure. He emphasizes the importance of project completion and delivering results to individuals. He also touches on the difficulties of working with elected officials and the need for leaders to fulfill their terms.
    • Corruption and Accountability He voices his concerns about corruption and the necessity for accountability in governance.
    • Electoral Processes Hussain expresses skepticism regarding electronic voting machines and emphasizes the need for fair elections. He also comments on the role of the Election Commission and the potential for manipulation.
    • Political Figures Hussain shares his views on various political figures, such as Imran Khan, Nawaz Sharif and Bilawal Bhutto Zardari, providing insights into their political positions and actions.
    • Party Politics Hussain reflects on his experiences within his own party, including instances of people leaving and offers being made. He also touches on the challenges of leadership and the importance of standing by one’s principles.
    • Social Impact and Personal Involvement He mentions his work in the social sector, aiming to provide basic facilities and relief to the people. Hussain also reflects on his interactions with the public, noting his regular meetings with constituents to address their problems.
    • Statements and Media Hussain also touches on how statements can be misinterpreted by the media.
    • Views on Elections and Political Processes: He expresses skepticism about electronic voting machines and discusses the importance of fair elections. Hussain touches on the role of the Election Commission and the potential for manipulation in the electoral process.

    In essence, Tanveer Hussain’s reflections offer a multifaceted view of Pakistani politics, shaped by his personal experiences, observations, and perspectives on key issues and figures.

    GNN Kay Sang with Rana Tanveer Hussain | Mohsin Bhatti | 19 September 2021
    Street Visit Muridke Canal Park – Walking Tour Mureedkey
    Muridke Bangla Puli – Motorcycle Ride – HD – Canal Park Mureedkey Pakistan
    Local Bazaar Muridke Sheikhupura Punjab Pakistan | Main Bazaar | Muridke City Sheikhupura
    Muridke CITY STREET VIEW 2020 – Drive through Muridke Punjab Pakistan – Muridke City Tour – 4K HD
    Muridke City tour // Mall of Muridke // Muridke housing society || Narowal chowk Muridke || F16
    History & Documentary of Muridke City | Muridke City Tour | مریدکے کی سیر
    Domino’s Pizza Muridke Vlog 2020 || Mall of Muridke || Muridke Food Street || My HomeTown #Muridke

  • Al Riyadh Newspaper: March 02, 2025 Kingdom News and Ramadan Events

    Al Riyadh Newspaper: March 02, 2025 Kingdom News and Ramadan Events

    This compilation of articles from a Saudi Arabian newspaper covers diverse topics. Several articles focus on Saudi Arabia’s internal affairs, including the Kingdom’s rejection of a parallel government in Sudan, initiatives like “Good of the Regions” receiving royal support, water distribution plans for Ramadan, and the Ministry of Interior receiving an innovation award. International affairs are also addressed, such as Saudi Arabia’s stance on the Kurdistan Workers’ Party and the global natural gas market. Additionally, the publication highlights local events, such as the launch of registration for providing meals at the Prophet’s Mosque, Ramadan cultural events in various cities, and court announcements in Riyadh. Finally, the publication also provides sports coverage, including football and volleyball results.

    Study Guide: News Articles from March 2, 2025

    I. Quiz: Short Answer Questions

    1. What was the King’s message regarding the service of the Two Holy Mosques, and what royal directive was issued?
    2. What is the Kingdom’s stance on the formation of a “parallel government” in Sudan, and what does it urge Sudanese parties to do?
    3. What is the goal of the housing support campaign during Ramadan, and which organization is leading the effort?
    4. What commitment did the Lebanese Prime Minister make regarding the reconstruction of damaged homes and villages in southern Lebanon?
    5. What is the Saudi government’s plan for water distribution during Ramadan, and what is the purpose of this plan?
    6. What award did the Ministry of Interior receive, and what strategic goal does this achievement support?
    7. What is the purpose of designating seasonal locations for Ramadan stalls in Tabuk?
    8. What are some of the key elements highlighted in the Imam’s Friday sermon at the Prophet’s Mosque in Medina during Ramadan?
    9. According to Dr. Khalid Ramadan, what has been the historical outcome of imposing customs duties, and how does this relate to the current trade war?
    10. What did the US president and the Iraqi oil ministry say about oil production?

    II. Quiz Answer Key

    1. The King affirmed that serving the Two Holy Mosques is a tradition followed by Saudi monarchs since the kingdom’s unification. A royal directive was issued to begin releasing prisoners held for public rights offenses.
    2. The Kingdom rejects the idea of a “parallel government” in Sudan, viewing such actions outside formal institutions as illegitimate. It urges Sudanese parties to prioritize the country’s interests and unity, working to avoid division and chaos.
    3. The campaign aims to provide suitable housing for eligible families. The “Sakan” Developmental Housing Foundation is spearheading the initiative through the “Jood Al-Iskan” platform.
    4. The Lebanese Prime Minister pledged his government’s commitment to working on the reconstruction of homes and villages destroyed in southern Lebanon.
    5. The plan is to distribute approximately 10 million cubic meters of water daily throughout the Kingdom during Ramadan to ensure an adequate supply for residents and visitors during the peak demand season.
    6. The Ministry of Interior received the Global Innovation Institute’s (CGInO) accreditation award. This achievement supports the strategic goals of Saudi Vision 2030 by fostering a culture of institutional innovation.
    7. The purpose is to organize street vending during the month of Ramadan by providing designated locations that serve residents and visitors and meet their needs.
    8. The Imam stressed the importance of taking advantage of Ramadan for worship, repentance, charity, and abstaining from sins and wrongdoings.
    9. Dr. Ramadan claims that custom duties have historically failed to achieve their economic objectives, often leading to retaliatory measures and trade wars. He suggests this pattern is relevant to the current trade tensions.
    10. US president Donald Trump said proposed tariff measures would be implemented and Iraqi oil ministry said Iraq would continue exporting.

    III. Essay Questions

    1. Analyze the interconnectedness of domestic and foreign policy initiatives presented in the articles. How do events in Sudan, Lebanon, and other international contexts relate to Saudi Arabia’s internal goals and Vision 2030?
    2. Discuss the various aspects of Saudi Vision 2030 highlighted in these articles. What are the key areas of focus, and how are these goals being pursued through specific projects and initiatives?
    3. Examine the role of culture and tradition in contemporary Saudi society as portrayed in the context of Ramadan and the celebration of Founding Day. How are these values integrated with modernization and development?
    4. Assess the economic trends and challenges discussed in the articles, particularly in relation to energy markets, trade policies, and diversification efforts. How are these factors shaping Saudi Arabia’s economic landscape?
    5. Consider the humanitarian and social responsibility efforts described in the articles, including initiatives related to housing, community development, and international aid. What values and priorities are reflected in these activities?

    IV. Glossary of Key Terms

    • الحرمين الشريفين (Al-Haramain Al-Sharifain): The Two Holy Mosques, referring to the Masjid al-Haram in Mecca and the Prophet’s Mosque in Medina, the two holiest sites in Islam.
    • الحق العام (Al-Haq al-Aam): Public rights, referring to offenses against the state or society as a whole, as opposed to private rights which are offenses against individuals.
    • وزارة الخارجية (Wizarat al-Kharijiyyah): The Ministry of Foreign Affairs, the government body responsible for managing the Kingdom’s international relations.
    • واس (WAS): Saudi Press Agency, the official news agency of Saudi Arabia.
    • جود المناطق (Jood Al-Manatiq): “Goodness of the Regions,” a campaign focused on providing suitable housing for eligible families during Ramadan.
    • رؤية 2030 (Ru’yah 2030): Vision 2030, Saudi Arabia’s strategic framework for economic and social development, aiming to diversify the economy, promote sustainability, and enhance the quality of life.
    • نيوم (NEOM): A planned city in northwestern Saudi Arabia, designed as a futuristic hub for innovation, sustainability, and tourism, serving as a key manifestation of Vision 2030.
    • الرئاسة العامة لشؤون المسجد الحرام والمسجد النبوي (Al-Riasah Al-Aamah li-Shu’un Al-Masjid Al-Haram wal-Masjid Al-Nabawi): The General Presidency for the Affairs of the Grand Mosque and the Prophet’s Mosque, the government agency responsible for managing the two holy mosques.
    • الأونروا (UNRWA): United Nations Relief and Works Agency for Palestine Refugees in the Near East.
    • حزب الله (Hezbollah): A Lebanese Shia Islamist political party and militant group.
    • أوبك (OPEC): The Organization of the Petroleum Exporting Countries.
    • اليونيفيل (UNIFIL): United Nations Interim Force in Lebanon.

    Al Riyadh Newspaper Analysis: Saudi Arabia, March 2025

    Okay, here’s a detailed briefing document summarizing the main themes and ideas from the provided text excerpts.

    Briefing Document: Analysis of Al Riyadh Newspaper Excerpts (March 2, 2025)

    Executive Summary:

    These excerpts from the Al Riyadh newspaper, dated March 2, 2025 (2 Ramadan 1446H), cover a diverse range of topics concerning Saudi Arabia, the broader Islamic world, and global events. Key themes include:

    • Domestic Affairs: Focus on Ramadan preparations, charitable initiatives, innovation in government, cultural events, development projects (NEOM), and efforts to improve quality of life.
    • Foreign Policy: Saudi Arabia’s stance on regional conflicts (Sudan, Lebanon, Palestine), counter-terrorism efforts, and support for international initiatives (UNIFIL).
    • Economic Issues: Discussion of trade tariffs, gold prices, the natural gas market, and Saudi Arabia’s economic diversification efforts (Vision 2030).
    • Social and Cultural Matters: Emphasis on preserving Islamic values, promoting national identity, and highlighting cultural heritage.

    Detailed Analysis by Theme:

    1. Ramadan and Islamic Affairs:

    • The newspaper emphasizes the spiritual significance of Ramadan, describing it as a month “filled with spirituality, tranquility filling souls, faith, recitation of the Quran, and liberation from Hellfire.”
    • Reports on preparations for Ramadan, including the distribution of 10 million cubic meters of water daily throughout the Kingdom.
    • Coverage of charitable initiatives, such as the “Jood Al-Manatiq” campaign, which aims to provide suitable housing for deserving families. King and Crown Prince donate 150 million riyals for it. This campaign is described as being: “aimed at providing suitable housing for deserving families… to achieve family stability and contribute to improving the quality of life for them.”
    • Highlighting the “King Salman Award for Memorizing the Quran,” reflecting the Kingdom’s commitment to serving the Quran and encouraging its citizens to adhere to its values.
    • Mentions the “Guests of the Custodian of the Two Holy Mosques Program for Umrah,” where 250 pilgrims from 14 countries performed Umrah under the supervision of the Ministry of Islamic Affairs. The sheikh spoke to them about the importance of Ramadan.

    2. Foreign Policy and Regional Security:

    • Sudan: The Kingdom rejects the formation of a “parallel government” in Sudan, emphasizing its support for the country’s unity, security, and stability. The Foreign Ministry stated it “expressed its rejection of any illegitimate procedures taken outside the framework of the official institutions of the Republic of Sudan that may lead to forming a parallel government.”
    • Lebanon: The Lebanese Prime Minister affirmed his government’s commitment to rebuilding destroyed homes and villages in southern Lebanon. “That is not a promise.” He noted the importance of UNIFIL.
    • Palestine: Discussion of efforts to achieve peace and stability in Gaza, with a focus on reconstruction efforts.
    • Counter-Terrorism: The Kingdom welcomes the call to dissolve the “Kurdistan Workers Party,” expressing solidarity with Turkey and hoping for steps toward security, peace, and prosperity.
    • Kuwair: Kuwait announces it rejects any illegitimate procedures that take place outside of the framework of state institutions in Sudan.

    3. Economic Development and Vision 2030:

    • NEOM: The newspaper highlights NEOM as a leading example of Vision 2030, showcasing its focus on innovation, sustainability, and economic diversification. It aims to create a city of the future by attracting intellects and companies in order to develop advanced industries. It is also going to hold the winter games of 2029. It strengthened its media power by developing the media area.
    • Economic Diversification: Emphasizes efforts to diversify the Saudi economy beyond oil, highlighting investments in tourism, industry, and technology. “Vision 2030 came to draw a new future for development, based on innovation, sustainability, and economic diversification.”
    • Trade Tariffs: Discusses the potential impact of trade tariffs imposed by the United States, noting the historical failures of such measures.
    • Natural Gas Market: Reports on the increasing global demand for liquefied natural gas (LNG), particularly in Asia, and Saudi Arabia’s role in meeting this demand. LNG demand will increase by 60% in 2040. China is also increasing its LNG capacity.
    • Gold Prices: Mentions the impact of trade tensions and a rising dollar on gold prices.

    4. Domestic Affairs and Social Initiatives:

    • Innovation in Government: The Ministry of Interior receives an award for innovation, reflecting efforts to promote a culture of innovation within the government. The award is for “its leadership in innovation.”
    • Cultural Events: Highlights the Ministry of Culture’s initiative to celebrate Ramadan with various cultural and community events across the Kingdom, reflecting the values and customs of Saudi society.
    • Tabuk Development: Reports on the allocation of seasonal sites for Ramadan stalls in Tabuk to organize sales activities. 13 sites were chosen.
    • Healthcare: Highlights healthcare initiatives aimed at improving patient experience and safety.

    5. Social Issues:

    • Begging: An article discusses the complex social phenomenon of begging, moving from its exploitation to empowerment. People should only give alms to people who need it, “otherwise, you have wronged the one who deserves it.”
    • Fasting: Fasting is more than abstinence, it is philosophy. It is a call to improve ourselves.

    6. History

    • The Saudi Foundation was not a point of turn, but a historical memory. Ever since Saudi Arabia gained territory, it has been at the heart of the Middle East.
    • In 1938, the discovery of oil also boosted Saudi Arabia’s role in the international community, making it the focus for the worlds economy.
    • King Abdulaziz did not want to reach the rule.
    • The Saudi State was not like other countries, but is unique for joining authenticity and development.

    Quotes:

    • (On Ramadan): “filled with spirituality, tranquility filling souls, faith, recitation of the Quran, and liberation from Hellfire.”
    • (On Sudan): “expressed its rejection of any illegitimate procedures taken outside the framework of the official institutions of the Republic of Sudan that may lead to forming a parallel government.”
    • (On Jood Al-Manatiq): “aimed at providing suitable housing for deserving families… to achieve family stability and contribute to improving the quality of life for them.”
    • (Begging): “otherwise, you have wronged the one who deserves it.”

    Conclusion:

    These newspaper excerpts paint a picture of a Saudi Arabia that is actively engaged in domestic development, regional diplomacy, and global economic affairs. The Kingdom is presented as a modernizing nation that is committed to its Islamic heritage, its citizens’ well-being, and its role as a key player on the world stage. Vision 2030 serves as the guiding force behind many of these initiatives, demonstrating a forward-looking approach to governance and development.

    Saudi Arabia: Governance, Vision 2030, and Global Role

    Here is an 8-question FAQ based on the provided text excerpts:

    1. What is the focus of the Saudi Arabian government during Ramadan, as reflected in the news articles?

    The Saudi government focuses on several key areas during Ramadan, including:

    • Supporting Charitable Initiatives: The government emphasizes charitable giving and community support through initiatives like “Jood Al-Manateq” which aims to provide suitable housing for deserving families. King Salman and the Crown Prince support this with significant donations.
    • Providing Essential Services: Ensuring the availability of resources such as water. The National Water Company distributes millions of cubic meters of water daily to meet the increased demand during Ramadan.
    • Maintaining Religious Sites: Facilitating religious practices such as Umrah, with programs to host pilgrims from various countries.
    • Cultural Preservation: Celebrating and promoting Saudi cultural heritage through events and decorations, as seen with the Ministry of Culture’s Ramadan season.
    • Economic Activity Regulation: Continues oversight for safety and health in commercial activities during the month.

    2. What role does the Saudi government play in regional conflicts, specifically concerning Sudan?

    The Saudi Arabian Ministry of Foreign Affairs rejects any actions that take place outside the parameters of official institutions of the Republic of Sudan, as such actions may lead to the formation of a parallel government that does not express the will of the Sudanese people and threatens the security and stability of Sudan. The Kingdom calls on all Sudanese parties to prioritize the interests of Sudan, work to avoid division and chaos, and remain committed to ceasing all war efforts in order to achieve a peace in Sudan.

    3. What is the “Saudi Vision 2030” and how is it being implemented in various sectors?

    Saudi Vision 2030 is a strategic framework aimed at diversifying the Saudi economy, enhancing sustainability, and fostering innovation. Examples of its implementation across various sectors include:

    • Economic Diversification: Developing non-oil sectors like tourism, industry, and technology.
    • Urban Development: Implementing ambitious projects like NEOM, which seeks to establish a global model for future cities with advanced industries and attractive investment opportunities.
    • Human Capital Development: Investing in education and training programs to enhance the skills and qualifications of Saudi nationals, ensuring they meet the needs of the future job market.
    • Innovation: Encouraging and recognizing innovation in government and institutional settings.

    4. How is Saudi Arabia working towards innovation and technological advancement?

    Saudi Arabia is promoting innovation and technological advancement through several initiatives:

    • Government Support: The Ministry of Interior has received awards for its leadership in promoting institutional innovation and improving user experience.
    • Educational Investments: Universities like King Khalid University are focusing on strategic planning and aligning educational programs with the goals of Vision 2030.
    • Technology Projects: The establishment of NEOM as a smart city, integrating advanced technologies and attracting leading global companies.
    • Artificial Intelligence: Hail University is developing capabilities in areas like AI and robotics to develop student skills.

    5. What are the Saudi government’s efforts to support housing and community development?

    The Saudi government supports housing and community development through:

    • “Jood Al-Manateq” Campaign: An initiative providing suitable housing for deserving families.
    • Financial Contributions: King Salman and the Crown Prince have donated significant funds to support the campaign.
    • “Sakan” Platform: A platform aimed at improving the quality of life for Saudi citizens by providing adequate housing solutions.
    • Addressing Housing Needs: Emphasizing the need to provide housing solutions that contribute to family stability and improve quality of life.

    6. What challenges is the global economy facing, according to the articles, and what role is Saudi Arabia playing in addressing them?

    Global economic challenges include:

    • Trade Wars: Potential negative impacts of tariff escalations between countries like the US and China, leading to increased costs for consumers and economic disruptions. The article discusses concerns about a 25% tariff on Mexican and Canadian goods.
    • Inflation and Interest Rates: Fluctuations in inflation rates and the Federal Reserve’s monetary policies can impact commodity prices, like gold, and overall economic stability.
    • Supply Chain Disruptions: Factors like geopolitical tensions, regulatory hurdles, and labor shortages can delay key projects, such as natural gas supply projects.
    • Energy Market Volatility: Fluctuations in oil and natural gas prices can affect global markets and national economies.

    Saudi Arabia’s role:

    • Oil Production Management: Monitoring and potentially adjusting oil production levels through OPEC+ to balance the market and stabilize prices.
    • Energy Security: Contributing to global energy security by expanding natural gas supplies and partnering with other nations.

    7. What are the articles saying about the conflict between Israel and Palestine and what actions have been taken?

    The articles highlight tensions and ongoing issues related to the Israel-Palestine conflict:

    • Restrictions at Al-Aqsa Mosque: Imposing restrictions on Muslim worshippers during Ramadan at the Al-Aqsa Mosque, sparking concerns.
    • Displacement of Palestinians: Reports of Israeli military actions leading to the potential displacement of Palestinian families in the West Bank.
    • Peace Efforts: There are ceasefire agreements mentioned, and discussions are taking place regarding prisoner exchanges between Israel and Hamas.

    8. How is Saudi Arabia working to improve its workforce, including its government sector?

    Saudi Arabia is working to improve its workforce by:

    • “Golden Handshake” Program: Implementing programs like the “Golden Handshake” to incentivize voluntary resignation of less qualified or redundant government employees, providing them with generous severance packages.
    • Skills Development: Emphasizing skills re-training for employees and preventing the loss of institutional knowledge.
    • Retirement System Improvements: Improving retirement systems to provide better benefits and incentives for employees.
    • Nationalization of Jobs: Developing programs to encourage and enable Saudi citizens to participate and work at all levels.

    Kingdom of Saudi Arabia: Governance, Development, and Global Role

    Here’s a discussion of the Kingdom of Saudi Arabia, based on the provided sources:

    • The Kingdom’s leadership: The Custodian of the Two Holy Mosques, King Salman bin Abdulaziz Al Saud, and Crown Prince Mohammed bin Salman are mentioned for their continuous support in various sectors, including education and humanitarian efforts.
    • Service to pilgrims: The Kingdom is recognized for its dedication to serving pilgrims and visitors to the Two Holy Mosques, a tradition upheld by Saudi monarchs since the Kingdom’s unification.
    • Development projects: Visionary projects like NEOM are underway, reflecting the Kingdom’s ambition to provide solutions to global challenges and diversify its economy beyond oil.
    • Humanitarian efforts: The Kingdom continues to support humanitarian initiatives, as exemplified by providing housing for deserving families.
    • Cultural and religious significance: The Ministry of Culture organizes events during Ramadan to celebrate customs and traditions, enhance cultural awareness, and promote social values rooted in the Kingdom’s heritage. The kingdom emphasizes the importance of taking advantage of Ramadan to practice different forms of worship.
    • Economic diversification: The Kingdom is focused on diversifying its economy and is working towards achieving a transformation in the energy sector to address global environmental challenges.
    • Efforts to combat begging: The Kingdom is undertaking efforts to reduce begging through awareness campaigns and by directing alms to deserving recipients through official channels like the “Ehsan” platform.
    • National identity: The Kingdom’s flag symbolizes its foundation on monotheism, justice, and strong ethics.
    • Commitment to justice and equality: Since its establishment, the Kingdom has been based on justice and equality.
    • Ongoing development and improvement: The “My City” application is used to improve municipal services, with citizens and residents able to report issues.
    • The Kingdom rejects forming a parallel government in Sudan and affirms its support for the Republic of Sudan.

    Natural Gas: Global Demand and NEOM’s Energy Transformation

    Here’s a discussion of natural gas, based on the provided sources:

    • Global demand: The sources indicate that there is a rising global demand for natural gas, with an expected increase of 60% by 2040.
    • NEOM: The city of NEOM is a large development project in Saudi Arabia that is working towards a transformation in the energy sector. This transformation seeks to address global environmental challenges.

    Financial Executions, Zakat, Begging, and Charity

    Based on the provided sources, here’s a discussion of financial executions:

    • Golden Handshake The “Golden Handshake” program is designed to reduce financial obligations and eliminate unnecessary positions in the service sectors.
    • Benefits of the “Golden Handshake” Government employees benefit from financial incentives and training opportunities.
    • Impact on Service Sectors The “Golden Handshake” program is designed to reduce financial obligations and eliminate unnecessary positions in the service sectors.
    • Concerns with “Golden Handshake” The “Golden Handshake” program may cause long-term debt if the targeted jobholders have bank loans. The scheme may be entirely disrupted if their numbers were considerable, and as long as the program’s executive regulation has not been issued, assumptions are difficult.
    • Zakat Muslims are encouraged to pay Zakat during Ramadan to purify their money and help the poor. Islamic countries oversee the collection and distribution of Zakat to those in need during the fasting period.
    • Begging The sources discuss the exploitation of vulnerable groups such as women, children and the elderly by criminal networks to gain material advantages. There are psychological and social effects of begging on society. It is everyone’s moral responsibility to combat begging by reporting dubious incidents and supporting programs that restore the needy’s dignity through work rather than begging.
    • Charity Giving charity to non-deserving people is not just an economic mistake, but an injustice to those who are waiting for help.

    Economic Trade: Tariffs, Trade Wars, and Global Impact

    Here’s a discussion of economic trade, based on the provided sources:

    • Trade wars: A trade war’s problem is protecting local workers, but it ultimately harms them. Retaliatory tariffs increase the cost of exports, hurting companies and workers. The best way to limit the relocation of industries abroad is through negotiation and international cooperation.
    • Tariffs: If tariffs on goods from China, Canada, Mexico, and the European Union take effect, efforts to reduce inflation may be hindered.
    • Impact on specific sectors:
    • The United States relies on Mexico for fresh produce, so tariffs could negatively impact the cost of fruits and vegetables.
    • Increased tariffs on Chinese goods could lead to higher prices for electronics.
    • Increased tariffs on lumber and building materials could worsen the affordable housing crisis.
    • G20: Saudi Arabia plays a key role in the G20 through its economic decisions.

    Saudi League and Global Sports: Analysis and Highlights

    Here’s a discussion of sports leagues, based on the provided sources:

    • Saudi League: Multiple sources refer to the Saudi League.
    • Roshn Saudi League: Several sources mention the Roshn Saudi League. This may be the same as, or related to, the Saudi League.
    • The level of play in the Saudi League has improved.
    • The Saudi League is one of the strongest leagues.
    • The Saudi League attracts tourists from all over the world.
    • Key players:
    • Omar Al-Somah continues to write history in the Roshn Saudi League.
    • Toni scored a hat trick.
    • Riyad Mahrez played his best matches.
    • Al-Hilal: Al-Hilal continues to lead the league table in volleyball. There is a problem in Al-Hilal’s defense.
    • Specific Match Results:
    • Al-Fayha and Al-Wehda tied.
    • Al-Taawun and Al-Khulood won against Al-Fath and Al-Khaleej.
    • Al-Ittihad will host Al-Okhdood.
    • Al-Raed will face Al-Ettifaq.
    • Al-Riyadh will be a guest of Al-Qadisiyah.
    • FIFA is preparing to grant television stations a feature that allows them to use recordings taken by cameras worn by referees during the Club World Cup next summer.

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • 45 Day Self-Improvement Handbook by A. V. Mendez

    45 Day Self-Improvement Handbook by A. V. Mendez

    The “45 Day Self-Improvement Handbook” is a guide offering daily ideas, habits, and action plans to enhance productivity, persuasion, self-confidence, and social skills. It is structured into four sections, each focusing on a specific challenge: productivity, persuasion, self-confidence, and social skills. Each of these challenges is broken down into daily tasks or suggestions to improve the specified area. The handbook suggests practical action for getting things done, and reflection to better yourself. It ends with a bonus section on the importance of physical health and energy.

    45-Day Self-Improvement Handbook: Study Guide & Glossary

    45-Day Self-Improvement Handbook: Study Guide

    Quiz

    Answer the following questions in 2-3 sentences each:

    1. What is the main goal of the “Challenge for Productivity” section (Days 1-10)?
    2. According to the handbook, what is one of the biggest distractions we have today?
    3. Explain the concept of “Time-Chunking.”
    4. Why is it important to prepare the tools needed for a task the day before?
    5. What does the handbook suggest you do to confront your fears?
    6. What does the author say about showing energy when trying to persuade someone?
    7. What does “WIFFM” stand for, and why is it important?
    8. What does the author suggest is the best way to become more confident?
    9. What is the “Law of Reciprocity,” and how can it be used for persuasion?
    10. Why is it important to acknowledge someone when they do a good job?

    Quiz Answer Key

    1. The main goal of the “Challenge for Productivity” section is to maximize your effectiveness and productivity while helping you avoid procrastination. It emphasizes identifying and minimizing time-wasting activities such as excessive social media use.
    2. According to the handbook, one of the biggest distractions we have today is being constantly online, with e-mail, Facebook, YouTube, and other desktop applications constantly displaying notifications. This constant stimulation fragments attention and hinders productivity.
    3. Time-Chunking is a method of working in chunks of time, typically involving 25-minute intervals of focused work followed by 5 minutes of rest, or alternatively, 40 minutes of work followed by 10 minutes of rest. It is used to help you stay focused and avoid exhaustion.
    4. Preparing the tools needed for a task the day before makes it easier to get started and less likely to wander off to do something else. Having everything ready eliminates potential distractions and reinforces your commitment to the task at hand.
    5. The handbook suggests that you start by facing your smallest fears first, and then tackle fears that don’t have a big impact on your life. The point is to make it a process and to make the smallest commitment that you can do easily.
    6. When trying to persuade or influence someone, it is important to show the right energy for the setting. Being aware of the situation and acting accordingly by matching energy levels are the key.
    7. “WIFFM” stands for “What’s In It For Me?” It is important because when trying to persuade someone, you need to think about what the other person wants and what the emotional benefits are for the other person.
    8. The author suggests that the best way to become more confident is by knowing what you’re good at and doing what you do well. Being great at what you do becomes the foundation for your confidence.
    9. The “Law of Reciprocity” states that when someone does something for us, we have a strong urge or motivation to do something back in return. It can be used for persuasion by offering something valuable to someone else, making them more likely to fulfill your request in the future.
    10. Acknowledging someone when they do a good job is important because it makes them feel noticed and uplifts them. It is an easy way to build trust, strengthen relationships, and encourage positive behavior.

    Essay Questions

    1. Discuss the relative importance of the four sections of the book, arguing which section is the most important or impactful, and why.
    2. Analyze the connection between productivity and self-confidence as presented in the handbook. How does improving one affect the other?
    3. Compare and contrast the ideas of “perfectionism” and “momentum” as presented in the handbook. How can these two concepts either help or hinder self-improvement efforts?
    4. Evaluate the effectiveness of the “Action Guide” prompts at the end of each section. How helpful are these prompts in applying the concepts discussed?
    5. To what degree does the author acknowledge the differences between introverted and extroverted personalities and tendencies? Are the recommendations within the text applicable for introverts and extroverts alike?

    Glossary of Key Terms

    • Productivity: The effectiveness of productive effort, especially in industry, as measured in terms of the rate of output per unit of input.
    • Procrastination: The action of delaying or postponing something.
    • Time-Chunking: A method of breaking down work into small, manageable intervals to improve focus and productivity.
    • Perfectionism: The refusal to accept any standard short of perfection.
    • Influence: The capacity to have an effect on the character, development, or behavior of someone or something.
    • Persuasion: The action or process of persuading someone or of being persuaded to do or believe something.
    • Law of Reciprocity: A social norm where people tend to reciprocate actions made toward them.
    • Self-Confidence: A feeling of trust in one’s abilities, qualities, and judgment.
    • Body Language: The process of communicating nonverbally through conscious or unconscious gestures and movements.
    • WIFFM (What’s In It For Me?): The underlying question of a consumer that must be answered before they consider your product or service.

    45 Day Self-Improvement Handbook: A Practical Guide

    Okay, here is a briefing document summarizing the main themes and important ideas from the provided excerpts of “45 Day Self-Improvement Handbook: 45 Daily Ideas, Habits, and Action-Plan for Becoming More Productive, Persuasive, Influential, Sociable and Self-Confident” by A.V. Mendez:

    Briefing Document: 45 Day Self-Improvement Handbook

    Document Title: 45 Day Self-Improvement Handbook: 45 Daily Ideas, Habits, and Action-Plan for Becoming More Productive, Persuasive, Influential, Sociable and Self-Confident Author: A.V. Mendez Date: Provided excerpts dated 20/02/2023

    Overview:

    This handbook outlines a 45-day program focused on self-improvement, broken down into four sections: productivity, persuasion and influence, self-confidence, and social skills. The core approach emphasizes small, consistent actions, habit building, and practical application of ideas. The document is action-oriented, providing specific steps and guidance to help the reader implement changes.

    Key Themes and Ideas:

    • Incremental Improvement & Action-Orientation: The handbook emphasizes the importance of taking action, even if it’s imperfect. “Getting things done is better than not doing stuff in the first place.” The document encourages immediate implementation of small, easy-to-do actions. It discourages overthinking and excessive planning before starting. For example, “Do not get bogged down by the details. Just apply your idea fast.”
    • Productivity Focus (Days 1-10): This section focuses on maximizing effectiveness and productivity and avoiding procrastination. Key ideas include:
    • Combating distractions, particularly those online.
    • Learning to say “no” to requests that take up time.
    • “Time Chunking” to focus on specific tasks with breaks.
    • Eliminating perfectionism: “Aim for progress instead. Aim for getting better every single day.”
    • Streamlining To-Do Lists: Prioritize tasks and schedule repetitive tasks.
    • Optimizing the Environment: Factors like light, noise, and temperature.
    • Process maps: Outsource certain tasks or take steps to streamline a process.
    • Preparing the tools you will need for tomorrow’s task.
    • “Taking Out The Trash”: Tackling nagging personal issues promptly.
    • Persuasion and Influence (Days 11-20): This section emphasizes the importance of influence, teaching and adding value to others. Key ideas include:
    • Influence is not about manipulation. It’s about pointing someone on the right direction.
    • Ask rather than not ask.
    • Reciprocity is important in persuasion.
    • Become an authority on your subject.
    • Cultivating a reputation or legend.
    • Identifying “WIIFM” (What’s In It For Me) for the person you are trying to persuade.
    • Self-Confidence (Days 21-33): This section addresses self-confidence as a skill that can be developed. Key ideas include:
    • Acknowledge the truth and be honest about where you are.
    • Owning your skills and working to improve on them.
    • Look at past accomplishments to build confidence.
    • Eliminate ego.
    • Ask good questions and help others improve their self-esteem.
    • Manage highs and lows and celebrate wins.
    • Personal hygiene and dressing appropriately.
    • Build momentum.
    • Surround yourself with good people.
    • Face fears in small steps.
    • Set small targets.
    • Set a big target and go small.
    • Social Skills (Days 34-45): This section addresses the ability to work with other people. Key ideas include:
    • The right people will help you meet your goals.
    • Use the right insider words or terminology to speak to the right audience.
    • The right body language.
    • Acknowledge peers.
    • Downplay mistakes.
    • Listen.
    • Take notes during conversation.
    • Encourage other people.
    • Say their name.
    • No bragging.
    • Introverts can speak too.
    • The magic of saying thank you.
    • Physical Fitness & Energy: Improving yourself includes making sure you are physically fit and energetic.
    • The “Stonecutter’s Credo”: The handbook concludes with the idea of persistence, comparing self-improvement to a stonecutter patiently hammering away at a rock until it splits. “When nothing seems to help, I go and look at a stonecutter hammering away at his rock perhaps a hundred times without as much as a crack showing in it. Yet at the hundred and first blow, it will split in two, and I know it was not that blow that did it, but all that had gone before.”

    Target Audience:

    Individuals seeking practical, actionable advice on self-improvement in areas such as productivity, influence, self-confidence, and social skills.

    Actionable Takeaways:

    • Focus on taking small, consistent actions to achieve larger goals.
    • Prioritize productivity by minimizing distractions and maximizing focus.
    • Build influence by adding value to others.
    • Develop self-confidence by acknowledging your strengths and accomplishments and working to improve your weaknesses.
    • Improve social skills by working with the right people and using the right language and body language.

    This briefing document provides a concise overview of the “45 Day Self-Improvement Handbook” excerpts and highlights its core principles and actionable advice.

    45-Day Self-Improvement Handbook: A Practical Guide

    FAQ: 45 Day Self-Improvement Handbook

    • What is the core idea behind the 45-Day Self-Improvement Handbook?
    • The handbook revolves around the idea of gradual and consistent self-improvement. It’s based on the concept that significant personal growth can be achieved by incorporating daily ideas, habits, and action plans into one’s life, focusing on areas such as productivity, persuasion, self-confidence, and social skills. It suggests breaking down larger goals into smaller, manageable steps, and building habits through consistent action. The process emphasizes learning, adapting, and building momentum over perfection.
    • How does the handbook approach productivity?
    • The handbook suggests a practical and action-oriented approach to productivity. It focuses on optimizing effectiveness by taking small steps, avoiding procrastination and minimizing distractions from things like social media. It advocates for identifying and prioritizing the most impactful tasks, breaking down work into manageable “time chunks” with scheduled rest, and simply getting started by doing instead of overthinking.
    • What techniques does the handbook propose for improving persuasion and influence?
    • The handbook views influence as guiding people in the right direction with good intentions, not manipulating them. Key techniques include asking for what you desire, acknowledging the other party’s point of view, and teaching others what you know. It also emphasizes the “Law of Reciprocity,” suggesting you provide something of value to others to increase the likelihood of them accepting your requests. Creating content and building authority are also strategies suggested for influence.
    • How does the handbook define and address self-confidence?
    • The handbook defines self-confidence as the ability to recognize what you’re capable of based on evidence. It is about having a belief in yourself based on reality. It discourages ego, which is based on thinking you are better than everyone else. It suggests several ways to build it, including acknowledging the truth about yourself, “owning your stuff” (improving what you are good at), looking at your track record of achievements, and setting small targets to build momentum. Eliminating ego is crucial.
    • What strategies does the handbook offer for improving social skills?
    • The handbook approaches social skills by addressing body language, active listening, using the right terms within your industry, and acknowledging your peers. It emphasizes understanding your audience’s needs, making a good first impression through appropriate dress, and being genuine in your interactions.
    • What does the handbook advise regarding dealing with perfectionism?
    • The handbook strongly advises against perfectionism. It emphasizes the importance of action over striving for unattainable flawlessness. The “F*ck Perfectionism” principle suggests aiming for progress and getting better every day, rather than waiting for the perfect moment or outcome. It encourages taking action, even if imperfect, as this leads to more progress than inaction.
    • How does the handbook suggest managing distractions, particularly online distractions?
    • The handbook recognizes that online distractions such as social media can significantly hinder productivity. It suggests scheduling dedicated “distraction time” to browse social media and other non-productive sites, rather than fighting the urge constantly and losing focus on current tasks. Disconnecting from the internet while working and using tools to block out noise and distractions are also encouraged.
    • What role does personal environment play in self-improvement according to the handbook?
    • The handbook emphasizes the importance of a conducive personal environment for enhancing productivity and motivation. It suggests optimizing things like lighting, noise level (using noise-cancelling headphones), and temperature to create a comfortable and focused workspace. Preparing tasks and tools the night before is also suggested to minimize distractions and facilitate getting started in the morning.

    45 Day Self-Improvement Handbook: Productivity, Persuasion, and More

    The “45 Day Self-Improvement Handbook” contains daily ideas, habits, and action plans for becoming more productive, persuasive, influential, sociable, and self-confident. The handbook is divided into sections that include:

    • Productivity (Day 1-10)
    • Persuasion and Influence (Day 11-20)
    • Self-Confidence (Day 21-33)
    • Social Skills (Day 34-45)

    The handbook suggests different ways to improve including:

    • Getting things done by not thinking too much about them.
    • Saying no to requests.
    • Using time chunking.
    • Aiming for progress instead of perfection.
    • Creating to-do lists.
    • Optimizing your environment.
    • Scheduling time for distractions.
    • Creating process maps.
    • Preparing the tasks that you need to finish on the next day.
    • Taking care of nagging personal issues.
    • Being aware of your own feelings.
    • Using the power of body language.
    • Acknowledging the truth about yourself.
    • Improving your skills.
    • Looking at your track record.
    • Eliminating your ego.
    • Asking good questions.
    • Managing your highs and lows.
    • Practicing personal hygiene.
    • Dressing to impress.
    • Building momentum.
    • Surrounding yourself with good people.
    • Facing your fears.
    • Setting a small target.
    • Hitting a big target by starting small.
    • Finding the right people to talk to and knowing your goal.
    • Using the right words.
    • Acknowledging peers.
    • Downplaying mistakes.
    • Listening.
    • Taking notes.
    • Encouraging other people.
    • Saying people’s names.
    • Avoiding bragging.
    • Saying thank you.

    45 Day Self-Improvement Handbook: Productivity, Persuasion, and Social Skills

    The “45 Day Self-Improvement Handbook” focuses on daily ideas and habits to foster self-improvement in productivity, persuasion, self-confidence and social skills. Here are some of the ideas:

    • Productivity: The handbook advises to not overthink tasks, say no to requests, use time chunking, aim for progress over perfection, create to-do lists, optimize your environment by adjusting noise, lighting, and temperature, schedule time for online distractions, create process maps, prepare tasks the day before, and address nagging personal issues.
    • Persuasion and Influence: To be more persuasive and influential, the handbook suggests to ask for what you want, give to others, become a “celebrity” in your market by creating content, teach others by sharing your knowledge, and cultivate a legend by controlling your narrative. When trying to persuade or influence someone, focus on what you can offer and what the other person wants. Also, show energy by reacting appropriately to a situation.
    • Self-Confidence: To improve self-confidence, the handbook recommends acknowledging your feelings and the truth about yourself, improving your skills, looking at your track record, eliminating your ego, asking good questions, managing highs and lows, practicing personal hygiene, and dressing to impress. Build momentum and surround yourself with supportive people.
    • Social Skills: To improve social skills, the handbook suggests to face your fears, set small targets, hit big targets by starting small, find the right people to talk to and know your goal, use the right words, use body language, acknowledge peers, downplay mistakes, listen, take notes, encourage others, say people’s names, avoid bragging, say thank you, and understand that even introverts can improve their social skills.

    45 Day Handbook: Productivity Guide

    The “45 Day Self-Improvement Handbook” includes a section that is dedicated to productivity, called “The Challenge for Productivity (Day 1-10)”. The goal of this section is to help maximize effectiveness and productivity, and help avoid procrastination.

    To improve productivity, the handbook advises the following:

    • Do not overthink tasks. Getting things done is about the speed of implementation.
    • Say no to requests. You can politely decline by responding in a way that does not make them feel bad.
    • Use time chunking. Time chunking is working in chunks of time, for example, 25 minutes, then resting for 5 minutes.
    • Aim for progress instead of perfection. Aim for getting better every day.
    • Create to-do lists. Personally making to-do lists can make you feel like you’re accomplishing the tasks you’re supposed to be doing.
    • Optimize your environment. Adjust things like noise, lighting, and temperature.
    • Schedule time for distractions. Schedule time for mindless tasks like browsing social media.
    • Create process maps. Process maps are written steps on how to achieve a specific task that you normally do every day.
    • Prepare tasks the day before. Prepare the tasks that you need to finish on the next day, which makes getting started easier.
    • Address nagging personal issues. Take care of nagging personal issues you haven’t taken care of.

    45 Day Self-Improvement Handbook: Personal Hygiene

    The “45 Day Self-Improvement Handbook” includes personal hygiene as a means to improve self-confidence. Having a clean physical appearance can make one more confident.

    The basics of personal hygiene include:

    • Hair
    • Face
    • Body
    • Nails
    • Teeth

    The handbook advises the following for taking care of yourself:

    • Cut your hair every 3-4 weeks and find the best haircut for your head shape.
    • Wash your face twice a day, preferably once in the morning and once before you sleep.
    • Use soap that smells good and use a light perfume on your body, and always use deodorant no matter where you are going.
    • Cut your nails at least once a week.
    • Brush your teeth for 2-3 minutes, 2-3 times a day and use an electric toothbrush if you can.

    45 Day Self-Improvement Handbook: Facing Your Fears

    The “45 Day Self-Improvement Handbook” suggests facing your fears as a way to improve your social skills. Facing your fears can be nerve-racking, but it has many benefits that will change your life. Many people never face their fears because they are afraid of failure.

    Here is how you can face your fears, according to the handbook:

    • Start with your smallest fears.
    • Start with fears that don’t have a big impact on your life.
    • Make a list and start facing the smallest one you can beat.

    The point is to make it a process and make the commitment small enough that you can do it easily. Remember that “Rome wasn’t built in a day”.

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog

  • SQL Fundamentals: Querying, Filtering, and Aggregating Data

    SQL Fundamentals: Querying, Filtering, and Aggregating Data

    The text is a tutorial on SQL, a language for managing and querying data. It highlights the fundamental differences between SQL and spreadsheets, emphasizing the organized structure of data in tables with defined schemas and relationships. The tutorial introduces core SQL concepts like statements, clauses (SELECT, FROM, WHERE), and the logical order of operations. It explains how to retrieve and filter data, perform calculations, aggregate results (SUM, COUNT, AVERAGE), and use window functions for more complex data manipulation without altering the data’s structure. The material also covers advanced techniques such as subqueries, Common Table Expressions (CTEs), and joins to combine data from multiple tables. The tutorial emphasizes the importance of Boolean algebra and provides practical exercises to reinforce learning.

    SQL Study Guide

    Review of Core Concepts

    This study guide focuses on the following key areas:

    • BigQuery Data Organization: How data is structured within BigQuery (Projects, Datasets, Tables).
    • SQL Fundamentals: Basic SQL syntax, clauses (SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT).
    • Data Types and Schemas: Understanding data types and how they influence operations.
    • Logical Order of Operations: The sequence in which SQL operations are executed.
    • Boolean Algebra: Using logical operators (AND, OR, NOT) and truth tables.
    • Set Operations: Combining data using UNION, INTERSECT, EXCEPT.
    • CASE Statements: Conditional logic for data transformation.
    • Subqueries: Nested queries and their correlation.
    • JOIN Operations: Combining tables (INNER, LEFT, RIGHT, FULL OUTER).
    • GROUP BY and Aggregations: Summarizing data using aggregate functions (SUM, AVG, COUNT, MIN, MAX).
    • HAVING Clause: Filtering aggregated data.
    • Window Functions: Performing calculations across rows without changing the table’s structure (OVER, PARTITION BY, ORDER BY, ROWS BETWEEN).
    • Numbering Functions: Ranking and numbering rows (ROW_NUMBER, RANK, DENSE_RANK, NTILE).
    • Date and Time Functions: Extracting and manipulating date and time components.
    • Common Table Expressions (CTEs): Defining temporary result sets for complex queries.

    Quiz

    Answer each question in 2-3 sentences.

    1. Explain the relationship between projects, datasets, and tables in BigQuery.
    2. What is a SQL clause and can you provide three examples?
    3. Why is it important to understand data types when working with SQL?
    4. Describe the logical order of operations in SQL.
    5. Explain the purpose of Boolean algebra in SQL.
    6. Describe the difference between UNION, INTERSECT, and EXCEPT set operators.
    7. What is a CASE statement, and how is it used in SQL?
    8. Explain the difference between correlated and uncorrelated subqueries.
    9. Compare and contrast INNER JOIN, LEFT JOIN, and FULL OUTER JOIN.
    10. Explain the fundamental difference between GROUP BY aggregations and WINDOW functions.

    Quiz Answer Key

    1. BigQuery organizes data hierarchically, with projects acting as top-level containers, datasets serving as folders for tables within a project, and tables storing the actual data in rows and columns. Datasets organize tables, while projects organize datasets, offering a structured way to manage and access data.
    2. A SQL clause is a building block that makes up a complete SQL statement, defining specific actions or conditions. Examples include the SELECT clause to choose columns, the FROM clause to specify the table, and the WHERE clause to filter rows.
    3. Understanding data types is crucial because it dictates the types of operations that can be performed on a column and determines how data is stored and manipulated, and it also avoids errors and ensures accurate results.
    4. The logical order of operations determines the sequence in which SQL clauses are executed, starting with FROM, then WHERE, GROUP BY, HAVING, SELECT, ORDER BY, and finally LIMIT, impacting the query’s outcome.
    5. Boolean algebra allows for complex filtering and conditional logic within WHERE clauses using AND, OR, and NOT operators to specify precise conditions for row selection based on truth values.
    6. UNION combines the results of two or more queries into a single result set, INTERSECT returns only the rows that are common to all input queries, and EXCEPT returns the rows from the first query that are not present in the second query.
    7. A CASE statement allows for conditional logic within a SQL query, enabling you to define different outputs based on specified conditions, similar to an “if-then-else” structure.
    8. A correlated subquery depends on the outer query, executing once for each row processed, while an uncorrelated subquery is independent and executes only once, providing a constant value to the outer query.
    9. INNER JOIN returns only matching rows from both tables, LEFT JOIN returns all rows from the left table and matching rows from the right, filling in NULL for non-matches, while FULL OUTER JOIN returns all rows from both tables, filling in NULL where there are no matches.
    10. GROUP BY aggregations collapse multiple rows into a single row based on grouped values, while window functions perform calculations across a set of table rows that are related to the current row without collapsing or grouping rows.

    Essay Questions

    1. Discuss the importance of understanding the logical order of operations in SQL when writing complex queries. Provide examples of how misunderstanding this order can lead to unexpected results.
    2. Explain the different types of JOIN operations available in SQL, providing scenarios in which each type would be most appropriate. Illustrate with specific examples related to the course material.
    3. Describe the use of window functions in SQL. Include the purpose of PARTITION BY and ORDER BY. Explain some practical applications of these functions, emphasizing their ability to perform complex calculations without altering the structure of the table.
    4. Discuss the use of Common Table Expressions (CTEs) in SQL. How do they improve the readability and maintainability of complex queries? Provide an example of a query that benefits from the use of CTEs.
    5. Develop a SQL query using different levels of aggregations. Explain the query and explain its purpose.

    Glossary of Key Terms

    • Project (BigQuery): A top-level container for datasets and resources in BigQuery.
    • Dataset (BigQuery): A collection of tables within a BigQuery project, similar to a folder.
    • Table (SQL): A structured collection of data organized in rows and columns.
    • Schema (SQL): The structure of a table, including column names and data types.
    • Clause (SQL): A component of a SQL statement that performs a specific action (e.g., SELECT, FROM, WHERE).
    • Data Type (SQL): The type of data that a column can hold (e.g., INTEGER, VARCHAR, DATE).
    • Logical Order of Operations (SQL): The sequence in which SQL clauses are executed (FROM -> WHERE -> GROUP BY -> HAVING -> SELECT -> ORDER BY -> LIMIT).
    • Boolean Algebra: A system of logic dealing with true and false values, used in SQL for conditional filtering.
    • Set Operations (SQL): Operations that combine or compare result sets from multiple queries (UNION, INTERSECT, EXCEPT).
    • CASE Statement (SQL): A conditional expression that allows for different outputs based on specified conditions.
    • Subquery (SQL): A query nested inside another query.
    • Correlated Subquery (SQL): A subquery that depends on the outer query for its values.
    • Uncorrelated Subquery (SQL): A subquery that does not depend on the outer query.
    • JOIN (SQL): An operation that combines rows from two or more tables based on a related column.
    • INNER JOIN (SQL): Returns only matching rows from both tables.
    • LEFT JOIN (SQL): Returns all rows from the left table and matching rows from the right table.
    • RIGHT JOIN (SQL): Returns all rows from the right table and matching rows from the left table.
    • FULL OUTER JOIN (SQL): Returns all rows from both tables, matching or not.
    • GROUP BY (SQL): A clause that groups rows with the same values in specified columns.
    • Aggregation (SQL): A function that summarizes data (e.g., SUM, AVG, COUNT, MIN, MAX).
    • HAVING (SQL): A clause that filters aggregated data.
    • Window Function (SQL): A function that performs a calculation across a set of table rows that are related to the current row.
    • OVER (SQL): A clause that specifies the window for a window function.
    • PARTITION BY (SQL): A clause that divides the rows into partitions for window functions.
    • ORDER BY (SQL): A clause that specifies the order of rows within a window function.
    • ROWS BETWEEN (SQL): A clause that defines the boundaries of a window.
    • Numbering Functions (SQL): Window functions that assign numbers to rows based on specified criteria (ROW_NUMBER, RANK, DENSE_RANK, NTILE).
    • ROW_NUMBER() (SQL): Assigns a unique sequential integer to each row within a partition.
    • RANK() (SQL): Assigns a rank to each row within a partition based on the order of the rows. Rows with equal values receive the same rank, and the next rank is skipped.
    • DENSE_RANK() (SQL): Similar to RANK(), but assigns consecutive ranks without skipping.
    • NTILE(n) (SQL): Divides the rows within a partition into ‘n’ approximately equal groups, assigning a bucket number to each row.
    • Common Table Expression (CTE): A named temporary result set defined within a SELECT, INSERT, UPDATE, or DELETE statement.

    SQL and BigQuery: A Comprehensive Guide

    Okay, I will analyze the provided text excerpts and create a briefing document that summarizes the main themes, important ideas, and key facts related to SQL and BigQuery. I will include quotes from the original source where appropriate.

    Briefing Document: SQL and BigQuery Fundamentals

    Overview:

    This document summarizes key concepts and functionalities of SQL, specifically within the context of BigQuery. The material covers data organization, query structure, data manipulation, and advanced techniques like window functions and common table expressions. The focus is on understanding the logical order of operations within SQL queries and using this understanding to write efficient and effective code.

    1. Data Organization in BigQuery:

    • Tables: Data is stored in tables, which consist of rows and columns, similar to spreadsheets.
    • “Data in BigQuery and in SQL in general exists in the form of tables and a table looks just like this… it is a collection of rows and columns and it is quite similar to a spreadsheet…”
    • Datasets: Tables are organized into datasets, analogous to folders in a file system.
    • “In order to organize our tables we use data sets… a data set is just that it’s a collection of tables and it’s similar to how a folder works in a file system.”
    • Projects: Datasets belong to projects. BigQuery allows querying data from other projects, including public datasets.
    • “In BigQuery each data set belongs to a project… in Big Query I’m not limited to working with data that leaves in my project I could also from within my project query data that leaves in another project for example the bigquery public data is a project that is not mine…”

    2. Basic SQL Query Structure:

    • Statements: A complete SQL instruction, defining data retrieval and processing.
    • “This is a SQL statement it is like a complete sentence in the SQL language. The statement defines where we want to get our data from and how we want to receive these data including any processing that we want to apply to it…”
    • Clauses: Building blocks of SQL statements (e.g., SELECT, FROM, WHERE, GROUP BY, ORDER BY, LIMIT).
    • “The statement is made up of building block blocks which we call Clauses and in this statement we have a clause for every line… the Clauses that we see here are select from where Group by having order and limit…”
    • Importance of Data Types: Columns have defined data types which dictates the operations that can be performed. SQL tables can be clearly connected with each other.
    • “You create a table and when creating that table you define the schema the schema is the list of columns and their names and their data types you then insert data into this table and finally you have a way to define how the tables are connected with each other…”

    3. Key SQL Concepts:

    • Cost Consideration: BigQuery charges based on the amount of data scanned by a query. Monitoring query size is crucial.
    • “This query will process 1 kilobyte when run so this is very important because here big query is telling you how much data will be scanned in order to give you the results of this query… the amount of data that scanned by the query is the primary determinant of bigquery costs.”
    • Arithmetic Operations: SQL supports combining columns and constants using arithmetic operators and functions.
    • “We are able to combine columns and constants with any sort of arithmetic operations. Another very powerful thing that SQL can do is to apply functions and a function is a prepackaged piece of logic that you can apply to our data…”
    • Aliases: Using aliases (AS) to rename columns or tables for clarity and brevity.
    • Boolean Algebra in WHERE Clause: The WHERE clause uses Boolean logic (AND, OR, NOT) to filter rows based on conditions. Truth tables help understand operator behavior.
    • “The way that these logical statements work is through something called Boolean algebra which is an essential theory for working with SQL… though the name may sound a bit scary it is really easy to understand the fundamentals of Boolean algebra now…”
    • Set Operators (UNION, INTERSECT, EXCEPT): Combining the results of multiple queries using set operations. UNION combines rows, INTERSECT returns common rows, and EXCEPT returns rows present in the first table but not the second. UNION DISTINCT removes duplicate rows, while UNION ALL keeps them.
    • “This command is called Union and not like stack or or something else is is that this is a set terminology right this comes from the mathematical theory of sets… and unioning means combining the values of two sets…”

    4. Advanced SQL Techniques:

    • CASE WHEN Statements: Creating conditional logic to assign values based on specified conditions.
    • “When this condition is true we want to return the value low which is a string a piece of text that says low… all of this that you see here this is the case Clause right or the case statement and all of this is basically defining a new column in my table…”
    • Subqueries: Embedding queries within other queries to perform complex filtering or calculations. Correlated subqueries are slower as they need to be recomputed for each row.
    • “SQL solves this query first gets the result and then plugs that result back back into the original query to get the data we need… on the right we have something that’s called a correlated subquery and on the left we Define this as uncor related subquery…”
    • Common Table Expressions (CTEs): Defining temporary named result sets (tables) within a query for modularity and readability.
    • JOIN Operations: Combining data from multiple tables based on related columns. Types include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.
    • “A full outer join is like an inner join plus a left join plus a right join…”.
    • GROUP BY and Aggregation: Summarizing data by grouping rows based on one or more columns and applying aggregate functions (e.g., SUM, AVG, COUNT, MIN, MAX). The HAVING clause filters aggregated results.
    • “Having you are free to write filters on aggregated values regardless of the columns that you are selecting…”.
    • Window Functions: Performing calculations across a set of rows that are related to the current row without altering the table structure. They use the OVER() clause to define the window.
    • “Window functions allow us to do computations and aggregations on multiple rows in that sense they are similar to what we have seen with aggregations and group bu the fundamental difference between grouping and window function is that grouping is fundamentally altering the structure of the table…”
    • Numbering Functions (ROW_NUMBER, DENSE_RANK, RANK): Assigning sequential numbers or ranks to rows based on specified criteria.
    • “Numbering functions are functions that we use in order to number the rows in our data according to our needs and there are several numbering functions but the three most important ones are without any doubt row number dense Rank and rank…”

    5. Logical Order of SQL Operations:

    The excerpts emphasize the importance of understanding the order in which SQL operations are performed. This order dictates which operations can “see” the results of previous operations. The general order is:

    1. FROM (Source data)
    2. WHERE (Filter rows)
    3. GROUP BY (Aggregate into groups)
    4. Aggregate Functions (Calculate aggregations within groups)
    5. HAVING (Filter aggregated groups)
    6. Window Functions (Calculate windowed aggregates)
    7. SELECT (Choose columns and apply aliases)
    8. DISTINCT (Remove duplicate rows)
    9. UNION/INTERSECT/EXCEPT (Combine result sets)
    10. ORDER BY (Sort results)
    11. LIMIT (Restrict number of rows)

    6. Postgress SQL Quirk

    Integer Division: When dividing two integers postgress assumes that you you are doing integer Division and returns integer as well. To avoid it, at least one number needs to be floating point number.

    Conclusion:

    The provided text excerpts offer a comprehensive overview of SQL fundamentals and advanced techniques within BigQuery. A strong understanding of data organization, query structure, the logical order of operations, and the various functions and clauses available is crucial for writing efficient and effective SQL code. Mastering these concepts will enable users to extract valuable insights from their data and solve complex analytical problems.

    BigQuery and SQL: Data Management, Queries, and Functions

    FAQ on SQL and Data Management with BigQuery

    1. How is data organized in BigQuery and SQL in general?

    Data in BigQuery is organized in a hierarchical structure. At the lowest level, data resides in tables. Tables are collections of rows and columns, similar to spreadsheets. To organize tables, datasets are used, which are collections of tables, analogous to folders in a file system. Finally, datasets belong to projects, providing a top-level organizational unit. BigQuery also allows querying data from public projects, expanding access beyond a single project.

    2. How does BigQuery handle costs and data limits?

    BigQuery’s costs are primarily determined by the amount of data scanned by a query. Within the sandbox program, users can scan up to one terabyte of data each month for free. It’s important to check the amount of data that a query will process before running it, especially with large tables, to avoid unexpected charges. The query interface displays this information before execution.

    3. What are the fundamental differences between SQL tables and spreadsheets?

    While both spreadsheets and SQL tables store data in rows and columns, key differences exist. Spreadsheets are typically disconnected, whereas SQL provides mechanisms to define connections between tables. This allows relating data across multiple tables through defined schemas, specifying column names and data types. SQL also enforces a logical order of operations, which dictates the order in which the various parts of a query are executed.

    4. How are calculations and functions used in SQL queries?

    SQL allows performing calculations using columns and constants. Common arithmetic operations are supported, and functions, pre-packaged logic, can be applied to data. The order of operations in SQL follows standard arithmetic rules: brackets first, then functions, multiplication and division, and finally addition and subtraction.

    5. What are Clauses in SQL, and how are they used?

    SQL statements are constructed from building blocks known as Clauses. Key clauses include SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, and LIMIT. Clauses define where the data comes from, how it should be processed, and how the results should be presented. The clauses are assembled to form a complete SQL statement. The order in which you write the clauses is less important than the logical order in which they are executed, which is FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY and LIMIT.

    6. How do the WHERE clause and Boolean algebra work together to filter data in SQL?

    The WHERE clause is used to filter rows based on logical conditions. These conditions rely on Boolean algebra, which uses operators like NOT, AND, and OR to create complex expressions. Understanding the order of operations within Boolean algebra is crucial for writing effective WHERE clauses. NOT is evaluated first, then AND, and finally OR.

    7. What are set operations in SQL, and how are they used?

    SQL provides set operations like UNION, INTERSECT, and EXCEPT to combine or compare the results of multiple queries. UNION combines rows from two or more tables, with UNION DISTINCT removing duplicate rows and UNION ALL keeping all rows, including duplicates. INTERSECT DISTINCT returns only the rows that are common to both tables. EXCEPT DISTINCT returns rows from the first table that are not present in the second table.

    8. How can window functions be used to perform calculations across rows without altering the structure of the table?

    Window functions perform calculations across a set of table rows related to the current row, without grouping the rows like GROUP BY. They are defined using the OVER() clause, which specifies the window of rows used for the calculation. Window functions can perform aggregations, ordering, and numbering within the defined window, adding insights without collapsing the table’s structure. Numbering functions include ROW_NUMBER, RANK, and DENSE_RANK. Numbering functions are often used in conjunction with Partition By and Order By which can divide data into logical partitions in which to number results. Ranking functions, when used with PARTITION BY and ORDER BY can define a rank, for instance, for each race result, ordered fastest to slowest. They can then be further filtered with use of a CTE, a Common Table Expression.

    SQL Data Types and Schemas

    In SQL, a data model is defined by the name of columns and the data type that each column will contain.

    • Definition: The schema of a table includes the name of each column in the table and the data type of each column. The data type of a column defines the type of operations that can be done to the column.
    • Examples of data types:
    • Integer: A whole number.
    • Float: A floating point number.
    • String: A piece of text.
    • Boolean: A value that is either true or false.
    • Timestamp: A value that represents a specific point in time.
    • Interval: A data type that specifies a certain span of time.
    • Data types and operations: Knowing the data types of columns is important because it allows you to know which operations can be applied. For example, you can perform mathematical operations such as multiplication or division on integers or floats. For strings, you can change the string to uppercase or lowercase. For timestamps, you can subtract a certain amount of time from that moment.

    SQL Tables: Structure, Schema, and Operations

    In SQL, data exists in the form of tables. Here’s what you need to know about SQL tables:

    • StructureA table is a collection of rows and columns, similar to a spreadsheet.
    • Each row represents an entry, and each column represents an attribute of that entry. For example, in a table of fantasy characters, each row may represent a character, and each column may represent information about them such as their ID, name, class, or level.
    • SchemaEach SQL table has a schema that defines the columns of the table and the data type of each column.
    • The schema is assumed as a given when working in SQL and is assumed not to change over time.
    • OrganizationIn SQL, tables are organized into data sets.
    • A data set is a collection of tables and is similar to a folder in a file system.
    • In BigQuery, each data set belongs to a project.
    • Table IDThe table ID represents the full address of the table.
    • The address is made up of three components: the ID of the project, the data set that contains the table, and the name of the table.
    • Connections between tablesSQL allows you to define connections between tables.
    • Tables can be connected with each other through arrows. These connections indicate that one of the tables contains a column with the same data as a column in another table, and that the tables can be joined using those columns to combine data.
    • Table operations and clausesFROM: indicates the table from which to retrieve data.
    • SELECT: specifies the columns to retrieve from the table.
    • WHERE: filters rows based on specified conditions.
    • DISTINCT: removes duplicate rows from the result set.
    • UNION: stacks the results from multiple tables.
    • ORDER BY: sorts the result set based on specified columns.
    • LIMIT: limits the number of rows returned by the query.
    • JOIN: combines rows from two or more tables based on a related column.
    • GROUP BY: groups rows with the same values in specified columns into summary rows.

    SQL Statements: Structure, Clauses, and Operations

    Here’s what the sources say about SQL statements:

    General Information

    • In SQL, a statement is like a complete sentence that defines where to get data and how to receive it, including any processing to apply.
    • A statement is made up of building blocks called clauses.
    • Query statements allow for retrieving, analyzing, and transforming data.
    • In this course, the focus is exclusively on query statements.

    Components and Structure

    • Clauses are assembled to build statements.
    • There is a specific order to writing clauses; writing them in the wrong order will result in an error.
    • Common clauses include SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, and LIMIT.

    Order of Execution

    • The order in which clauses are written (lexical order) is not the same as the order in which they are executed (logical order).
    • The logical order of execution is FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, and finally LIMIT.
    • The actual order of execution (effective order) may differ from the logical order due to optimizations made by the SQL engine. The course focuses on mastering the lexical order and the logical order.

    Clauses and their Function

    • FROM: Specifies the table from which to retrieve the data. It is always the first component in the logical order of operations because you need to source the data before you can work with it.
    • SELECT: Specifies which columns of the table to retrieve. It allows you to get any columns from the table in any order. You can also use it to rename columns, define constant columns, combine columns in calculations, and apply functions.
    • WHERE: Filters rows based on specified conditions. It follows right after the FROM clause in the logical order. The WHERE clause can reference columns of the tables, operations on columns, and combinations between columns.
    • DISTINCT: removes duplicate rows from the result set.

    Combining statements

    • UNION allows you to stack the results from two or more tables. In BigQuery, you must specify UNION ALL to include duplicate rows or UNION DISTINCT to only include unique rows.
    • INTERSECT returns only the rows that are shared between two tables.
    • EXCEPT returns all of the elements in one table except those that are shared with another table.
    • For UNION, INTERSECT, and EXCEPT, the tables must have the same number of columns, and the columns must have the same data types.

    Subqueries

    • Subqueries are nested queries used to perform complex tasks that cannot be done with a single query.
    • A subquery is a piece of SQL logic that returns a table.
    • Subqueries can be used in the FROM clause instead of a table name.

    Common Table Expressions (CTEs)

    • CTEs are virtual tables defined within a query that can be used to simplify complex queries and improve readability.
    • CTEs are defined using the WITH keyword, followed by the name of the table and the query that defines it.
    • CTEs can be used to build data pipelines within SQL code.

    SQL Logical Order of Operations

    Here’s what the sources say about the logical order of operations in SQL:

    Basics

    • The order in which clauses are written (lexical order) is not the order in which they are executed (logical order).
    • Understanding the logical order is crucial for accelerating learning SQL.
    • The logical order helps in building a powerful mental model of SQL that allows tackling complex and tricky problems.

    The Logical Order

    • The logical order of execution is: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, and finally LIMIT.
    • The JOIN clause is not really separate from the FROM clause; they are the same component in the logical order of operations.

    Rules for Understanding the Schema

    • Operations are executed sequentially from left to right.
    • Each operation can only use data that was produced by operations that came before it.
    • Each operation cannot know anything about data that is produced by operations that follow it.

    Implications of the Logical Order

    • FROM is the very first component in the logical order of operations because the data must be sourced before it can be processed. The FROM clause specifies the table from which to retrieve the data. The JOIN clause is part of this step, as it defines how tables are combined to form the data source.
    • WHERE Clause follows right after the FROM Clause. After sourcing the data, the next logical step is to filter the rows that are not needed. The WHERE clause drops all the rows that are not needed, so the table becomes smaller and easier to deal with.
    • GROUP BY fundamentally alters the structure of the table. The GROUP BY operation compresses down the values; in the grouping field, a single row will appear for each distinct value, and in the aggregate field, the values will be compressed or squished down to a single value as well.
    • SELECT determines which columns to retrieve from the table. The SELECT clause is where new columns are defined.
    • ORDER BY sorts the result of the query. Because the ordering occurs so late in the process, SQL knows the final list of rows that will be included in the results, which is the right moment to order those rows.
    • LIMIT is the very last operation. After all the logic of the query is executed and all data is computed, the LIMIT clause restricts the number of rows that are output.

    Window Functions and the Logical Order

    • Window functions operate on the result of the GROUP BY clause, if present; otherwise, they operate on the data after the WHERE filter is applied.
    • After applying the window function, the SELECT clause is used to choose which columns to show and to label them.

    Common Errors

    • A common error is to try to use LIMIT to make a query cheaper. The LIMIT clause does not reduce the amount of data that is scanned; it only limits the number of rows that are returned.
    • Another common error is to violate the logical order of operations. For example, you cannot use a column alias defined in the SELECT clause in the WHERE clause because the WHERE clause is executed before the SELECT clause.
    • In Postgres, you cannot use the labels that you assign to aggregations in the HAVING clause.

    Boolean Algebra: Concepts, Operators, and SQL Application

    Here’s what the sources say about Boolean algebra:

    Basics

    • Boolean algebra is essential for working with SQL and other programming languages.
    • It is fundamental to how computers work.
    • It is a simple way to understand the fundamentals.

    Elements

    • In Boolean algebra, there are only two elements: true and false.
    • A Boolean field in SQL is a column that can only have these two values.

    Operators

    • Boolean algebra has operators that transform elements.
    • The three most important operators are NOT, AND, and OR.

    Operations and Truth Tables

    • In Boolean algebra, operations combine operators and elements and return elements.
    • To understand how a Boolean operator works, you have to look at its truth table.

    NOT Operator

    • The NOT operator works on a single element, such as NOT TRUE or NOT FALSE.
    • The negation of p is the opposite value.
    • NOT TRUE is FALSE
    • NOT FALSE is TRUE

    AND Operator

    • The AND operator connects two elements, such as TRUE AND FALSE.
    • If both elements are true, then the AND operator will return true; otherwise, it returns false.

    OR Operator

    • The OR operator combines two elements.
    • If at least one of the two elements is true, then the OR operator returns true; only if both elements are false does it return false.

    Order of Operations

    • There is an agreed-upon order of operations that helps solve complex expressions.
    • The order of operations is:
    1. Brackets (solve the innermost brackets first)
    2. NOT
    3. AND
    4. OR

    Application in SQL

    • A complex logical statement that is plugged into the WHERE filter isolates only certain rows.
    • SQL converts statements in the WHERE filter to true or false, using values from a row.
    • SQL uses Boolean algebra rules to compute a final result, which is either true or false.
    • If the result computes as true for the row, then the row is kept; otherwise, the row is discarded.

    Example

    To solve a complex expression, such as NOT (TRUE OR FALSE) AND (FALSE OR TRUE), proceed step by step:

    1. Solve the innermost brackets:
    • TRUE OR FALSE is TRUE
    • FALSE OR TRUE is TRUE
    1. The expression becomes: NOT (TRUE) AND (TRUE)
    2. Solve the NOT:
    • NOT (TRUE) is FALSE
    1. The expression becomes: FALSE AND TRUE
    2. Solve the AND:
    • FALSE AND TRUE is FALSE
    1. The final result is FALSE
    Intuitive SQL For Data Analytics – Tutorial
    Data Analytics FULL Course for Beginners to Pro in 29 HOURS – 2025 Edition

    The Original Text

    learn SQL for analytics Vlad is a data engineer and in this course he covers both the theory and the practice so you can confidently solve hard SQL challenges on your own no previous experience required and you’ll do everything in your browser using big query hi everyone my name is Vlad and I’m a date engineer welcome to intuitive SQL for analytics this here is the main web page for the course you will find it in the video description and this will get updated over time with links and resources so be sure to bookmark it now the goal of this course is to quickly enable you to use SQL to analyze and manipulate data this is arguably the most important use case for SQL and the Practical objective is that by the end of this course you should be able to confidently solve hard SQL problems of the kind that are suggested during data interviews the course assumes no previous knowledge of SQL or programming although it will be helpful if you’ve work with spreadsheets such as Microsoft Excel or Google Sheets because there’s a lot of analogies between manipulating data in spreadsheets and doing it in SQL and I also like to use spreadsheets to explain SQL Concepts now there are two parts to this course theory and practice the theory part is a series of short and sweet explainers about the fundamental concepts in SQL and for this part we will use Google bigquery bigquery which you can see here is a Google service that allows you to upload your own data and run SQL on top of it so in the course I will teach you how to do that and how to do it for free you won’t have to to spend anything and then we will load our data and we will run SQL code and besides this there will be drawings and we will also be working with spreadsheets and anything it takes to make the SQL Concepts as simple and understandable as possible the practice part involves doing SQL exercises and for this purpose I recommend this website postest SQL exercises this is a free and open-source website where you will find plenty of exercises and you will be able to run SQL code to solve these exercises check your answer and then see a suggested way to do it so I will encourage you to go here and attempt to solve these exercises on your own however I have also solved 42 of these exercises the most important ones and I have filmed explainers where I solve the exercise break it apart and then connect it to the concepts of the course so after you’ve attempted the exercise you will be able to see me solving it and connect it to the rest of the course so how should you take this course there are actually many ways to do it and you’re free to choose the one that works best if you are a total beginner I recommend doing the following you should watch the theory lectures and try to understand everything and then once you are ready you should attempt to do the exercises on your own on the exercise uh website that I’ve shown you here and if you get stuck or after you’re done you can Watch How I solved the exercise but like I said this is just a suggestion and uh you can combine theory and practice as you wish and for example a more aggressive way of doing this course would be to jump straight into the exercises and try to do them and every time that you are stuck you can actually go to my video and see how I solved the exercise and then if you struggle to understand the solution that means that maybe there’s a theoretical Gap and then you can go to the theory and see how the fundamental concepts work so feel free to experiment and find the way that works best for you now let us take a quick look at the syllabus for the course so one uh getting started this is a super short explainer on what SQL actually is and then I teach you how to set up bigquery the Google service where we will load our data and run SQL for the theory part the second uh chapter writing your first query so here I explained to you how big query works and how you can use it um and how you are able to take your own data and load it in big query so you can run SQL on top of it and at the end of it we finally run our first SQL query chapter 3 is about exploring some ESS IAL SQL Concepts so this is a short explainer of how data is organized in SQL how the SQL statement Works meaning how we write code in SQL and here is actually the most important concept of the whole course the order of SQL operations this is something that is not usually taught properly and a lot of beginners Miss and this causes a lot of trouble when you’re you’re trying to work with SQL so once you learn this from the start you will be empowered to progress much faster in your SQL knowledge and then finally we get into the meat of the course this is where we learn all the different components in SQL how they work and how to combine them together so this happens in a few phases in the first phase we look at the basic components of SQL so these are uh there’s a few of them uh there’s select and from uh there’s learning how to transform columns the wear filter the distinct Union order by limit and then finally we see how to do simple aggregations at the end of this part you will be empowered to do the first batch of exercises um don’t worry about the fact that there’s no links yet I will I will add them but this is basically involves going to this post SQL exercises website and going here and doing this uh first batch of exercises and like I said before after you’ve done the exercises you can watch the video of me also solving them and breaking them down next we take a look at complex queries and this involves learning about subqueries and Common Table expressions and then we look at joining tables so here is where we understand how SQL tables are connected uh with each other and how we can use different types of joints to bring them together and then you are ready for the second batch of exercises which are those that involve joints and subqueries and here there are eight exercises the next step is learning about aggregations in SQL so this involves the group bu the having and window functions and then finally you are ready for the final batch of exercises which actually bring together all the concepts that we’ve learned in this course and these are 22 exercises and like before for each exercise you have a video for me solving it and breaking it apart and then finally we have the conclusion in the conclusion we see how we can put all of this knowledge together and then we take a look at how to use this knowledge to actually go out there and solve SQL challenges such as the ones that are done in data interviews and then here you’ll find uh all the resources that are connected to the course so you have the files with our data you have the link to the spreadsheet that we will use the exercises and all the drawings that we will do this will definitely evolve over over time as the course evolves so bookmark this page and keep an eye on it that was that was all you needed to know to get started so I will see you in the course if you are working with SQL or you are planning to work with SQL you’re certainly a great company in the 2023 developer survey by stack Overflow there is a ranking of the most popular Technologies out there if we look at professional developers where we have almost 70,000 responses we can see that SQL is ranked as the third most popular technology SQL is certainly one of the most in demand skills out there not just for developers but for anyone who works with data in any capacity and in this course I’m going to help you learn SQL the way I wish I would have learned it when I started out on my journey since this is a practical course we won’t go too deep into the theory all you need to know for our purposes is that SQL is a language for working with data like most languages SQL has several dialects you may have heard of post SQL or my sqil for example you don’t need to worry about these dialects because they’re all very similar so if you learn SQL in any one of the dialects you’ll do well on all the others in this course we will be working with B query and thus we will write SQL in the Google SQL dialect here is the documentation for Google big query the service that we will use to write SQL code in this course you can see that big query uses Google SQL a dialect of SQL which is an compliant an compliant means that Google SQL respects the generally recognized standard for creating SQL dialects and so it is highly compatible with with all other common SQL dialects as you can read here Google SQL supports many types of statements and statements are the building blocks that we use in order to get work done with SQL and there are several types of statements listed here for example query statements allow us to retrieve and analyze and transform data data definition language statements allow us to create and modify database objects such as tables and Views whereas data manipulation language statements allows us to update and insert and delete data from our tables now in this course we focus exclusively on query statements statements that allow us to retrieve and process data and the reason for this is that if you’re going to start working with big query you will most likely start working with this family of statements furthermore query statements are in a sense the foundation for all other families of statements so if you understand uh query statements you’ll have no trouble learning the others on your own why did I pick big query for this course I believe that the best way to learn is to load your own data and follow questions that interest you and play around with your own projects and P query is a great tool to do just that first of all it is free at least for the purposes of learning and for the purposes of this course it has a great interface that will give you U really good insights into your data and most importantly it is really easy to get started you don’t have to install anything on your computer you don’t have to deal with complex software you just sign up for Google cloud and you’re ready to go and finally as you will see next big query gives you many ways to load your own data easily and quickly and get started writing SQL right away I will now show you how you can sign up for Google cloud and get started with bigquery so it all starts with this link which I will share in the resources and this is the homepage of Google cloud and if you don’t have an account with Google Cloud you can go here and select sign in and here you need to sign in with your Google account which you probably have but if you don’t you can go here and select create account so I have now signed in with my Google account which you can see here in the upper right corner and now I get a button that says start free so I’m going to click that and now I get taken to this page and on the right you see that the first time you sign up for Google Cloud you get $300 of free credits so that you can try the services and that’s pretty neat and here I have to enter some extra information about myself so I will keep it as is and agree to the terms of service and continue finally I need to do the payment information verification so unfortunately this is something I need to do even though I’m not going to be charged for the services and this is for Google to be able to verify my my identity so I will pick individual as account type and insert my address and finally I need to add a payment method and again uh I need to do this even though I’m not going to pay I will actually not do it here because I don’t intend to sign up but after you are done you can click Start my free trial and then you should be good to go now your interface may look a bit different but essentially after you’ve signed up for Google Cloud you will need to create a project and the project is a tool that organizes all your work in Google cloud and essentially every work that you do in Google cloud has to happen inside a specific project now as you can see here there is a limited quota of projects but that’s not an issue because we will only need one project to work in this course and of course creating a new project is totally free so I will go ahead and give it a name and I don’t need any organization and I will simply click on create once that’s done I can go back back to the homepage for Google cloud and here as you can see I can select a project and here I find the project that I have created before and once I select it the rest of the page won’t change but you will see the name of the project in the upper bar here now although I’ve created this project as an example for you for the rest of the course you will see me working within this other project which was the one that I had originally now I will show you how you can avoid paying for Google cloud services if you don’t want to so from the homepage you have the search bar over here and you can go here and write billing and click payment overview to go to the billing service now here on the left you will see your billing account account which could be called like this or have another name and clicking here I can go to manage billing accounts now here I can go to my projects Tab and I see a list of all of my projects in Google cloud and a project might or might not be connected to a billing account if a project is not connected to a billing account then then Google won’t be able to charge you for this project although keep in mind that if you link your project with a billing account and then you incur some expenses if you then remove the billing account you will still owe Google Cloud for those uh expenses so what I can do here is go to my projects and on actions I can select disabled building in case I have a billing account connected now while this is probably the shest way to avoid incurring any charges you will see that you will be severely limited in what you can do in your project if that project is not linked to any billing account however you should still be able to do most of what you need to do in B query at least for this course and we can get more insight into how that works by by going to the big query pricing table so this page gives us an overview of how pricing works for big query I will not analyze this in depth but what you need to know is that when you work with bigquery you can fundamentally be charged for two things one is compute pricing and this basically means all the data that bigquery scans in order to return the results that you need when you write your query and then you have storage pricing which is the what you pay in order to store your data inside bigquery now if I click on compute pricing I will go to the pricing table and here you can select the region that uh most reflects where you are located and I have selected Europe here and as you can see you are charged $625 at the time of this video for scanning a terabyte of data however the first terabyte per month is free so every month you can write queries that scan one terabyte of data and not pay for them and as you will see more in detail this is more than enough for what we will be doing in this course and also for for what you’ll be doing on your own in order to experiment with SQL and if I go back to the top of the page and then click on storage pricing you can see here that again you can select your region and see um several pricing uh units but here you can see that the first 10 gab of storage per month is free so you can put up to 10 gigabytes of data in B query and you won’t need a billing account you won’t pay for storage and this is more than enough for our needs in order to learn SQL in short bigquery gives us a pretty generous free allowance for us to load data and play with it and we should be fine however I do urge you to come back to this page and read it again because things may have changed since I recorded this video video to summarize go to the billing service check out your billing account and you have the option to decouple your project from the billing account to avoid incurring any charges and you should still be able to use B query but as a disclaimer I cannot guarantee that things will work just the same uh at the time that you are watching this video so be sure to check the documentation or maybe discuss with Google Cloud support to um avoid incurring any unexpected expenses please do your research and be careful in your usage of these services for this course I have created an imaginary data set with the help of chat GPT the data set is about a group of fantasy characters as well as their items and inventories I then proceed proed to load this data into bigquery which is our SQL system I also loaded it into Google Sheets which is a spreadsheet system similar to Microsoft Excel this will allow me to manipulate the data visually and help you develop a strong intuition about SQL operations I’m going to link a separate video which explains how you can also use chat PT to generate imaginary data according to your needs and then load this data in Google Sheets or bigquery I will also link the files for this data in the description which you can use to reproduce this data on your side next I will show you how we can load the data for this course into bigquery so I’m on the homepage of Google cloud and I have a search bar up here and I can write big query and select it from here and this will take me to the big query page now there is a panel on the left side that appears here if I hover or it could be fixed and this is showing you several tools that you can use within bigquery and you can see that we are in the SQL workspace and this is actually the only tool that we will need for this course so if you if you’re seeing this panel on the left I recommend going to this arrow in the upper left corner and clicking it so you can disable it and make more room for yourself now I want to draw your attention to the Explorer tab which shows us where our data is and how it is organized so I’m going to expand it here now data in bigquery and in SQL in general exists in the form of tables and a table looks just like this as you can see here the customer’s table it is a collection of rows and columns and it is quite similar to a spreadsheet so this will be familiar to you if you’ve ever worked with Microsoft Excel or Google Sheets or any spreadsheet program so your data is actually living in a table and you could have as many tables as you need in B query there could be quite a lot of them so in order to organize our tables we use data sets for example in this case my data is a data set which contains the table customers and employee data and a data set is is just that it’s a collection of tables and it’s similar to how a folder Works in a file setem system it is like a for folder for tables finally in bigquery each data set belongs to a project so you can see here that we have two data sets SQL course and my data and they both belong to this project idelic physics and so on and this is actually the ID of my project this is the ID of the project that I’m working in right now the reason the Explorer tab shows the project as well is that in big query I’m not limited to working with data that leaves in my project I could also from within my project query data that leaves in another project for example the bigquery public data is a project that is not mine but it’s actually a public project by bigquery and if I expand this you will see that it contains a collection of of several data sets which are in themselves um collections of tables and I would be able to query these uh tables as well but you don’t need to worry about that now because in this course we will only focus on our own data that lives in our own project so this in short is how data is organized in big query now for the purpose of this course I recommend creating a new data set so so that our tables can be neatly organized and to do that I can click the three dots next to the project uh ID over here and select create data set and here I need to pick a name for the data set so I will call this fantasy and I suggest you use the same name because if you do then the code that I share with you will work immediately then as for the location you can select the multi region and choose the region that is closest to you and finally click on create data set so now the data set fantasy has been created and if I try to expand it here I will see that it is empty because I haven’t loaded any data yet the next step is to load our tables so I assume that you have downloaded the zip file with the tables and extracted it on your local computer and then we can select the action point here next to the fantasy data set and select create table now as a source I will select upload and here I will click on browse and access the files that I have downloaded and I will select the first table here here which is the characters table the file format is CSV so Google has already understood that and scrolling down here I need to choose a name for my table so I will call it just like the file uh which is characters and very important under schema I need to select autodetect and we will see what this means in a bit but basically this is all we need so now I will select create table and now you will see that the characters table has appeared under the fantasy data set and if I click on the table and then go on preview I will should be able to see my data I will now do the same for the other two tables so again create table source is upload file is inventory repeat the name and select autod detect and I have done the same with the third table so at the end of this exercise the fantasy data set should have three tables and you can select them and go on preview to make sure that the data looks as expected now our data is fully loaded and we are ready to start querying it within big query now let’s take a look at how the bigquery interface works so on the left here you can see the Explorer which shows all the data that I have access to and so to get a table in big query first of all you open the name of the project and then you look at the data sets that are available within this project you open a data set and finally you see a table such as characters and if I click now on characters I will open the table view now in the table view I will find a lot of important information about my table in these tabs over here so let’s look at the first tab schema the schema tab shows me the structure of my table which as we shall see is very important and the schema is defined essentially by two things the name of each column in my table and the data type of each column so here we see that the characters table contains a few columns such as ID name Guild class and so on and these columns have different data types for example ID is an integer which means that it contains natural numbers whereas name is string which means that it contains text and as we shall see the schema is very important because it defines what you can do with the table and next we have the details tab which contains a few things first of all is the table ID and this ID represents the full address of the table and this address is made up of three components first of all you have the ID of the project which is as you can see the project in which I’m working and it’s the same that you see here on the left in the Explorer tab the next component is the data set that contains the table and again you see it in the Explorer Tab and finally you have the name of the table this address is important because it’s what we use to reference the table and it’s what we use to get data from this table and then we see a few more things about the table such as when it was created when it was last modified and here we can see the storage information so we can see here that this table has 15 rows and on the dis it occupies approximately one kilobyte if you work extensively with P query this information will be important for two reasons number one it defines how much you are paying every month to store this table and number two it defines how much you would pay for a query that scans all the data in this table and as we have seen in the lecture on bigquery pricing these are the two determinants of bigquery costs however for the purpose of this course you don’t need to worry about this because the tables we are working with are so small that they won’t put a dent in your free month monthly allowance for using big query next we have the preview tab which is really cool to get a sense of the data and this basically shows you a graphical representation of your table and as you will notice it looks very similar to a spreadsheet so you can see our columns the same ones that we saw in the schema tab ID name Guild and so on and as you remember we saw that ID is an integer column so you can only contain numbers name is a text column and then you see that this table has 15 rows and because it’s such a small table all of it fits into this graphical representation but in the real world you may have tables with millions of rows and in this case the preview will show you only a small portion of that table table but still enough to get a good sense of the data now there are a few more tabs in the table view we have lineage data profile data quality but I’m not going to look at them now because they are like Advanced features in bigquery and you won’t need them in this course instead I will run a very basic query on this table and this is not for the purpose of understanding query that will come soon it is for the purpose of showing you what the interface looks like after you run a query so I have a very basic query here that will run on my table and you can see that the interface is telling me how much data this query will process and this is important because this is the main determinant of cost in bigquery every query scans a certain amount of data and you have to pay for that but as we saw in the lecture of bigquery pricing this table is so small that you could run a million or more of these queries and not exhaust your monthly allowance so if you see 1 kilobyte you don’t have to worry about that so now I will click run and my query will execute and here I get the query results view this is the view that that appears after you have successfully run a query so we have a few tabs here and the first step that you see is results and this shows you graphically the table that was returned by your query so as we shall see every query in SQL runs on a table and returns a table and just like the preview tab showed you a graphical view of your table the results tab shows you a graphical view of the table that your query has returned and this is really the only tab in the query results view that you will need on this course the other ones show different features or more advanced features that we won’t look at but feel free to explore them on your own if you are curious but what’s also important in this view is this button over here save results which you can use to EXP report the result of your query towards several different destinations such as Google drive or local files on your computer in different formats or another big query table a spreadsheet in Google Sheets or even copying them to your clipboard so that you can paste them somewhere else but we shall discuss this more in detail in the lecture on getting data in and out of big query finally if you click on this little keyboard icon up here you can see a list of shortcuts that you can use in the big query interface and if you end up running a lot of queries and you want to be fast this is a nice way to improve your experience with big query so be sure to check these out we are finally ready to write our first query and in the process we will keep exploring the Fantastic bigquery interface so one way to get started would be to click this plus symbol over here so that we can open a new tab now to write the query the first thing I will do is to tell big query where the data that I want leaves and to do that I will use the from Clause so I will simply write from and my data lives in the fantasy data set and in the characters table next I will tell SQL what data I actually want from this table and the simplest thing to ask for is to get all the data and I can do this by writing select star now my query is ready and I can either click run up here or I can press command enter on my Mac keyboard and the query will run and here I get a new tab which shows me the results now the results here are displayed as a table just as uh we saw in the preview tab of the table and I can get an idea of uh my results and this is actually the whole table because this is what I asked for in the query there are also other ways to see the results which are provided by bigquery such as Json which shows the same data but in a different format but we’re not going to be looking into that for this course one cool option that the interface provides is if I click on this Arrow right here in my tab I can select split tab to right and now I have a bit of less room in my interface but I am seeing the table on the left and the query on the right so that I can look at the structure of the table while writing my query for example if I click on schema here I could see which columns I’m able to um reference in my query and that can be pretty handy I could also click this toggle to close the Explorer tab temporarily if I don’t need to look look at those tables so I can make a bit more room or I can reactivate it when needed I will now close this tab over here go back to the characters table and show you another way that I can write a query which is to use this query command over here so if I click here I can select whether I want my query in a new tab or in a split tab let let me say in new tab and now bigquery has helpfully uh written a temp template for a query that I can easily modify in order to get my data and to break down this template as you can see we have the select Clause that we used before we have the from clause and then we have a new one called limit now the from Clause is doing the same job as before it is telling query where we want to get our data but you will notice that the address looks a bit different from the one that I had used specifically I used the address fantasy. characters so what’s happening here is that fantasy. characters is a useful shorthand for the actual address of the table and what we see here that big query provided is the actual full address of the table or in other words it is the table ID and as you remember the table ID indicates the project ID the data set name and the table name and importantly this ID is usually enclosed by back ticks which are a quite specific character long story short if you want to be 100% sure you can use the full address of the table and bigquery will provide it for you but if you are working within the same project where the data lives so you don’t need to reference the project you can also use this shorthand here to make writing the address easier and in this course I will use these two ways to reference a table interchangeably I will now keep the address that bigquery provided now the limit statement as we will see is simply limiting the number of rows that will be returned by this query no more than 1,000 rows will be returned and next to the select we have to say what data we want to get from this table and like before I can write star and now my query will be complete before we run our query I want to draw your attention to this message over here this query will process 1 kilobyte when run so this is very important because here big query is telling you how much data will be scanned in order to give you the results of this query in this case we are returning um all the data in the table therefore all of the table will be scanned and actually limit does not have any influence on that it doesn’t reduce how much data is scanned so this query will scan 1 kilobyte of data and the amount of data that scanned by the query is the primary determinant of bigquery costs now as you remember we are able to scan up to one terabyte of data each month within the sandbox program and if we wanted to scan more data then we would have to pay so the question is how many of these queries could we run before running out of our free allowance well to answer that we could check how many kilobytes are in a terabyte and if you Google this the conversion says it’s one to um multipli by 10 to the power of 9 which ends up being 1 billion therefore we can run 1 billion of these queries each month before running out of our allowance now you understand why I’ve told you that as long as you work with small tables you won’t really run out of your allowance and you don’t really have to worry about costs however here’s an example of a query that will scan a large amount of data and what I’ve done here is I’ve taken one of the public tables provided by big query which I’ve seen to be quite large and I have told big query to get me all the data for this table and as you can see here big query says that 120 gabt of data will be processed once this query runs now you would need about eight of these queries to get over your free allowance and if you had connected to B query you could also be charged money for any extra work that you do so be very careful about this and if you work with large tables always check this message over here before running the query and remember you won’t actually be charged until you actually hit run on the query and there you have it we learned how the big query interface works and wrote our first SQL query it is important that we understand how data is organized in SQL so we’ve already seen a a preview of the characters table and we’ve said that this is quite similar to how you would see data in a spreadsheet namely you have a table which is a collection of rows and columns and then in this case on every row you have a character and for every character you have a number of information points such as their ID their name their class level and so on the first fundamental difference with the spreadsheet is that if I want to have some data in a spreadsheet I can just open a new one and uh insert some data in here right so ID level name and so on then I could say that I have a character id one who is level 10 and his name is Gandalf and this looks like the data I have in SQL and I can add some more data as well well a new character id 2 level five and the name is frao now I will save this spreadsheet and then some days later someone else comes in let’s say a colleague and they want to add some new data and they say oh ID uh is unknown level is um 20.3 and the name here and then I also want to uh show their class so I will just add another column here and call this Mage now spreadsheets are of course extremely flexible because you can always um add another column and write in more cells and you can basically write wherever you want but this flexibility comes at a price because the more additions we make to this uh to the data model that is represented here the more complex it will get with time and the more likely it will be that we make confusions or mistakes which is what actually happens in real life when people work with spreadsheets SQL takes a different approach in SQL before we insert any actual data we have to agree on the data model that we are going to use and the data model is essentially defined by two elements the name of our columns and the data type that each column will contain for example we can agree that we will use three columns in our table ID level and name and then we can agree that ID will be an integer meaning that it will contain contain whole numbers level will be a integer as well and name will be a string meaning that it contains text now that we’ve agreed on this structure we can start inserting data on the table and we have a guarantee that the structure will not change with time and so any queries that we write on top of this table any sort of analysis that we create for this table will also be durable in time because it will have the guarantee that the data model of the table will not change and then if someone else comes in and wants to insert this row they will actually not be allowed to first of all because they are trying to insert text into an integer column and so they’re violating the data type of the column and they are not allowed to do that in level they are also violating the data type of the column because this column only accepts whole numbers and they’re trying to put a floating Point number in there and then finally there are also violating the column definition because they’re they’re trying to add a column class that was not actually included in our data model and that we didn’t agree on so the most important difference between spreadsheets and SQL is that for each SQL table you have a schema and as we’ve seen before the schema defines exactly which columns our table has and what is the data type of each column so in this case for the characters table we have several columns uh and here we can see their names and then each column has a specific data types and all the most important data types are actually represented here specifically by integer we mean a whole number and by float we mean a floating Point number string is a piece of text Boolean is a value that is either true or false and time stamp is a value that represents a specific point in time all of this information so the number of columns the name of each column and the type of each column they constitute the schema of the table and like we’ve said the schema is as assumed as a given when working in SQL and it is assumed that will not change over time now in special circumstances there are ways to alter the schema of a table but it is generally assumed as a given when writing queries and we shall do the same in this course and why is it important to keep track of the data type why is it important to distinguish between integer string Boolean the simple answer is that the data type defines the type of operations that you you can do to a column for example if you have an integer or a float you can multiply the value by two or divide it and so on if you have a string you can turn that string to uppercase or lowercase if you have a time stamp you can subtract 30 days from that specific moment in time and so on so by looking at the data type you can find out what type of work you can do with a column the second fundamental difference from spreadsheets is that spreadsheets are usually disconnected but SQL has a way to define connections between tables so what we see here is a representation of our three tables and for each table you can see the schema meaning the list of columns and their types but the extra information that we have here is the connection between the tables so you can see that the inventory table is connected to the items table and also to the character table moreover the characters table is connected with itself now we’re not going to explore this in depth now because I don’t want to add too much Theory we will see this in detail in the chapter on joints but it is a fundamental difference from spreadsheets that SQL tables can be clearly connected with each other and that’s basically all you need to understand how data is organized in SQL for now you create a table and when creating that table you define the schema the schema is the list of columns and their names and their data types you then insert data into this table and finally you have a way to define how the tables are connected with each other I will now show you how SQL code is structured and give you the most important concept that you need to understand in order to succeed at SQL now this is a SQL statement it is like a complete sentence in the SQL language the statement defines where we want to get our data from and how we want to receive these data including any processing that we want to apply to it and once we have a statement we can select run and it will give us our data now the statement is made up of building block blocks which we call Clauses and in this statement we have a clause for every line so the Clauses that we see here are select from where Group by having order and limit and clauses are really the building blocks that we assemble in order to build statements what this course is about is understanding what each Clause is and how it works and then understanding how we can put together these Clauses in order to write effective statements now the first thing that you need to understand is that there is an order to write in these Clauses you have to write them in the correct order and there is no flexibility there if you write them in the wrong order you will simply get an error for example if I I were to take the work clause and put it below the group Clause you can see that I’m already getting an error here which is a syntax error but you don’t have to worry about memorizing this now because you will pick up this order as we learn each clause in turn now the essential thing that you need to understand and that slows down so many SQL Learners is that while we are forced by SQL to write Clauses in this specific order this is not actually the order in which the Clauses are executed if you’ve interacted with another programming language such as python or or JavaScript you’re used to the fact that each line of your program is executed in turn from top to bottom generally speaking and that is pretty transparent to understand but this is not what is happening here in SQL to give you a sense of the order in which these Clauses are run on a logical level what SQL does is that first it reads the from then it does the wear then the group by then the having then it does the select part after the select part is do it does the order by and finally the limit all of this just to show that the order in which operations are executed is not the same as the order in which they’re written in fact we can distinguish three orders that pertain to SQL Clauses and this distinction is so important to help you master SQL the first level is what we call the lexical order and this is simply what I’ve just shown you it’s the order in which you have to write these Clauses so that SQL can actually execute the statement and not throw you an error then there’s the logical order and this is the order in which the clause are actually run logically in the background and understanding this logical order is crucial for accelerating your learning of SQL and finally for the sake of completeness I had to include the effective order here because what happens in practice is that your statement is executed by a SQL engine and that engine will usually try to take shortcuts and optimize things and save on processing power and memory and so the actual order might be a bit different because the Clauses might be moved around um in the process of optimization but like I said I’ve only included it for the sake of completeness and we’re not going to worry about that level in this course with we are going to focus on mastering the lexical order and The Logical order of SQL Clauses and to help you master The Logical order of SQL Clauses or SQL operations I have created this schema and this is the fundamental tool that you will use in this course this schema as you learn it progressively will allow you to build a powerful mental model of SQL that will allow you to tackle even the most complex and tricky SQL problems now what this schema shows you is all of the Clauses that you will work with when writing SQL statements so these are the building blocks that you will use in order to assemble your logic and then the sequence in which they’re shown is corresponding to The Logical order in which they are actually executed and there are three simple rules for you to understand this schema the first rule is that operations are EX executed sequentially from left to right the second rule is that each operation can only use data that was produced by operations that came before it and the third rule is that each operation cannot know anything about data that is produced by operations that follow it what this means in practice is that if you take any of these components for example the having component you already know that having will have access to data that was produced by the operations that are to to its left so aggregations Group by where and from however having will have absolutely no idea of information that is produced by the operations that follow for example window or select or Union and so on of course you don’t have to worry about understanding this and memorizing it now because we will tackle this gradually throughout the course and throughout the course we will go back to the schema again and again in order to make sense of the work we’re doing and understand the typical errors and Pitfall that happen when working with SQL now you may be wondering why there are these two cases where you actually see two components stacked on top of each other that being from and join and then select an alas these are actually components that are tightly coupled together and they occur at the same place in The Logical ordering which is why I have stacked them like this in this section we tackle the basic components that you need to master in order to write simple but powerful SQL queries and we are back here with our schema of The Logical order of SQL operations which is also our map for everything that we learn in this course but as you can see there is now some empty space in the schema because to help us manage the complexity I have removed all of the components that we will not be tackling in this section let us now learn about from and select which are really the two essential components that you need in order to write the simplest SQL queries going back now to our data let’s say that we wanted to retrieve all of the data from the characters table in the fantasy data set now when you have to write a SQL query the first question you need to ask yourself is where is the data that I need because the first thing that you have to do is to retrieve the data which you can then process and display as needed so in this case it’s pretty simple we know that the data we want leaves in the characters table once you figured out where your data leaves you can write the from Clause so I always suggest starting queries with the from clause and to get the table that we need we can write the name of the data set followed by a DOT followed by the name of the table and you can see that bigquery has recognized the table here so I have written the from clause and I have specified the address of the table which is where the data leaves and now I can write the select clause and in the select Clause I can specify which Columns of the table I want to see so if I click on the characters table here it will open in a new tab in my panel and as you remember the it shows me here the schema of the table and the schema includes the list of all the columns now I can simply decide that I want to see the name and the guilt and so in the select statement here I will write name and guilt and when I run this I get the table with the two columns that I need and one neat thing about this I could write the columns in any order it doesn’t have to be the original order of the schema and the result will show that order and if I I wanted to get all of The Columns of the table I could write them here one by one or I could write star with which is a shorthand for saying please give me all of the columns so this is the corresponding data to our table in Google Sheets and if you want to visualize select in your mind you can imagine it as vertically selecting the parts of the table that you need for example if I were to write select Guild and level this would be equivalent to taking these two columns over here and selecting them let us now think of The Logical order of these operations so first comes the from and then comes the select and this makes logical sense right because the first thing you need to do is to Source the data and later you can select the parts of the data that you need in fact if we look at our schema over here from is the very first component in The Logical order of operations because the first thing that we need to do is to get our data we have seen that the select Clause allows us to get any columns from our table in any order but the select Clause has many other powers so let’s see what else we can do with it one useful thing to know about SQL is that you can add comments in the code and comments are parts of text which are not uh executed as code they’re just there for you to um keep track track of things or or explain what you are doing so I’m going to write a few comments now and the way we do comments is by doing Dash Dash and now I’m going to show you aliasing aliasing is simply renaming a column so I could take the level column and say as character level provided a new name and after I run this we can see that the name of the colum has changed now one thing that’s important to understand as we now start transforming the data with our queries is that any sort of change that we apply such as in this case we change the name of the column it only affects our results it does not affect the original table that we are querying so no matter what we do here moving forward Ward the actual table fantasy characters will not change all that will change are the results that we get after running our query and of course there are ways to go back to Fantasy characters and permanently change it but that is outside the scope for us and going back to our schema you will see that Alias has its own component and it happens happens at the same time as the select component and this is important because as we will see in a bit that it’s a common temptation to use these aliases these labels that we give to columns in the phases that precede this stage which typically fails because as our rules say um every component does not have access to data that is computed after it so something that we will come back to now another power of Select that we want to show is constants and constants is the ability of creating new columns which have a constant value for example let’s say that I wanted to implement a versioning system for my characters and I would say that right now all the characters I have are version one but then in the future every time I change a character I will increase that version and so that will allow me to keep track of changes I can do that by simply writing one over here in the column definition and when I run this you will see that SQL has created a new column and it has put one for every Row in that column this is why we call it a constant column so if I scroll down down all of it will be one and this column has a weird name because we haven’t provided a name for it yet but we already know how to do this we can use the alas sync command to say to call it version and here we go so in short when you write a column name in the select statement SQL looks for that column in the table and gives you that column but when instead you write a value SQL creates a new column and puts that value in every Row the next thing that SQL allows me to do is calculations so let me call the experience column here as well and get my data now one thing I could do is to take experience and divide it by 100 so what we see here is a new column which is the result of this calculation now 100 is a constant value right so you can imagine in the background SQL has created a new column and put 100 in every row and then it has done the calculation between experience and that new column and we get this result and and in short we can do any sort of calculation we want combining current columns and constants as well for example although this doesn’t make any sense I could take experience add 100 to it divided by character level and then multiply it by two and and we see that we got an error can you understand why we got this error pause the video and think for a second I am referring to my column as character level but what is character level really it is a label that I have assigned over here now if we go back to our schema we can see that select and Alias happen at the same time so so this is the phase in which we assign our label and this is also the phase in which we try to call our label now if you look at our rules this is not supposed to work because an operation can only use data produced by operations before it and Alias does not happen before select it happens at the same time in other words this part part over here when we say character level is attempting to use information that was produced right here when we assigned the label but because these parts happen at the same time it’s not aware of the label all this to say that the logical order of operations matters and that what we want here is to actually call it level because that is the name of the column in the table and now when I run this I get a resulting number and so going back to our original point we are able to combine columns and constants with any sort of arithmetic operations another very powerful thing that SQL can do is to apply functions and a function is a prepackaged piece of logic that you can apply to our data and it works like this there is a function called sqrt which stands for square root which takes a number and computes the square root so you call the function by name and then you open round brackets and in round brackets you provide the argument and the argument can be a constant such as 16 or it can be a column such as level and when I run this you can see that in this case the square root of 16 is calculated as four and this creates a constant column and then here for each value of level we have also computed the square root there are many functions in SQL and they vary according to the data type which you provide as you remember we said that knowing the data types of columns such as distinguishing between numbers and text is important because it it allows us to know which operations we can apply and so there are functions that work only on certain data types for example here we see square root which only works on numbers but we also have text functions or string functions which only work on text one of them is upper so if I take upper and provide Guild as an argument what do you expect will happen we have created a new column where the G is shown in all uppercase so how can I remember which functions there are and how to use them the short answer is I don’t uh there are many many functions in SQL and here in the documentation you can see a very long list of all the functions that you can use in big query and as we said the functions vary according to the data that they can work on so if you look look here on the left we have array functions um date functions mathematical functions numbering functions time functions and so on and so on it is impossible to remember all of these functions so all you need to know is how to look them up when you need them for example if I know I need to work with numbers I could scroll down here and go to mathematic iCal functions and here I have a long list of all the mathematical functions and I can see them all on the right and I should be able to find the square root function that I have showed you and here the description tells me what the function does and it also provides some examples to summarize these are some of the most powerful things you can do with a select statement not only you can retrieve every column you need in any order you can rename columns according to your needs you can Define constant columns with a value that you choose you can combine columns and constant columns in all sorts of calculations and you can apply functions to do more complex work I definitely invite you to go ahead and put your own data in big query as a I’ve shown you and then start playing around with select and see how you can transform your data with it one thing worth knowing is that I can also write queries that only include select without the front part that is queries that do not reference a table let’s see how that works now after I write select I clearly cannot reference any columns because there is no table but I can still reference constant for example I could say hello one and false and if I run this I get this result so remember in SQL we always query tables and we always get back tables in this case we didn’t reference any previous table we’ve just created constants so what we have here are three columns with constant values and there is only one row in the resulting table this is useful mainly to test stuff so let’s say I wanted to make sure that the square root function does what I expect it to do so I could call it right here and uh look at the result let’s use this capability to look into the order of arithmetic operations in SQL so if I write an expression like this would you be able to compute the final result in order to do that you should be able to figure out the order in which all these operations are done and you might remember this from arithmetic in school because SQL applies the same order that is taught in school and we could Define the order as follows first you would execute any specific functions that take a number as Target and uh then you have multi multiplication and division then you have addition and subtraction and finally brackets go first so you first execute things that are within brackets so pause the video and apply these rules and see if you can figure out what this result will give us now let’s do this operation and do it in stages like we were doing in school so first of all we want to worry about what’s in the brackets right so I will now consider this bracket over here and in this bracket we have the multiplication and addition multiplication goes first so first I will execute this which will give me four and then I will have 3 + 4 + 1 which should give me 8 next I will copy the rest of the operation and here here I reach another bracket to execute what is in these brackets I need to First execute the function so this is the power function so it takes two and exponentiate it to the power of two which gives four and then 4 minus 2 will give me two and this is what we get now we can solve this line and first of all we need to execute multiplication and division in the order in which they occur so the first operation that occurs here is 4 / 2 which is 2 and I will just copy this for clarity 8 – 2 * 2 / 2 the next operation that occurs now is 2 * 2 which is 4 so that would be 8 – 4 / 2 and the next operation is 4 / 2 which is two so I will have 8 – 2 and all of these will give me a six now all of these are comments and we only have one line of code here and to see whether I was right I just need to execute this code and indeed I get six so that’s how you can use the select Clause only to test your assumptions and uh your operations and a short refresher on the order of arithmetic operations which will be important for solving certain sequal problems let us now see how the where statement works now looking at the characters table I see that there is a field which is called is alive and this field is of type Boolean that means that the value can be either true or false so if I go to the preview here and scroll to the right I can see that for some characters this is true and for others it is false now let’s say I only wanted to get those characters which are actually alive and so to write my query I would first write the address of the table which is fantasy characters next I could use the where Clause to get those rows where is a five is true and finally I could do a simple select star to get all the columns and here I see that I only get the rows where is alive is equal to true so where is effectively a tool for filtering table rows it filters them because it only keeps rows where a certain condition is true and discards all of the other rows so if you want to visualize how the wear Filter Works you can see it as a horizontal selection of certain slices of the table like in this case where I have colored all of the rows in which is alive is true now the we statement is not limited to Boolean Fields it’s not limited to columns that can only be true or false we can run the we filter on any column by making a logical statement about it for example I could ask to keep all the rows where Health number is bigger than 50 this is a logical statement Health bigger than 50 because it is either true or fals for every row and of course the wh filter will only keep those rows where this statement evaluates to true and if I run this I can see that in all of my results health will be bigger than 50 and I can also combine smaller logical statements with each other to make more complex logical statements for example I could say that I want all the rows where health is bigger than 50 and is a live is equal to true now all of this becomes one big logical statement and again this will be true or false for every row and we will only keep the rows where it is true and if I run this you will see that in the resulting table the health value is always above 50 and is alive is always true in the next lecture we will see in detail how these logical statements work and how we can combine them effectively but now let us focus on the order of operations and how the wear statement fits in there when it comes to the lexical order the order in which we write things it is pretty clear from this example first you have select then from and after from you have the WHERE statement and you have to respect this order when it comes to The Logical order you can see that the where Clause follows right after the from Clause so it is second actually in The Logical order if you think about it this makes a lot of sense because the first thing that I need to do is to get the data from where it Lees and then the first thing I want to do after that is is that I’m going to drop all the rows that I don’t need so that my table becomes actually smaller and easier to deal with there is no reason why I should carry over rows that I don’t actually need data that I don’t actually want and waste memory and processing power on it so I want to drop those unneeded rows as soon as possible and now that you know that where happens at this stage in The Logical order you can avoid many of the pitfalls that happen when you’re just learning SQL let’s see an example now take a look at this query I’m going to the fantasy characters table and then I’m getting the name and the level and then I’m defining a new column this is simply level divided by 10 and I’m calling this level scaled now let’s say that I wanted to only keep the rows that have at at least three as level scaled so I would go here and write aware filter where level scaled bigger than three and if I run this I get an error unrecognized name can you figure out why we get this error level scaled is an alas that we assign in the select stage but the we Clause occurs before the select stage so the we Clause has no way to know about this alias in other words the we Clause is at this point and our rules say that an operation can only use data produced by operations before it so the we Clause has no way of knowing about the label which is a sign at this stage so how can we solve this problem right here the solution is to not use the Alias and to instead repeat the logic of the transformation and this actually works because it turns out that when you write logical statements in the we filter you can not only reference The Columns of the tables but you can also reference operations on columns and this way of writing operations of on columns and combinations between columns works just as what we have shown in the select part so that was all you need to know to get started with the wear clause which is a powerful Clause that allows us to filter out the row that we don’t need and keep the rows that we need based on logical conditions now let’s delve a bit deeper into how exactly these logical statements work in SQL and here is a motivating example for you this is a selection from the characters table and we have a wear filter and this we filter is needlessly complicated and I did this intentionally because by the end of this lecture you should have no trouble at all interpreting this statement and figuring out for which rows it will be true and likewise you will have no problem writing complex statements yourself or deciphering them when you encounter them in the wild the way that these logical statements work is through something called Boolean algebra which is an essential theory for working with SQL but also for working with any other programming language and is indeed fundamental to the way that computers work and though the name may sound a bit scary it is really easy to understand the fundamentals of Boolean algebra now let’s look back at so-called normal algebra meaning the common form that is taught in schools in this algebra you have a bunch of elements which in this case I’m only showing a few positive numbers such as 0 25 100 you also have operators that act on these elements for example the square root symbol the plus sign the minus sign the division sign or the multiplication sign and finally you have operations right so in operations you apply The Operators to your elements and then you get some new elements out of them so here are two different types of operation in one case we take this operator the square root and we apply it to a single element and out of this we get another element in the second kind of operation we use this operator the plus sign to actually combine two elements and again we get another element in return Boolean algebra is actually very similar except that it’s simpler in a way because you can only have two elements either true or false those are all the elements that you are working with and of course this is why when there’s a Boolean field in SQL it is a column that can only have these two values which are true and false now just like normal algebra Boolean algebra has several operators that we can use to transform the elements and for now we will only focus on the three most important ones which are not and and or and finally in Boolean algebra we also have operations and in operations we combine operators and elements and get back elements now we need to understand how these operators work so let us start with the not operator to figure out how a Boolean operator works we have to look at something that’s called a truth table so let me look up the truth table for the not operator and in this Wikipedia article this is available here at logical negation now first of all we see that logical negation is an operation on one logical value what does this mean it means that the not operator works on a single element such as not true or not false and this this is similar to the square root operator in algebra that works on a single element a single number next we can see how exactly this works so given an element that we call P and of course P can only be true or false the negation of p is simply the opposite value so not true is false and not false is true and we can easily test this in our SQL code so if I say select not true what do you expect to get we get false and if I do select not false I will of course get true next let’s see how the end operator works so we’ve seen that the not operator works on a single element on the other hand the end operator connects two elements such as writing true and false and in this sense the end operator is more similar to the plus sign here which is connecting two elements so what is the result of true and false to figure this out we have to go back to our truth tables and I can see here at The Logical conjunction function section which is another word for the end operator now the end operator combines two elements and each element can either be true or false so this creates four combinations that we see here in this table and what we see here is that only if both elements are true then the end operator will return true in any other case it will return false so going back here if I select true and false what do you expect to see I am going to get false and it’s only in the case when I do true and true that the result here will be true and finally we can look at the or operator which is also known as a logical disjunction it’s also combining two elements it also has four combinations but in this case if at least one of the two elements is true then you get true and only if both elements are false then you get false and so going back to our SQL true or true will of course be true but but even if one of them is false we will still get true and only if both are false we will get false so now you know how the three most important operators in Boolean algebra work now the next step is to be able to solve long and complex Expressions such as this one and you already know how operators work the only information you’re missing is the order of operations and just like in arithmetic we have an agreed upon order of operations that helps us solve complex expressions and the Order of Operations is written here first you solve for not then you solve for and and finally for or and as with arithmetic you first solve for the brackets so let’s see how that works in practice let us now simplify this expression so the first thing I want to do is to deal with the brackets so if I copy all of this part over here as a comment so it doesn’t run as code you will see that this is the most nested bracket the innermost bracket in our expression and we have to solve for this so what is true or true this is true right and now I can copy the rest of my EXP expression up to here and here I can solve the innermost bracket as well so I can say true and what I have here is false and true so this is false right because when you have end both of them need to be true for you to return true otherwise it’s false so I will write false moving on to the next line I need to solve what’s in the bracket so I can copy the knot and now I have to solve what’s in this bracket over here now there are several operators here but we have seen that not has the Precedence right so I will copy true and here I have not false which becomes true and then I can copy the last of the bracket I’m not going to do any more at this step to avoid confusion and then I have or and I can solve for this bracket over here and true and false is actually false moving on I can keep working on my bracket and so I have a lot of operations here but I need to give precedence to the ends so the first end that occurs is this one and that means I have to start with this expression over here true and and true results in true and then moving on I will copy the or over here and now I have another end which means that I have to isolate this expression false and true results in false and finally I can copy the final end because I’m not able to compute it yet because I needed to compute the left side and I can copy the remaining part as well moving on to the next line um I need to still do the end because the end takes precedence and so this is the expression that I have to compute so I will say true or and then this expression false and true computes to false and then copy the rest now let me make some rul over here and go to the next line and I can finally compute this bracket we have true or false which we know is true next I need to invert this value because I have not true which is false and then I have or false and finally this computes to false and now for the Moment of Truth F intended I can run my code and see if the result actually corresponds to what we got and the result is false so in short this is how you can solve complex expressions in Boolean algebra you just need to understand how these three operators work and you can use truth tables like like this one over here to help you with that and then you need to remember to respect the order of operations and then if you proceed step by step you will have no problem solving this but now let’s go back to the query with which we started because what we have here is a complex logical statement that is plugged into the wear filter and it isolates only certain rows and we want to understand exactly how this statement works so let us apply what we’ve just learned about Boolean algebra to decipher this statement now what I’ve done here is to take the first row of our results which you see here and just copi the values in a comment and then I’ve taken our logical statement and copied it here as well so let us see what SQL does when it checks for this Row the first thing that we need to do is to take all of these statements in our wear filter and convert them to true or false and to do that we have to look at our data let us start with the first component which is level bigger than 20 so for the row that we are considering level is 12 so this comes out as false next I will copy this end and here we have is alive equals true now for our row is alive equals false so this statement computes as false Mentor ID is not null with null representing absence of data in our case Mentor ID is one so it is indeed not null so here we have true and finally what we have in here is class in Mage Archer so we have not seen this before but it should be pretty intuitive this is a membership test this is looking at class which in this case is Hobbit and checking whether it can be found in this list and in our case this is now false so now that we’ve plugged in all the values for our row what we have here is a classic Boolean algebra expression and we are able to solve this based on what we’ve learned so let us go and solve this and first I need to deal with the brackets and what I have here I have an end and an or and the end TR takes precedence so false and false is false and I will copy the rest and here I have not false which is true next we have false or true which is true and true and in the end this computes to true now in this case we sort of knew that the result was meant to come out as true because we started from a row that survived the wear filter and that means that for this particular row this statement had to compute as true but it’s still good to know exactly how SQL has computed this and understand exactly what’s going on and this is how SQL deals with complex logical statements for each row it looks at the relevant values in the row so that it can convert the statement to a Boolean algebra expression and then it uses the Boolean algebra rules to compute a final result which is either true or false and then if this computes as true for the row then the row is kept and otherwise the row is discarded and this is great to know because this way of resoling solving logical statements applies not only to the word component but to all components in SQL which use logical statements and which we shall see in this course let us now look at the distinct clause which allows me to remove duplicate rows so let’s say that I wanted to examine the class column in my data so I could simply select it and check out the results so what if I simply wanted to see all the unique types of class that I have in my data this is where distinct comes in handy if I write distinct here I will see that there are only four unique classes in my data now what if I was interested in the combinations between class and guilt in my data so let me remove the distinct from now and add guilt here and for us to better understand the results I’m going to add an ordering and here are the combinations of class and Guild in my data there is a character who is an Archer and belongs to Gondor and there are actually two characters who are archers and belong belong to mirkwood and there are many Hobbits from sholk and so on but again what if I was interested in the unique combinations of class and Guild in my data I could add the distinct keyword here and as you can see there are no more repetitions here Archer and merkwood occurs only once Hobbit and Shar f occurs only once because I’m only looking at unique combinations and of course I could go on and on and add more columns and expand the results to show the unique combinations between these columns so here Hobbit and sherol has expanded again because some Hobbits are alive and others unfortunately are not at the limit I could have a star here and what I would get back is actually my whole data all the 15 rows because what we’re doing here is looking at rows that have the same value on all columns rows that are complete duplicates and there are no such rows in the data so when I do select star in this case distinct has no effect so in short how distinct works it looks at the columns that you’ve selected only those which you have selected and then it looks at all the rows and two rows are duplicate if they have the exact same values on every column that you have selected and then duplicate rows are removed and only unique values are preserved so just like the wear filter the distinct is a clause that removes certain rows but it is more strict and less flexible in a sense it only want does one job and that job is to remove duplicate rows based on your selection and if we look at our map of SQL operations we can place distinct it occurs right after select right and and this makes sense because we have seen that distinct Works only on the columns that you have selected and so it has to wait for select to choose the columns that we’re interested in and then we can D duplicate based on those for the following lecture on unions I wanted to have a very clear example so I decided to go to the characters table and split it in two and create two new tables out of it and then I thought that I should show you how I’m doing this because it’s a pretty neat thing to know and it will help you when you are working with SQL in bigquery so here’s a short primer on yet another way to create a table in bigquery you can use your newly acquired power of writing cql queries to turn those queries into permanent tables so here’s how you can do it first I’ve written a simple query here and you should have no trouble understanding it by now go to the fantasy characters table keep only rows where is alive is true and then get all the columns next we need to choose where the new table will live and how it will be called so I’m placing it also in the fantasy data set and I’m calling it characters alive and finally I have a simple command which is create table now what you see here is a single statement in SQL it’s a single command that will create the table and you can have in fact multiple statements within the same code and you can run all the statements together when you hit run the trick is to separate all of them with this semicolon over here the semicolon tell SQL hey this command over here is over and and uh next I might add another one so here we have the second statement that we’re going to run and this looks just like the one above except that our query has changed because we’re getting rows where is alive is false and then we are calling these table characters dead so I have my two statements they’re separated by semicolons and I can just hit run and I will see over here that bigquery is showing me the two statements on two different rows and you can see that they are both done now so if I open my Explorer over here I will see that I have two new tables characters alive and characters dead and if I go here for characters alive is alive will of course be true on every row now what do you think would happen if I ran this script again let’s try it so I get an error the error says that the table already exists and this makes sense because I’ve told SQL to create a table but SQL says that table already exists I cannot create it again so there are ways that we can tell SQL what to do if the table already exists again so that we specify the behavior we want and we are not going to just get an error one way is to say create or replace table fantasy characters alive and what this will do is that if the table already exists uh big query will delete it and then create it again or in other words it will overwrite the data so let’s write it down to and let’s make sure that this query actually works so when I run this I will get no errors even if the table already existed because bigquery was able to remove the previous table and create a new one alternatively we may want to create the table only if it doesn’t exist yet and leave it untouched otherwise so in that case we could say create table if not exists so what this will do is that if this table is already existing big query won’t touch it and it won’t throw an error but if it doesn’t exist it will create it so let us write it down two and make sure that this query runs without errors and we see that also here we get no errors and that in short is how you can save the results of your queries in big query and make them into full-fledged tables that you can save and and create query at will and I think this is a really useful feature if you’re analyzing data in big query because any results of your queries that you would like to keep you can just save them and then come back and find them later let’s learn about unions now to show you how this works I have taken our characters table and I have split it into two parts and I believe the name is quite self descriptive there is a separate table now for characters who are alive and a separate table for characters who are dead and you can look at the previous lecture to see how I’ve done this how I’ve used a query to create two new tables but this is exactly the characters table with you know the same schema the same columns the same times is just split in two based on the E alive column now now let us imagine that we do not have the fantasy. characters table anymore we do not have the table with all the characters because it was deleted or we never had it in the first place and let’s pretend that we only have these two tables now characters alive and characters dead and we want to reconstruct the characters table out of it we want to create a table with all the characters how can we do that now what I have here are two simple queries select star from fantasy characters alive and select star from fantasy characters dead so these are two separate queries but actually in big query there are ways to run multiple queries at the same time so I’m going to show you first how to do that now an easy way to do that is to write your queries and then add a semicolon at the end and so what you have here is basically a SQL script which contains multiple SQL statements in this case two and if you hit run all of these will be executed sequentially and when you look at the results so you’re not just getting a table anymore because it’s not just a single query that has been executed but you can see that there have been two commands uh that have been executed which are here and then for each of those two you can simply click View results and you will get to the familiar results tab for that and if I want to see the other one I will click on the back arrow here and click on the other view results and then I can see the other one another way to handle this is that I can select the query that I’m interested in and then click run and here I see the results so big query has only executed the part that I have selected or I can decide to run the other query in my script select it click run and then I will see the results for that query and this is a pretty handy functionality in big query it’s also functionality that might give you some headaches if you don’t know about it because if for some reason you selected a part of the code uh during your work and then you just want to run everything you might hit run and get an error here because B queer is only seeing the part that you selected and cannot make sense of it so it’s good to know about this but our problem has not been solved yet because remember we want to reconstruct the characters table and what we have here are two queries and we can run them separately and we can look at the results separately but we still don’t have a single table with all the results and this is where Union comes into play Union allows me to stack the results from these two tables so so if I take first I will take off the semic columns because this will become a single statement and then in between these two queries I will write Union distinct and when I run this you can verify for yourself we have 15 rows and we have indeed reconstructed the characters table so what exactly is going on here well it’s actually pretty simple SQL is taking all of the rows from this first query and then all of the rows for the second query and then it’s stacking them on top of each other so you can really imagine the act of horizontally stacking a table on top of the other to create a new table which contains all of the rows of these two queries combined and that in short is what union does now there are a few details that we need to know when working with Union and to figure them out let us look at a toy example so I’ve created two very simple tables toy one and toy two and you can see how they look in these comments over here they all have three columns which are called imaginatively call One Call two call three and then this is the uh Toy one table and then this is the toy 2 table now just like before we can combine this table tabls by selecting all of them and then writing a union in between them now in B query you’re not allow to write Union without the further qualifier a keyword and it has to be either all or distinct so you have to choose one of these two and what is the choice about well if you do Union all you will get all of the rows that are in the first table and those that are in the second table regardless of whether they are duplicate okay but with Union distinct you will get again all of the rows from the two tables but you will only consider unique rows you will not get any duplicates now we can see that these two table share a column which is actually identical one through yes over here and the same row over here now if I write Union all I expect the result to include this row twice so let us verify that and you can see that here you have one true yes and at the end you also have one true yes and in total you get four rows which are all the rows in the two tables however if I do Union distinct I expect to get three rows and I expect this row to appear only once and not to be duplicated again you need to make sure you’re not selecting any little part of your script before you run it so the whole script will be run and as you can see we have three rows and there are no duplicates now it’s interesting that big query actually forces you to choose between all or distinct because in many SQL systems for your information you are able to write Union without any qualifier and in that case it means Union distinct so in other SQL systems when you write Union it is understood that you want Union distinct and if you actually want to keep the duplicate rows you will explicitly write Union all but in big query you always have to explicitly say whether you want Union all or Union distinct now the reason this command is called Union and not like stack or or something else is is that this is a set terminology right this comes from the mathematical theory of sets which you might remember from school and the idea is that a table is simply a set of rows so this table over here is a set of two rows and this table over here is a set of two rows and once you have two sets you can do various set operations between them and the most common operation that we do in SQL is unioning and unioning means combining the values of two sets so you might remember from school the V diagram which is a typical way to visualize the relations between sets so in this simple vent diagram we have two circles A and B which represent two sets and in our case a represents the collection of rows in the first table and B represents the all the rows that are in the second table so what does it mean to Union these sets it means taking all of the elements that are in both sets so taking all of the rows that are in both tables and what is the difference here between union distinct and Union all where you can see that the rows of a are this part over here plus this part over here and the rows of B are this part over here plus this part over here and so when we combine them we’re actually counting the intersection twice we are counting this part twice and so what do you do with this double counting do you keep it or do you discard it if you do Union all you will keep it so rows that are in common between A and B will duplicate you will see them twice twice but if you do Union distinct you will discard it and so um you won’t have any duplicates in the results so that’s one way to think about it in terms of sets but we also know that Union is not the only set operation right there are other set operations a very popular one is the intersect operation now the intersect looks like this right it it says take only the El elements that are in common between these two sets so can we do that in SQL can we say give me only the rows that are in common between the two tables and the answer is yes we can do this and if we go back here we can instead of Union write intersect and then distinct and what do you expect to see after I run this command take a minute to think about it so what I expect to see is to get only the rows that are shared between the two tables now there is one row which is shared between these two tables which is uh the one true yes row which we have seen and if I run this I will get exactly this row so intersect distinct gives me the rows that are shared between the two tables and I have to write intersect distinct I cannot write intersect all because actually doesn’t mean anything so it’s not going to work and here’s another set operation which you might consider which is subtraction so what if I told you give me all of the elements in a except the elements that a shares with B so what would that look on the drawing it would look like this right so this is taking all of the elements that are in a except these ones over here because they are in a but they’re also in B and I don’t want the elements shared with b and yes I can also do that in squl I can come here and I could say give me everything from Toy one except distinct everything from Toy two and what this means is that I want to get all of my rows from Toy one except the rows that are shared with toy two so what do you expect to see when I run this let’s hit run and I expect to see only this row over here because this other row is actually shared with b and this is what I get again you have to write accept distinct you cannot write accept all because it’s actually actually doesn’t mean anything and keep in mind that unlike the previous two operations which are union and distinct the accept operation is not symmetric right so if I swap the tables over here I actually expect to get a different result right I expect to see this row over here selected because I’m saying give me everything from this table uh Toy 2 except the rows that are shared with toy one so so let us run this and make sure and in fact I get the three through uh maybe row so careful that the accept operation is not symmetric the order in which you put the two tables matters so that was a short overview of Union intersect except and I will link this here which is the bigquery documentation on this and you can see that they’re actually called set operators in fact in real life you almost always see Union very rarely you will see somebody using intersect or accept a lot of people also don’t know about them but I think it’s worth it that we briefly looked at all three and it’s especially good for you to get used to thinking about tables as sets of rows and thinking about SQL operations in terms of set set operations and that will also come in handy when we study joints but let us quickly go back to our toy example and there are two essential prerequisites for you to be able to do a union or any type of sort operations number one the tables must have the same number of columns and number two the columns must have the same same data type so as you can see here we are combining toy 2 and toy 1 and both of them have three columns and the First Column is an integer the second is a Boolean and the third is a string in both tables and this is how we are able to combine them so what would happen if I went to the first table and I got only the first two columns and then I tried to combine it you guessed it I would get an error because I have a mismatched column count so if I want to select only the first two columns in a table I need to select only the first two columns in another table and then the union will work now what would happen if I messed up the order of the columns so let’s say that here I will select uh column one and column 3 and here I will select column one and column two let me run this and I will get an error because of incompatible types string and bull so what’s happening here is that SQL is trying to get the values of call three over here and put it into call two over here and it’s trying to get a string and put it into a Boolean column and that simply doesn’t work because as you know SQL enforces streak Types on columns and so this will not work but of course I could select call three in here as well and now again we will have a string column going into a string column and of course this will work so so to summarize you can Union or intersect or accept any two tables as long as they have the same number of columns and the columns have the same data types let us now illustrate a union with a more concrete example so we have our items table here and our characters table here so the items table repres represents like magical items right while the characters table we’re familiar with it represents actual characters so let’s say that you are managing a video game and someone asks you for a single table that contains all of the entities in that video game right and the entities include both characters and items so you want to create a table which combines these two tables into one we know we can use Union to do that we know we can use Union to stack all the rows but we cannot directly Union these two tables be because they have a different schema right they have a different number of columns and then those columns have different data types but let’s analyze what these two tables have in common and how we could maybe combine that so first of all they both have an ID and in both cases it’s an integer so that’s already pretty good they both have a name and in both cases the name is a string so we can combine that as as well the item type can be thought of being similar to the class and then each item has a level of power which is expressed as an integer and each character has a level of experience which is expressed as an integer and you can think that they are kind of similar and then finally we have a timestamp field representing a moment in time for both columns which are date added and last active so looking at this columns that the two have sort of in common we can find a way to combine them and here’s how we can translate this into SQL right so I’m went to the fantasy items table and I selected The Columns that I wanted and then I went to the characters table and I selected the columns that I wanted to combine with those um in in the right order so we have ID with ID name with name class with item type level with power and last active with date added so I have my columns they’re in the right order I wrote Union distinct and if I run this you will see that I have successfully combined the rows from these two tables by finding out which columns they have in common and then writing them in the right order and then adding Union distinct now all the columns that we’ve chosen for the combination have the same type but what would happen if I wanted to combine two columns that are not actually the same type so let’s say what if we wanted to combine Rarity which is a string with experience which is an integer as you know I cannot do this directly but I can go around it by either taking Rarity and turning it into an integer or taking um experience and turning it into a string I just have to make sure that they both have the same data type now the easiest way is usually to take um any other data type and turn it into a string because we you just turn it into text so let’s say that for the sake of this demonstration we will take integer experience which is an integer and turn it into a string which is text and then combine that with Rarity so I will go back to my code and I will make some room over here and here in items I will add Rarity and here in characters I will add experience and you can see that I already get an error here saying that the union distinct has incompatible types just like expected so what I want to do here is to take experience and turn it into string and I can do that with the cast function so I can do cast experience as string and what this will do is basically take these values and convert them to string and if I run this you can see that this has worked so we combined two tables into one and now the result is a single table it has a column called Rarity the reason it’s called Rarity is that um it’s it’s taking the name from the first table in the in the operation but we could of course rename it to whatever we need and this is now a text column because we have combined a text column with also a text column thanks to the casting function so what we see here are a bunch of numbers which came originally from The Experience uh column from the character table but they’re now converted to text and if I scroll down then I will also see the original values of Rarity from the items table finally let us examine Union in the context of The Logical order of SQL operations so you can see here that we have our logical map but it looks a bit different than usual and the reason it’s different is that we are considering what happens when you un two tables and here the blue represents one table and the red represents the other table so I wanted to show you that all of the ordering that we have seen until now so first get the table then use the filter with where then select the columns you want and if you want use this thing to remove duplicates all of these happens in the same order separately for the two tables that you are unioning and this applies to all of the other operations like joining and grouping which we will see um later in the course so at first the two tables are working on two separate tracks and SQL is doing all this operations on them in this specific order and only at the end of all this only after all of these operations have run then we have the union and in the Union these two tables are combined into one and only after that only after the tables have been combined into one you apply the last two operations which are order by and limit and actually nothing forces you to combine only two tables you could actually have any number of tables that you are combining in Union but then the logic doesn’t change at all all of these operations will happen separately for each of the tables and then only when all of these operations are done only when all of the tables are ready then they will be combined into one and if you think about it it makes a lot of sense because first of all you need the select to have run in order to know what is the schema of the tables that you are combining and then you also also need to know if distinct has run on each uh table because you need to know which rows you need to combine in the union and that is all you need to know to get started with Union this very powerful statement that allows us to combine rows from different tables let us now look at order by so I’m looking at the characters table here and as you can see we have an ID column that goes from one to 15 which assigns an ID to every character but you will see that the IDS don’t appear in any particular order and in fact this is a general rule for SQL there is absolutely no order guarantee for your data your data is not stored in any specific order and your data is not going to be returned in any specific order and the reason for this is fun fundamentally one of efficiency because if we had to always make sure that our data was perfectly ordered that would add a lot of work it would add a lot of overhead to the engine that makes the queries work and uh there’s really no reason to do this however we do often want to order our data when we are querying it we want to order the way that it is displayed and this is why the order by clause is here so let us see how it works I am selecting everything from fantasy characters and again I’m going to get the results in no particular order but let’s say I wanted to see them in uh ordered by name so then I would do order by name and as you can see the rows are now ordered alphabetically according to the name I could also invert the order by writing desk which stands for descending and that means U descending alphabetical order which means from the last letter in the alphabet to the first I can of course also order by number columns such as level and we would see that the level is increasing here and of course that could also be descending to to go in the opposite direction and the corresponding keyword here is ask which stands for ascending and this is actually the default Behavior so even if you omit this you will get the same going from the smallest to the largest I can also order by multiple columns so I could say order by class and then level and what that looks like is that first of all the rows are ordered by class so as you can see this is done alphabetically so first Archer and then the last is Warrior and then within each class the values within the class are ordered according to the level going from the smallest level to the biggest level and I can invert the order of one of them for example class and in this case we will start with Warriors and then within the warrior class we will still will order the level in ascending order so I can for every column uh that’s in the ordering I can decide whether that ordering is in ascending order or descending order now let us remove this and select the name and the class and once again I get my rows in no particular order and I’m seeing the name and the class so I wanted to show you that you can also order by columns which you have not selected Ed so I could order these elements by level even though I’m not looking at at level and it will work all the same and finally I can also order by operations so I could say take level divide it by experience and then multiply that by two for some reason and it would also work in the order ordering even though I am not seeing that calculation that calculation is being done in the background and used for the ordering so I could actually take this here and copy it create a new column call it calc for calculation and if I show you this you will see the results are not uh very meaningful but you will see that they are in ascending order so we have ordered by that and sometimes you will see this notation over here order by 21 for example and as you can see what we’ve done here is that we’ve ordered by class first of all because we starting with archers and going to Warriors and then within each class we are ordering by name uh also in ascending order so this is basically referring to the columns that are referenced in the select two means order by the second column which you have referenced which in this case is class and one means order by the First Column that you referenced so it’s basically a shortcut that people sometimes use to avoid rewriting the names of columns that they have selected and finally when we go back to the order of operations we can see that order bu is happening really at the end of all of this process so as you will recall I have created this diagram that’s a bit more complex to show show what happens when we Union different tables together what happens is that basically all these operations they run independently on each table and then finally the tables get uh unioned together and after all of this is done SQL knows the final list of rows that we will include in our results and that’s the right moment to order those rows it would not be possible to do that before so it makes sense that order is located here let us now look at the limit Clause so what I have here is a simple query it goes to the characters table it filters for the rows where the character is alive and then it gets three columns out of this so let’s run this query and you can see that this query returns 11 rows now let us say that I only wanted to see five of those rows and this is where limit comes into place limit will look at the final results and then pick five rows out of those results reducing the size of my output and here you can see that we get five rows now as we said in the lecture of ordering by default there is no guarantee of order in a SQL system so when you are getting all your data with a query and then you run limit five on top of it you have no way of kn knowing which of the rows will be selected to fit amongst those five you’re basically saying that you’re okay with getting any five of all of the rows from your result because of this people often will use limit in combination with order by for example I could say order by level and then limit five and what I would get here is essenti the first five most inexperienced characters in my data set and let us say that you have a problem of finding the least experienced character in your data the character with the lowest level so of course you could say order by level and then limit one and you would get the character with the lowest level right and this works however it is not ideal there is a problem with this solution so can you figure out what the problem with this solution is the problem will be obvious once I go back to limit 5 and I look here and I see that I actually have two characters which have the lowest level in my data set so in theory I should be able to return both of them because they both have the lowest level however when I write limit one it simply cuts the rows in my output and it is unaware of that uh further information that is here in this second row and in the further lectures we will see how we can solve this better and get results which are more precise and if we look at The Logical order of operations we can see that limit is the very last operation and so all of the logic of our query is executed all our data is computed and then based on that final result we sometimes decide to not output all of it but to Output a limited number of rows so a common mistake for someone who is starting with SQL is thinking that they can use limit in order to have a cheaper query for example you could say oh this is a really large table this table has two terabytes of data it would cost a lot to scan the whole table so I will say select star but then I will put limit 20 because I only want to see the first 20 rows and that will means that I will only scan 20 rows and my query will be very cheap right no that is actually wrong that doesn’t save you anything and you can understand this if you look at the map because all of the logic is going to execute before you get to limit so you’re going to scan the whole table when you say select star and you’re going to apply all of the logic and the limit is actually just changing the way your result is displayed it’s not actually changing the way the your result is computed if you did want to write your query so that it scans less rows one thing you should do is focus on the where statement actually because the where statement is the one that runs in the beginning right after getting the table and it is able to actually eliminate rows which usually saves you on computation and money and so on however I do need to say that there are systems where writing limit may actually turn into savings because different systems are optimized in different ways and um allow you to do different things with the commands but as a rule usually with SQL limit is just changing the way your result is displayed and doesn’t actually change anything in the logic of execution let us now look at the case clause which allows us to apply conditional logic in SQL so you can see here a simple query I am getting the data from the characters table I am filtering it so that we only look at characters who are alive and then for each character we’re getting the name and the level now when you have a column that contains numbers such as level one typical thing that you do in data analysis is bucketing and bucketing basically means that I look at all these multiple values that level can have and and I reduce them to a smaller number of values so that whoever looks at the data can make sense of it uh more easily now the simplest form of bucketing that you can have is the one that has only two buckets right so looking at level our two buckets for example could be uh in one bucket we put values that are equal or bigger than 20 so characters who have a level that’s at least 20 and in the other bucket we put all the characters that have a level that is less than 20 for example now how could I Define those two buckets so we know that we can Define new columns in the select statement and that we can use calculations and logical statements to define those columns so one thing that I could do would be to go here and then write level bigger than bigger or equal than 20 and then call this new column level at least 20 for example and when I run this I get my column now of course this is a logical statement and for each row this will be true or false and then you can see that our new column here gives us true or false on every column and this is a really basic form of bucketing because it allows us to take you know level has basically 11 different values in our data and it can be complicated to look at this many values at once and now we’ve taken these 11 values and reduced them to two uh to two buckets so that we have um organized our data better and it’s easier to read but there are two limitations with this approach one I might not want to call my buckets true or false I might want to give more informative names to my buckets such as experienced or inexperienced for example the other limitation is that with this approach I can effectively only divide my data in two buckets because once I write a logical statement it’s either either true or false so my data gets divided in two but often it’s the case that I want to use multiple buckets for my use case now bucketing is a typical use case for the case when statement so let’s see it in action now so let me first write a comment not any actual code where I Define what I want to do and then I will do it with the code so I have written here the buckets that I want to use to classify the characters level so up to 15 they are considered low experience between 15 and 25 they are considered mid and anything above 25 we will classify as super now let us apply the case Clause to make this work so the case Clause Is Always bookended by these two parts case and end so it starts with case it ends with end and a typical error when you’re getting started is to forget about the end part so my recommendation is to always start by writing both of these and then going in the middle to write the rest now in the middle we’re going to Define all the conditions that we’re interested in and each condition starts with the keyword when and is Then followed by a logical condition so our logical condition here is level smaller than 15 now we have to Define what to do when this condition is true and it follows with the keyword then and when this condition is true we want to return the value low which is a string a piece of text that says low next we proceed with the following condition so when level is bigger and equal to 15 and level is lower than 25 so if you have trouble understanding this logical statement I suggest you go back to the lecture about Boolean algebra but what we have here there are two micro statements right Level under 25 and level equal or bigger than 15 they are conect connected by end which means that both of these statements have to be true in order for the whole statement to be true which is what we want in this case right and what do we want to return in this case we will return the value mid and the last condition that we want to apply when level is bigger or equal than 25 then we will return super now all of this that you see here this is the case Clause right or the case statement and all of this is basically defining a new column in my table and given that it’s a new column I can use the alas sync to also give it a name and I can call this level bucket now let’s run this and see what we get and as you can see we have our level bucket and the characters that are above 25 are super and then we have a few Ms and then everyone who’s under 15 is low so we got the results we wanted and now let us see exactly how the case statement works so I’m going to take Gandalf over here and he has level 30 so I’m going to write over here level equals 30 because we’re looking at the first low row and that is the value of level and then I’m going to take the conditions for the case statement that we are examining and add them here as a comment now because in our first row level equals 30 I’m going to take the value and substitute it here for level now what we have here is a sequence of logical statements and we have seen how to work with these logical statements in the lecture on Boolean algebra now our job is to go through each of these logical statements in turn and evaluate them and then as soon as we find one that’s true we will stop so the first one is 30 smaller than 50 now this is false so we continue the second one is a more complex statement we have 30 greater or equal to 15 which is actually true and 30 Oops I did not substitute it there but I will do it now and 30 smaller than 25 which is false and we know from our Boolean algebra that true and false evaluates to false therefore the second statement is also false so we continue and now we have 30 greater or equal than 25 which is true so we finally found a line which evaluates as true and that means that we return the value super and as you can see for Gandalf we have indeed gotten the value super let us look very quickly at one more example we get Legolas which is level 22 and so I will once again copy this whole thing and comment it and I will substitute 22 for every value of level cuz that’s the row we’re looking at and then looking at the first row 22 small than 15 is false so we proceed and then looking at the second row 22 bigger than 15 is true and 22 smaller than 25 is also true so we get true and true which evaluates to true and so we return mid and then looking at Legolas we get mid so this is how the case when statement Works in short for each row you insert the values that correspond to your Row in this case the value of level and then you evaluate each of these logical conditions in turn and as soon as one of them returns true then you return the value that corresponds to that condition and then you move on to the next row now I will clean this up a bit and now looking at this statement now and knowing what we know about the way way it works can we think of a way to optimize it to make it nicer to remove redundancies think about it for a minute now one thing we could do to improve it is to remove this little bit over here because if you think about it this part that I have highlighted is making sure that the character is not under 15 so that it can be classified as meat but actually we already have the first condition that makes sure that if the character is under 15 then the statement will output low and then move on so if the character is under 15 we will never end up in the second statement but if we do end up in the second statement we already know that the character is not under 15 this is due to the fact that case when proceeds condition by condition and exits as soon as the condition is true so effectively I can remove this part over here and then at the second condition only make sure that the level is below 25 and you will see if you run this that our bucketing system works just the same and the other Improvement that I can add is to replace this last line with an else CL Clause so the else Clause takes care of all the cases that did not meet any of the conditions that we specified so the case statement will go condition by condition and look for a condition that’s true but in the end if none of the conditions were true it will return what the else Clause says so it’s like a fallback for the cases when none of our conditions turned out to be true and if you look at our logic you will see that if this has returned false and this has returned false all that’s left is characters that have a level which is either 25 or bigger than 25 so it is sufficient to use an else and to call those super and if I run this you will see that our bucketing works just the same for example Gandalf is still marked as super because in the case of Gandalf this condition has returned false and this condition has returned false and so the else output has been written there now what do you think would happen if I completely removed the else what do you think would happen if I only had two conditions but it can be the the case that none of them is true what will SQL do in that case let us try it and see what happens so the typical response in SQL when it doesn’t know what to do is to select the null value right and if you think about it it makes sense because we have specified what happens when level is below 15 and when level is is below 25 but none of these are true and we haven’t specified what we want to do when none of these are true and because we have been silent on this issue SQL has no choice but to put a null value in there so this is practically equivalent to saying else null this is the default behavior for SQL when you don’t specify an else Clause now like every other piece of SQL the case statement is quite flexible for instance you are not forced to always create a text column out of it you can also create an integer column so you could Define a simpler leveling system for your characters by using one and two else three for the higher level characters and uh this of course will also work as you can see here however one thing that you cannot do is to mix types right because what this does is that it results in one column in a new column and as you know in SQL you’re not allowed to mix types between columns so always keep it consistent when it comes to typing and then when it comes to writing the when condition all the computational power of SQL is available so you can reference columns that you are not selecting you can run calculations as I am doing here and you can change logical statements right Boolean statements in complex ways you can really do anything you want although I generally suggest to keep it as simple as possible for your sake and the sake of the people who use your code and that is really all you need to know to get started with the case statement to summarize the case statement allows us to define a new columns whose values are changing conditional on the other values of my row this is also called conditional logic which means that we consider several conditions and then we do have different behaviors based on which condition is true and the way it works is that in the select statement when you are mentioning all your columns you create a new column which in our case is this one and you bookend it with a case and end and then between those you write your actual conditions so every condition starts with a when is followed by a logical statement which needs to evaluate to true or false and then has the keyword then and then a value and then the case when statement will go through each of these conditions in turn and as soon as one of them evaluates to true you will output the value that you have specified if none of the conditions evaluate to true then it will output the value that you specify in the else keyword and if the lse keyword is missing it will output null and so this is what you need to use the case statement and then experience and exercise and coding challenges will teach you when it’s the case to use it pun intended now where does the case statement fit in our logical order of SQL operations and the short answer is that it is defined here at the step when you are selecting your columns that’s when you can use the case when statement to create a new column that applies your conditional logic and this is the same as what we’ve shown in the lecture on SQL calculations you you can use select statement not only to get columns which already exist but to Define new columns based on calculations and logic now let us talk about aggregations which are really a staple of any sort of data analysis and an aggregation is a function that takes any number of values and compresses them down to a single informative value so I’m looking here at at my usual characters table but this is the version that I have in Google Sheets and as you know we have this level column which contains the level of each character and if I select this column in Google Sheets you will see that in the bottom right corner I can see here a number of aggregations on this column and like I said no matter how many values there are in the level columns I can use aggregations to compress them to one value and here you see some of the most important aggregations that you will work with some simply adding up all values together the average which is doing the sum and then dividing by the number of values the minimum value the maximum the count and the count numbers which is the same here so these are basically summaries of my column and you can imagine in cases where where you have thousands or millions of values how useful these aggregations can be for you to understand your data now here’s how I can get the exact same result in SQL I simply need to use the functions that SQL provides for this purpose so as you can see here I’m asking for the sum average minimum maximum and count of the column level and you can see the same results down here now now of course I could also give names to this column for example I could take this one and call it max level and in the result I will get a more informative column name and I can do the same for all columns now of course I can run aggregations on any columns that I want for example I could also get the maximum of experience and call this Max experience and I can also run aggregations on calculations that involve multiple columns as well as constants so everything we’ve seen about applying arithmetic and logic in SQL also applies now of course looking at the characters table we know that our columns have different data types and the behavior of the aggregate functions also is sensitive to the data types of the columns for example let us look at the many text columns that we have such as class now clearly not all of the aggregate functions that we’ve seen will work on class because how would you take the average of these values it’s not possible right however there are some aggregate functions that also work on strings so here’s an example of aggregate functions that we can run on a string column such as class first we have count which simply counts the total number of non null values and I will give you a bit more detail about the count functions soon then we have minimum and maximum now the way that strings are ordered in SQL is something called lexicographic order which is basically a fancy word for alphabetical order and basically you can see here that for minimum we get the text value that occurs earlier in uh alphabetical order whereas Warrior occurs last and finally here’s an interesting one called string EG and what this does is that this is a function that actually takes two arguments the first argument as usual is the name of the column and the second argument is a separator and what this outputs is now a single string a single piece of text where all of the other pieces of text have been glued together and then separated by this character that we specified over here which in our case is a comma Now if you go to the Google documentation you will find an extensive list of all the aggregate functions that you can use in Google SQL and this includes the ones that we’ve just seen such as average or Max as well as a few others that we will not explore in detail here so let us select one of them such as average and see what the description looks like now you can see that this function Returns the average of all values that are not null and don’t worry about this expression in an aggregated group for now just think about this as meaning all the values that you provide to the function all the values in the column now there is a bit about window functions which we will see later and here there are in the caveat section there are some interesting edge cases for example what happens if you use average on an empty group or if all values are null in that case it returns null and so on you could see what the function does when it finds these edge cases and here is perhaps the most important section which is supported argument types and this tells you what type of columns you can use this aggregation function on so you can see that you can use average on any numeric input type right any column that contains some kind of number and also on interval and interval we haven’t examined it in detail but this is actually a data type that specifies a certain span of time so interval could express something like 2 hours or 4 days or 3 months it is a quantity of time and finally in this table returned data types you can see what the average function will give you based on the data type that you insert so if you insert uh integer column it will return to you a float column and that makes sense because the average function involves a division and that division will usually give you floating Point values but for any other of the allowed input types such as numeric bit numeric and so on and these are all data types which represent numbers in B query the average function as you can see here will present Reserve that data type and finally we have some examples so whenever you need to use an aggregate function that is whenever you need to take many values a sequence of multiple values and compress them all down to one value but you’re not sure about which function to use or what the behavior of the function is you can come to this page and look up the functions that interest you and then read the documentation to see how they work now here’s an error that typically occurs when starting out with aggregations so you might say well I want to get the name of each character and their level but I also want to see the average of all levels and because I want to compare those two values I want to compare the level of my character with the average on all levels so I can write a query that looks like this right go to the Fant as a characters table and then select name level and then average level but as you can already see this query is not functioning it’s giving me an error and the error says that the select list expression references column name which is neither grouped nor aggregated so what does this actually mean to show you what this means I’ve gone back to my Google Sheets where I have the same data for my characters table and I have copy pasted our query over here now what this query does it takes the name column so I will copy paste it over here and then it takes the level column copy paste this here as well and then it computes the average over level now I can easily compute this with sheet formula by writing equal and then calling the function which is actually called average and then within the function I can select all these values over here and I get the average now this is the result that SQL computes but SQL is actually not able to return this result and the reason is that there are three columns but they have mismatch number of values specifically these two columns have 15 values each whereas this column has a single value and SQL is not able to handle this mismatch because as a rule every SQL query needs to return a table and a table is a series of columns where each column has the same number of values if that constraint is not respected you will get an error in SQL and we will come back to this limitation when we examine Advanced aggregation techniques but for now just remember that you can mix non-aggregated columns with other non-aggregated columns such as name and level and you can mix aggregated columns with aggregated columns such as average level with some level for example so I could simply do this and I would be able to return this as a table because as you can see there are two columns both columns have a single Row the number of rows matches and this is actually valid but you might ask can’t I simply take this value over here and just copy it in every row and until I make sure that average level has the same number of values as name and level and so return a table and respect that constraint indeed this is possible you can totally do this and then it would work and then this whole table would become a single table and you would be able to return this result however this requires the use of window functions which is a a feature that we will see in later lectures but yes it is totally possible and it does solve the problem now here’s a special aggregation expression that you should know about because it is often used which is the count star and count star is simply counting the total number of rows in a table and as you can see if I say from fantasy characters select count star I get the total count of rows in my results and this is a common expression used across all SQL systems to figure out how many rows a table has and of course you can also combine it with filters with the wear clause in order to get other types of measures for example I could say where is alive equals true and then the count would become actually the count of characters who are alive in my data so this is a universal way to count rows in SQL although you should know that if you’re simply interested in the total rows of a table and you are working with bigquery an easy and totally free way to do it is to go to the details Tab and look at the number of rows here so this was all I wanted to tell you about simp Le aggregations for now and last question is why do we call them simple simple as opposed to what I call them simple because the way we’ve seen them until now the aggregations take all of the values of a column and simply return One summary value for example the sum agregation will take all of the values of the level column and then return a single number which is the sum of all levels and more advanced aggregations involved grouping our data for example a question we might ask is what is the average level for Mages as opposed to the average level for Archers and for Hobbits and for warriors and so on so now you’re Computing aggregations not over your whole data but over groups that you find in your data and we will see how to do that in the lecture on groupi but for now you can already find out a lot of interesting stuff about your data by running simple aggregations let us now look at subqueries and Common Table expressions and these are two fundamental functionalities in SQL these functionalities solve a very specific problem and the problem is the following sometimes you just cannot get the result you require with a single query sometimes you have to combine multiple SQL queries to get where you need to go so here’s a fun problem that will illustrate my point so we’re looking at the characters table and we have this requirement we want to find all those characters whose experience is between the minimum and the maximum maximum value of our experience another way to say this we want characters who are more experienced than the least experienced character but less experienced than the most experienced character in other words we want to find that middle ground that is between the least and the most experienced characters so let us see how we could do that uh I have here A Simple Start where I am getting the name and experience column from the characters table now let us focus on the first half of the problem find characters who have more experience than the least experienced character now because this is a toy data set I can sort of eyeball it so I can scroll down here and I can see that the lowest value of experience is pipin with 2100 and so what I need to do now is to filter out from this table all the rows that have this level of experience but apart from eyeballing how would we find the lowest level of experience in our data if you thought of aggregate functions you are right so we have seen a in a previous lecture that we have aggregated functions that take any number of values and speed out a single value that’s a summary for example meing minum and maximum and indeed we need to use a function like that for this problem so your first instinct might be let us take this table and let us filter out rows in this way so let’s say where experience is bigger than the minimum of experience and on the surface this makes sense right I am using an aggregation to get the smallest value of experience and then I’m only keeping rows that have a higher value than that however as you see from this red line this actually does not work because it tells us aggregate function is not allowed in the work Clause so what is going on here so if you followed the lecture on aggregation you might have a clue as to why this doesn’t work but it is good to go back to to it and understand exactly what the problem is so I’m going back to my Google sheet over here where I have the exact same data and I copied our current query down here and now let’s see what happens when SQL tries to run this so SQL goes to the fantasy characters table and the Second Step In The Logical order as you remember is to filter it and for the filter it has to take the column of experience so let me take this column and copy it down here and then it has to compute minimum of experience right so I will Define this column here and I will use Google Sheets function to achieve that result so equals mean and then selecting the numbers and here I get the minimum value of experience and now SQL has to compare these column but this comparison doesn’t work right because these are two columns that have a different number of rows they have a different number of values so SQL is not able to do this comparison you cannot do an element by element comparison between a column that has 15 values and a column that has a single value so SQL throws an error but you might say wait there is a simple solution to this just take this value and copy it all over here until you have two columns of the same size and then you can do the comparison indeed that would work that’s a solution but SQL doesn’t do it automatically whereas if you work with other analytics tools such as pandas in python or npy you will find that um in a situation like this this would be done automatically this would be copied all over here and there’s a process called broadcasting for that but SQL does not take so many assumptions and so many risks with your data if it literally doesn’t work then SQL will not do it so hopefully now you have a better understanding of why this solution does not work so how could we actually approach this problem now a Insight is that I can run a different query so I will open this on the right to find out the minimum experience right I can go back to the characters table and I can select the minimum of experience this is simply what we’ve learned to do in the lecture on aggregations and I get the value here that is the minimum value of experience now that I know the minimum value of experience I could simply copy this value and insert it here into a wear filter and if I run this this will actually work it will solve my problem the issue of course is that I do not want to hard code this value first of all it is not very practical to run a separate query and copy paste the value in the code and second the minimum value might change someday and then I might not remember to update it in my code and then this whole query would become invalid to solve this problem I will use a subquery and I will simply delete the hardcoded value and I will open round brackets which is a way to get started on a subquery and I will take the query that I have over here and put them put it in the round brackets and when I run this I get the result that I need so what exactly is going on here we are using a subquery or in other words a query within a query so when SQL looks at this code it says all right so this is the outer query right and it has a inner query inside it a nested query so I have to start with the innermost query I have to start with the nested query so let me compute this and so SQL runs this query first and then it gets a value out of it which in our case we know that is 2100 and after that SQL substitutes this code over here by the value that was computed and we know from before that this works as expected and to compute the other half of our problem we want our character to have less experience than the most experienced character so this is just another condition in the wear filter and so I can add an end here and copy this code over here except that now I want my experience to be smaller than the maximum of EXP experience in my table now you might know this trick that if you select only part of your code like this and then you click run SQL will only execute that part of the code and so here we get the actual maximum for our experience and we can write it here in the comment and now we know that when SQL runs this query all of these will be computed to 15,000 and then experience will will be compared on that and the query will work as intended and here is the solution to our problem now here’s the second problem which shows another side of subqueries we want to find the difference between a character’s experience and their mentors so let us solve it manually for one case in the characters table so let us look at this character over here which is Saran with id1 and their experience is 8500 and then Saruman has character id6 as their Mentor so if I look for id6 we have Gandalf this is not very Canon compared to the story but let’s just roll with it and Gandalf has 10,000 of experience and now if we select the experience of Gandalf minus the experience of Saran we can see that there is A500 difference between their experience and this is what I want to find with my query now back to my query I will first Alias my columns in order to make them more informative and this is a great trick trick to make problems clearer in your head assign the right names to things so here instead of ID I will call this mentee ID and here I have Mentor ID and here instead of experience I will call this Mente experience so I have just renamed my columns now the missing piece of the puzzle is the mentor experience right so how can I get the mentor experience for example in the first case I know that character 11 is mentored by character 6 how can I get the experience of character six now of course I can take a new tab over here split it to the right go to Fantasy characters filter for ID being equal to six which is the ID of our mentor and get their experience and the experience in this case is 10,000 this is the same example that we saw before but now I would have to write this separate query for each of my rows so here six I’ve already checked but then I will need to check two and seven and one and this is really not feasible right and the solution of course is to solve it with a subquery so what I’m going to do here is open round brackets and in here I will write the code that I need and here I can simply copy the code that I’ve written here get experience from the characters where ID equals six now the six part is still hardcoded because in the first row Mentor ID is six to avoid hardcoding this part there are two components to this the first one is noticing that I am referencing the same table fantasy. characters in two different places in my code and this could get buggy and this could get confusing and the solution is to give separate names to these two instances now what are the right names to give so if we look at this outer query right here this is really information about the M te right because we have the Mente ID the ID of their mentor and the Mente experience so I can simply call this Mente table and as you can see I can Alias my table by simply writing it like this or I could also add the as keyword it would work works just the same on the other hand this table will give us the experience of the mentor this is really information about the mentor so we can call this Mentor table now we’re not going to get confused anymore because these two instances have different names and now what do we want this ID to be if we’re not going to hardcode it we want it to be this value over here we want it to be the mentor ID value from the Mente table we want it to be the M’s mentor and to refer to that column I will get the table name dot the column name so this is telling me get the mentor ID value from mentee table and now that I have the subquery which defines a colum with these two brackets I can Alias the result just like I always do and run this and now you will see after making some room here that we have successfully retrieved The Experience value for the mentor now I realize that this is not the simplest process so let us go back to our query over here and make sure that we understand exactly what is happening now first of all we are going to the characters table which contains information about our mentee the person who is being mentored and we label the table so that we remember what it’s about we filter it because we’re not interested in characters that do not have a mentor and then we’re getting a few data right the ID in this case represents the IDE of the mentee and we also have their Mentor ID and we also have the experience which again this is the table about the Mente represents the mentee experience now our goal is to also get the experience of their Mentor our goal is to see that we have a mentor id6 and we want to know that their experience is 10,000 and we do that with a subquery it’s a query within a query and in this subquery which is an independent piece of SQL code we are going back to the characters table but this is another instance of the table right that we’re looking at so to make sure we remember that we call this Mentor table because it contains information about the mentor and how do we make sure that we get the right value over here that we don’t get confused between separate mentors we make sure that for each row the ID of the character in this table is equal to the mentor ID value in the menty table in other words we make sure that we plug in this value over here in this case six into the table to get the right row and then from that row we get the experience value all of these code over here defines a new column which we call Mentor experience and this is basically the same thing that we did manually when we opened a table on the right and queried the table and copy pasted a hardcoded value this is just the way to do it dynamically with a subquery now we are not fully done with the problem right because we wanted to see the difference between the characters experience and their mentors so let’s see how to do this and the way to do it is with a column calculation just like the ones we’ve seen before so given that this column represents the mentor experience I can remove the Alias over here and over here as well and I can subtract the experience from this and a column minus a column gives me another column which I can then Alias as experience difference and if I I run this I will see the value that we originally computed manually which is the difference between the mentor and the Mente experience there’s nothing really new about this as long as you realize that this expression over here defines a column and this is the reference to a column and so you can subtract them and then give a name an alias to the result and now we can look at our two examples of nested queries side by side and we can figure out what they have in common and where do they differ so what they have in common is that they’re both problem that you cannot resolve with a simple query because you need to use values that you have to compute separately values that you cannot simply refer to by name like we usually do with our columns in this case on the left you need to know what are the minimum and maximum values for experience and in this case on the right you need to know what is the experience of a character’s mentor and so we solve that problem by writing a new query a nested query and making sure that SQL solves this query first gets the result and then plugs that result back back into the original query to get the data we need there is however a subtle difference between these two queries that turns out to be pretty important in practice and I can give you a clue to what this difference is by telling you that on the right we have something that’s called a correlated subquery and on the left we Define this as uncor related subquery now what does this really mean it means that here on the left our subqueries are Computing the minimum and the maximum experience and these are actually fixed values for all of our characters it doesn’t matter which character you’re looking at the whole data set has the same values from minimum experience and maximum experience so you could even imagine comp Computing these values first before running your queries for example you could say minimum experience is the minimum and maximum experience is the max and then you could imagine replacing these values over here right this will not actually work because you cannot Define variables like this in in SQL but on a logical level you can imagine doing this right because you only need to compute these two once I will revert this here so we don’t get confused on the other hand on the right you will see that the value that is returned by sub by this subquery needs to be computed dynamically for every row this value as you also see in the results is different for every row because every row references a different Mentor ID and so SQL cannot compute this one value here for for all rows at once it has to recompute it for every row and this is why we call it a correlated subquery because it’s connected to the value that is in each row and so it must run for each row and an important reason to distinguish between uncorrelated and correlated subqueries is that you can imagine that correlated subqueries are actually slow slower and more expensive to run because you have you’re running a SQL query for every row at least At The Logical level so this was our introduction to subqueries they allow you to implement more complex logic and as long as you understand it logically you’re off to a great start and then by doing exercises and solving problems you will learn with experience when it’s the case to use them in the last lecture we saw that we could use subqueries to retrieve singular values for example what is the minimum value of experience in my data set but we can also use subqueries and Common Table Expressions as well to create new tables all together so here’s a motivating example for that so what I’m doing in this query right here is that I am scaling the value of level based on the character’s class and you might need this in order to create some balance in your game or for whatever reason now what this does is that if the character is Mage the level gets divided by half or multiplied by 0.5 if the character is Archer or Warrior the level we take the 75% of it and in all other cases the level gains 50% so the details are not very important it’s just an example but the point is that we modify the value of level based on the character class and we do this with the case when statement that we saw in a previous lecture and as you can see in the results we get a new value of power level for each character that you can see here but now let’s say that I wanted to filter my my characters based on this new column of power level say that I wanted to only keep characters that have a power level of at least 15 how would I do that well we know that the wear filter can be used to filter rows so you might just want to go here and add a wear statement and say where power level is equal or bigger than 15 but this is not going to work right we know this cannot work because we know how the logical order of SQL operations works and so the case when column that we create power level is defined here at the select stage but the wear filter occurs here at the beginning right after we Source our table so due to our rules the wear component cannot know about this power level column that will actually get created later so the query that we just wrote actually violates the logical order of SQL operations and this is why we cannot filter here now there is actually one thing that I could do here to avoid using a subquery and get around this error and that’s something would be to avoid using this Alias power level that we assigned here and that the we statement cannot know about and replace it with the whole logic of the case when statement so this is going to look pretty ugly but I’m going to do it and if I run this you will see that we in fact get the result we wanted now in the wear lecture we saw that the wear Clause doesn’t just accept simple logical statements you can use all the calculations and all the techniques that are available to you at the select stage and you can also use case when statements and this is why this solution here actually works however this is obviously very ugly and impractical and you should never duplicate code like this so I’m going to remove this wear Clause over here and show you how you can achieve the same result with a subquery so let me first rerun this query over here so that you can see the results and now what I’m going to do I’m going to select this whole logic over here and wrap it in round brackets and then up here I’m going to say select star from and when I run this new query this data that I’m seeing over here should be unchanged so let us run it and you will see that the data has not changed at all but what is actually happening here well it’s pretty simple usually we say select star from fantasy characters right and by this we indicate the name of a table that our system can access but now instead of a table name we are showing a subquery and this subquery is a piece of SQL logic that obviously returns a table so SQL will look at this whole code and we’ll say say okay there is a outer query which is this one and there is an inner query a nested query which is this one so I will compute this one first and then I will treat this as just another table that I can then select from and now because this is just another table we can actually apply a wear filter on top of it we can say where power level is equal or greater than 15 and you will see that we get the result we wanted just like before but now our code looks actually better and the case when logic is not duplicated if you wanted to visualize this in our schema it would look something like this so the flow of data is the following first we run the inner query that works just like all the other queries we’ve seen until now it starts with the from component which gets the table from the database and then it goes through the usual pipeline of SQL logic that eventually produces a result which is a table next that table gets piped into the outer query the outer query also starts with the from component but now the from component is not redem directly from the dat database it is reading the result of the inner query and now the outer query goes through the usual pipeline of components and finally it produces a table and that table is our result and this process could have many levels of nesting because the inner query could reference another query which references another query and eventually we would get to the database but it could take many steps to get there and to demonstrate how multiple levels of nesting works I will go back to my query over here and I will go into my inner query which is this one and this is clearly referencing the table in the database but now instead of referencing the table I will reference yet an other subquery which can be something like from fantasy characters where is alive equals true select star so I will now run this and we have added yet another subquery to our code this was actually not necessary at all you could add the wear filter up here but it is just to demonstrate the fact that you can Nest a lot of queries within each other the other reason I wanted to show you this code is that I hope you will recognize that this is also not a great way of writing code it can get quite confusing and it’s not something that can be easily read and understood one major issue is that it interrupts the natural flow of reading code because you constantly have to interrupt a query because another nested query is beginning within it so you will read select start from and then here another query starts and this is also querying from another subquery and after reading all of these lines you will find this wear filter that actually refers to the outer query that has started many many lines back and if you find this confusing well I think you’re right because it is and the truth is that when you read code on the job or in the wild or when you see solutions that people propose to coding challenges unfortunately this is something that occurs a lot you have subqueries within subqueries within subqueries and very quickly the code becomes impossible to read fortunately there is a better way to handle this and a way that I definitely recommend over this which is to use common table Expressions which we shall see shortly it is however very important that you understand this way of writing subqueries and that you familiarize yourself with it because whether we like it or not a lot of code out there is written like this we’ve seen that we can use the subquery functionality to define a new table on the Fly just by writing some code a new table that we can then query just like any other SQL table and what this allows us to do is to run jobs that are too complex for a single query and to do that without defining new tables in our database and and storing new tables in our database it is essentially a tool to manage complexity and this is how it works for subqueries so instead of saying from and then the name of a table we open round brackets and then we write a independent SQL query in there and we know that every sqle query returns a table and this is the table that we can then work on what we do here is to select star from this table and then apply a filter on this new column that we created in the subquery power level and now I will show you another way to achieve the same result which is through a functionality called Common Table Expressions to build a Common Table expression I will take the logic of this query right here and I will move it up and next I will give a name to this table I will call it power level table and then all I need to say is with power level table as followed by the logic and now this is just another table that is available in my query and it is defined by the logic of what occurs Within the round brackets and so I can refer to this over here and query it just like I need and when I run this you see that we get the same results as before and this is how a Common Table expression works you start with the keyword with you give an alias to the table that you’re going to create you put as open round brackets write an independent query that will of course return a table under this alas over here and then in your code you can query this Alias just like you’ve done until now for any SQL table and although our data result hasn’t changed I would argue that this is a better and more elegant way to achieve the same result because we have separated in the code the logic for the these two different tables instead of putting this logic in between this query and sort of breaking the flow of this table we now have a much cleaner solution where first we Define the virtual table that we will need and by virtual I mean that we treat it like a table but it’s not actually saved in our database it’s still defined by our code and then below that we have the logic that uses this virtual table we can also have multiple Common Table expressions in our query let me show you what that looks like so in our previous example on subquery we added another part where here instead of querying the fantasy characters table we queried a filter on this characters table and it looked like this we were doing select star where is alive equals true so I’m just reproducing what I did in the previous lecture on subqueries now you will notice that this is really not necessary because all we’re doing here is add a wear filter and we could do this in this query directly but please bear with with me because I just want to show you how to handle multiple queries the second thing I want to tell you is although this code actually works and you can verify for yourself I do not recommend doing this meaning mixing Common Table expressions and subqueries it is really not advisable because it adds unnecessary complexity to your code so here we have a common table expression that contains a subquery and I will rather turn this into a situation where we have two common table expressions and no subqueries at all and to do that I will take this logic over here and paste it at the top and I will give this now an alias so I will call it characters alive but you can call it whatever is best for you and then I will do the keyword as add some lines in here to make it more readable and now once we are defining multiple Common Table Expressions we only need to do the with keyword once at the beginning and then we can simply add a comma and please remember this the comma is very important and then we have the Alias of the new table the as keyword and then the logic for that table all that’s needed to do now is to fill in this from because we took away the subquery and we need to query the characters alive virtual table here and this is what it looks like and if you run this you will get your result so this is what the syntax looks like when you have multiple Common Table Expressions you start with the keyword with which you’re only going to need once and then you give the Alias of your first table as keyword and then the logic between round brackets and then for every extra virtual table that you want to add for every extra Common Table expression you only need to add a comma and then another Alias the ask keyword and then the logic between round brackets and when you are done listing your Common Table Expressions you will omit the comma you will not have a comma here because it will break your code and finally you will run your main query and in each of these queries that you can see here you are totally free to query real tables you know material tables that exist in your database as well as common table Expressions that you have defined in this code and in fact you can see that our second virtual table here is quering the first one however be advised that the order in which you write these Common Table Expressions matters because a Common Table expression can only reference Common Table Expressions that came before it it’s not going to be able to see those that came after it so if I say here instead of from fantasy characters I try to query from power level table you will see that I get an error from bigquery because it thinks it doesn’t recognize it basically because the code is below so the order in which you write them matters now an important question to ask is when should I use subqueries and when should I use common table expressions and the truth is that they have a basically equivalent functionality what you can do with the subquery you can do with a common table expression my very opinionated advice is that every time you need to define a new table in your code you should use a Common Table expression because they are simpler easier to understand cleaner and they will make your code more professional in fact I can tell you that in the industry it is a best practice to use common table Expressions instead of subqueries and if I were to interview you for a data job I would definitely pay attention to this issue but there is an exception to this and this is the reason why I’m showing you this query which we wrote in a previous lect lecture on subqueries this is a query where you need to get a single specific value right so if you remember we wanted to get characters whose experience is above the minimum experience in the data and also below the maximum experience so characters that are in the middle to do this we need to dynamically find at any point you know when this query is being run what is the minimum experience and the maximum experience and the subquery is actually great for that you will notice here that we don’t really need to define a whole new table we just really need to get a specific value and this is where a subquery works well because it implements very simple logic and doesn’t actually break the flow of the query but for something more complex like power level table you know this specific query we’re using here which takes the name takes the level then applies a case when logic to level to create a new column called power level you could this do this with a subquery but I actually recommend doing it with a common table expression and this is a cool blog post on this topic by the company DBT it talks about common table expressions in SQL why they are so useful for writing complex SQL code and the best best practices for using Common Table expressions and towards the end of the article there’s also an interesting comparison between Common Table expressions and subqueries and you can see that of CTE Common Table expressions are more readable whereas subqueries are less readable especially if there there are many nested ones so you know a subquery within a subquery within a subquery quickly becomes unreadable recursiveness is a great advantage of CTE although we won’t examine this in detail but basically what this means is that once you define a Common Table expression in your code you can reuse it in any part of your code you can use it in multiple parts right you can use it in other CTE you can use it in your main query and so on on the other hand once you define a subquery you can really only use it in the query in which you defined it you cannot use it in other parts of your code and this is another disadvantage this is a less important factor but when you define a CTE you always need to give it a name whereas subqueries can be anonymous you can see it very well here we of course had to give a name to both of these CTE but the subqueries that we’re using here are Anonymous however I don’t I wouldn’t say that’s a huge difference and finally you have that CTE cannot be used in a work Clause whereas subqueries can and this is exactly the example that I’ve shown you here because this is a simple value that we want to use in our work clause in order to filter our table subqueries are the perfect use case for this whereas CTE are suitable for more complex use cases when you need to Define entire tables in conclusion the article says CTS are essentially temporary views that you can use I’ve used the term virtual table but temporary view works just as well conveys the same idea they are great to give your SQL more structure and readability and they also allow reusability before we move on to other topics I wanted to show you what an amazing tool to Common Table expressions are to create complex data workflows because Common Table expressions are not just a trick to execute certain SQL queries they’re actually a tool that allows us to build data pipelines within our SQL code and that can really give us data superpowers so here I have drawn a typical workflow that you will see in complex SQL queries that make use of Common Table Expressions now what we’re looking at here is a single SQL query it’s however a complex one because it uses CTE and the query is represented graphically here and in a simple code reference here the blue rectangles represent the Common Table Expressions these virtual tables that you can Define with the CTE syntax whereas the Red Square represents the base query the query at the bottom of your code that ultimately will return the result so a typical flow will look like this you will have a first Common Table expression called T1 that is a query that references a real table a table that actually exists in your data set such as fantasy characters and of course this query will do some work right it can apply filters it can calculate new columns and so on everything that we’ve seen until now and then the result of this query gets piped in to another Common Table expression this one is T2 that gets the result of whatever happen happened at T1 and then apply some further logic to it apply some more Transformations and then again the result gets piped into another table where more Transformations run and this can happen for any number of steps until you get to the final query and in the base query we finally compute the end result that will then be returned to the user so this is effectively a dat pipeline that gets data from the source and then applies a series of complex Transformations and this is similar to The Logical schema that we’ve been seeing about SQL right except that this is one level further because in our usual schema the steps are done by Clauses by these components of the SQL queries but here every step is actually a query in itself so of course this is a very powerful feature and this data pipeline applies many queries sequentially until it produces the final result and you can do a lot with this capability and also you should now be able to understand how this is implemented in code so we have our usual CTE syntax with and then the first table we call T1 and then here we have the logic within round brackets for T1 and you can see here that in the from we are referencing a table in the data set and then for every successive Common Table expression we just add a comma a new Alias and the logic comma new Alias and the logic and finally when we’re done we write our base query and you can see that the base query is selecting from T3 T3 is selecting from T2 T2 is selecting from T1 and T1 is selecting from the database but you are not limited to this type of workflow here is another maybe slightly more complex workflow that you will also see in the wild and here you can see that at the top we have two common table Expressions that reference the the database so you can see here like like the first one is getting data from table one and then transforming it the second one is getting data from table two and then transforming it and next we have the third CTE that’s actually combining data from these two tables over here so we haven’t yet seen how to combine data except through the union um I wrote The Joint here which we’re going to see shortly but all you need to know is that T3 is combining data from this these two parent tables and then finally the base query is not only using the data from T3 but also going back to T1 and using that data as well and you remember we said that great thing about ctes is that tables are reusable you define them once and then you can use them anywhere well here’s an example with T1 because T1 is defined here at the top of the code and then it is referenced by T3 but it is also referenced by the base query so this is another example of a workflow that you could have and really the limit here is your imagination and the complexity of your needs you can have complex workflows such as this one which can Implement very complex data requirements so this is a short overview of the power of CTE and I hope you’re excited to learn about them and to use them in your sequel challenges we now move on to joints which are a powerful way to bring many different tables together and combine their information and I’m going to start us off here with a little motivating example now on the left here I see my characters table and by now we’re familiar with this table so let’s say that I wanted to know for each character how many items they are carrying in their inventory now you will notice that this information is not available in the characters table however this information is available in the inventory table so how exactly does the inventory table works when you are looking at a table for the first time and you want to understand how it works the best question you can ask is the following what does each row represent so what does each row represent in this table well if we look at the columns we can see that for every row of this table we have a specific character id and an item id as well as a quantity and some other information as well such as whether the item is equipped when it was purchased and and so on so looking at this I realized that each row in this table represents a fact the fact that a character has an item right so I know by looking at this table that character id 2 has item 101 and character ID3 has item six and so on so clearly I can use this in order order to answer my question so how many items is Gandalf carrying to find this out I have to look up the ID of Gandalf which as you can see here is six and then I have to go to the inventory table and in the character id column look for the ID of Gandalf right now unfortunately it’s not ordered but I can look for myself here and I can see that at least this row is related to Gandalf because he has character id6 and I can see that Gandalf has item id 16 in his inventory and I’m actually seeing another one now which is this one which is 11 and I’m not seeing anyone uh any other item at the moment so for now based on my imperfect uh visual analysis is I can say that Gandalf has two items in his inventory of course our analysis skills are not limited to eyeballing stuff right we have learned that we can search uh a table for the information we need so I could go here and query the inventory table in a new tab right and I could say give me um from the inventory table where character id equals 6 this should give me all the information for Gandalf and I could say give me all the columns and when I run this I should see that indeed we have uh two rows here and we know that Gandalf has items 16 and 11 in his inventory we don’t know exactly what these items are but we know that he’s carrying two items so that’s a good start okay but uh what if I wanted to know which items Frodo is carrying well again I can go to the characters table and uh look up the name Frodo and I find out that Frodo is id4 so going here I can just plug that uh number into my we filter and I will find out that Frodo is carrying a single type of item which has id9 although it’s in a quantity of two and of course I could go on and do this for every character but it is quite impractical to change the filter every time and what if I wanted to know how many items each character is carrying or at least which items each character is carrying all at once well this is where joints come into play what I really want to do in this case is to combine these two tables into one and by bringing them together to create a new table which will have all of the information that I need so let’s see how to do this now the first question we must answer is what unites these two tables what connects them what can we use in order to combine them and actually we’ve already seen this in our example um the inventory table has a character id field which is actually referring to the ID of the character in the character’s table so we have two columns here the character id column in inventory and the ID column in characters which actually represent the same thing the identifier for a character and this logical connection the fact that these columns repres repr the same thing can be used in order to combine these tables so let me start a fresh query over here and as usual I will start with the from part now where do I want to get my data from I want to get my data from the characters table just as we’ve been doing until now however the characters table is not not enough for me anymore I need to join this table on the fantasy. inventory table so I want to join these two tables how do I want to join these two tables well we know that the inventory table has a character id column which is the same as the character tables ID column so like we said before these two columns from the different tables they represent the same thing so there’s a logical connection between them and we will use it for the join and I want to draw your attention to the notation that we’re using here because in this query we have two tables present and so it is not enough to Simply write the name of columns it is also necessary to specify to which table each column belongs and we do it with this notation so the inventory. character uh is saying that the we are talking about the character id colum in the inventory table and the ID column in the characters table so it’s important to write columns with this notation in order to avoid ambiguity when you have more than one table in your your query so until now we have used the from uh Clause to specify where do we want to get data from and normally this was simply specifying the name of a table here we are doing something very similar except that we are creating a new table that is obtained by combining two pre-existing tables okay so we are not getting our data from the characters table and we are not getting it from the inventory table but we are getting it from a brand new table that we have created by combining these two and this is where our data lives and to complete the query for now we can simply add a select star and you will now see the result of this query so let me actually make some room here and expand these results so I can show you what we got and as you can see here we have a brand new table in our result and you will notice if you check the columns that this table includes all of the columns from the characters table and also all of the columns from the inventory table as as you can see here and they have been combined by our join statement now to get a better sense of what’s Happening let us get rid of this star and let us actually select the columns that we’re interested in and once again I will write columns with this notation in order to avoid ambiguity and in selecting these columns uh I will remind you that we have all of the columns from the characters table and all of the columns from the inventory table to choose from so what I will do here is that I will take the ID columns from characters and I will take the name column from characters and then I will want to see the ID of the item so I will take the inventory table and the item id column from that table and from the inventory table I will also want to see the quantity of each item and to make our results clearer I will order my results by the characters ID and the item ID and you can see here that we get the result that we needed we have all of our characters here with their IDs and their name and then for each character we can tell which items are in their inventory so you can see here that Aragorn has item id4 in his inventory in quantity of two he also has Item 99 so because of this Aragorn has two rows if we look back at Frodo we see the uh information that we retrieved before and the same for Gandalf who has these two items so we have combined the characters table and the inventory table to get the information that we needed what does each row represent in our result well it’s the same as the inventory table each row is a fact which is that a certain character possesses a certain item but unlike the inventory table we now have all the information we want for a character and not just the ID so here we’ve uh we’re showing the name of each character but we could of course select more columns and get more information for each character as needed now a short note on notation when you see SQL code in the wild and u a query is joining on two or more tables people uh you know programmers were usually quite lazy and we don’t feel like writing the name of the table all all of the time right like we we’re doing in this case with characters so what we usually do is that we add an alias um on the table like this so from fantasy characters call it C we will join on inventory call it I and then basically we use this Alias um everywhere in the query both in the instructions for joining and in the column names and the same with characters so I will substitute everything here and and yes maybe it’s a bit less readable but it’s faster to write and we programmers are quite lazy so we’ll often see this notation and you will often also see that in the code we omit the as keyword which can be let’s say implicit in SQL code and so we write it like this from fantasy. character C join uh fantasy. inventory i and then C and I refer to the two tables that we’re joining and I can run this and show you that the query works just as well now we’ve seen why join is useful and how it looks like but now I want you to get a detailed understanding of how exactly the logic of join works and for this I’m going to go back to my spreadsheet and what I have here is my characters table and my inventory table these are just like you’ve seen them in big query except that I’m only taking um four rows each in order to make it simpler for the example and what you see here is the same query that I’ve just run on big query this is a t a query that takes the characters table joins it on the inventory table on this particular condition and then picks a few columns from this so let us see how to simulate this query in Google Sheets now the first thing I need to do is to build the table that I will run my query on because as we’ve said before the from part is now referencing not the characters table not the inventory table but the new table which is built by combining these two and so our first job is to build this new table and the first step to building this new table is to take all of the columns from characters and put them in the new table and then take all of the columns from inventory and then put them in the new table and what we’ve obtained here is the structure of our new table the structure of our new table is uh simply created by taking all of The Columns of the T table on the left along with all of the columns from the table on the right now I will go through each character in turn and consider the join condition the join condition is that the ID of a character is present in the character id column of inventory so let us look at my first character um we have Aragorn and he has ID one now is this ID present in the character id column yes I see it here in the first row so we have a match given that we have a match I will take all of the data that I have in the characters table for Aragorn and then I will take all of the data in the inventory table for the row that matches and I have built here my first row do I have any other Row in the inventory table that matches yes the second row also has a character id of one so because I have another match I will repeat the operation I will will take all of the data that I have in the left table for Aragorn and I will add all of the data from the right column in the row that matches now there are no more matches for id1 uh in the inventory table so I can proceed and I will proceed with Legolas he has character id of two question is there any row that has the value two in the character id column yes I can see it here so I have another match so just like before I will take the information for Legolas and paste it here and then I will take the matching row which is this one and paste it here we move on to gimly because there’s no other matches for Legolas now gimly has ID3 and I can see a match over here so I will take the row for gimly paste it here and then take the matching row character id 3 and paste it here great finally we come to Frodo character id for is there any match for this character I can actually find no match at all so I do nothing this row does not come into the resulting table because there is no match and this completes the job of this part of the query over here building the table that comes from joining these two tables this is my resulting table and now to complete the query I simply have to pick the columns that the query asks for so the First Column is character. ID which is this column over here so I will take it and I will put it in my result the second column I want is character. name which is this column over here the third column is the item id column which is this one right here and finally I have quantity which is this one right here and this is the final result of my query and of course this is just like any other SQL table so I can use all of the other things I’ve learned to run Logic on this table for example I might only want to keep items that are present in a quantity of two and so to do that I will simply add a wear filter here and I will refer uh the inventory table because that’s the parent table of the quantity column so I will say I will say i. quantity um bigger or equal to two and then how my query will work is that first it will build this table like we’ve seen so it will do this stage first and then it will run the wear filter on this table and it will only keep the rows where quantity is at least two and so as a result we will only get this row over here instead of this result that we see right here H except that um we will of course also have to only keep the columns that are specified in the select statement so we will get ID name um Item ID and quantity so this will be the result of my query after I’ve added a wear filter so let us actually take this and add it to B query and make sure that it works so so I have to add that after the from part and before the order by part right this is the order and after I run this I will see that indeed I get um Aragorn and Frodo is not exactly the same as in our sheet but that’s because our sheet has um less data but uh this is what we want to achieve and now let us go back to our super important diagram of the order of SQL operation and let us ask ourselves where does the join fit in in this schema and as you can see I have placed join at the very beginning of our flow together with the from because the truth is that the joint Clause is not really separate from the from CL Clause they are actually one and the same component in The Logical order of operations so as you remember the first stage specifies where our data lives where we do we want to get our data from and until now we were content to answer this question with a single table name with the address of a single table because all the data we needed was in just one table and now instead of doing this we are taking it a step further we are saying our data lives in a particular combination of two or more tables so let me tell you which tables I want to combine and how I want to combine them and the result of this will be of course yet another table and then this table will be the beginning of my flow and after that I can apply all the other operations that I’ve come to know uh on my table and it will work just like U all our previous examples the result of a join is of course just another table so when you look at a SQL query and this query includes a join you really have to see it as one and the same with the front part it defines the source of your data by combining tables and everything else that you do will be applied not to a single table not to any of the tables that you’re combining everything that you do will be applied to the resultant table that comes from this combination and this is why from and join are really the same component and this is why they are the first step in The Logical order of SQL operations let us now briefly look at multiple joints because sometimes the data that you need is in three tables or four tables and you can actually join as many tables as you want uh or at least as many tables as your system uh allows you to join before it becomes too slow so we have our example here from before we have each character and we have their name and we know which items are in their inventory but we actually don’t know what the items are we just know their ID so how can I know uh that if Aragorn has item four what item does Aragorn actually have what is the name of this item now obviously this information is available in the items table that you have here on the right and you can see here that we have a name column and just like before I can actually eyeball it I can look for it myself I know that I’m looking for item id 4 and if I go here and uh I go to four I can see that this item is a healing potion and now let us see how we can add this with the join so now I will go to my query and after joining with characters in inventory I will take that result and simply join it on a third table so I will write join on fantasy. items and I can call this it to use a uh brief form uh because I am lazy as all programmers are and now I need to specify the condition on which to join so the condition is that the item ID column which actually came from the inventory table right that’s its parent so I’m going to call it inventory. item um ID except that yeah I’m referring to inventory as a simple I that is the brief form is the same as the items table the ID column in the items table and now that I’ve added my condition the data that I’m searcing is now a combination of these three tables and in my result I now have access to The Columns of the items table and I can access these columns simply by referring to them so I will say it. name and some other thing it. power and after I run this query I should be able for each item to see the name and the power right so Aragorn has a healing potion with power of 50 Legolas has a Elven bow with power of 85 and so on now you may have noticed something a bit curious and it’s that name here is actually written as name1 and can you figure out why this is happening well well it’s happening because there’s an ambiguity right the characters table has a column called name and the items table also has a column called name and because bigquery is not referring to the columns the way we are doing it right by saying the the parent table and then the name of the column it uh it would find itself in a position of having two identically named columns so the second one uh it tries to distinguish it by adding underscore one and how we can remedy this is by renaming the column to something more meaningful for example we could say call this item name which would be a lot clearer for whoever looks at the result of our query and as you can see now the name makes more sense so you can see that the multiple join is actually nothing new because when we join the first time like we did before we have combined two two tables into a new one and then this new table gets joined to a third table so it’s simply repeating the join operation twice it’s nothing actually new but let us actually simulate a multiple join in our spreadsheet to make sure that we understand it and that it’s nothing new so again I have our tables here but I have added the items table which we will combine and I’ve written here our query right so take the characters table and join it with inventory uh like we did before and then take the result of that table and join it to items and here we have the condition so the first thing we need to do is to process our first join and this is actually exactly what we’ve done before so let us do it again first of all the combined table uh characters and inventory its structure is obtained by taking all the columns of characters and then all the columns of inventory and putting them side by side and this is the result table now for the logic of this table I will now do it faster because we’ve done it before but basically we get the first character id1 it has two matches so I’ll actually take this values and put them into two rows and for the inventory part I will simply call copy these two rows to um complete my match then we have Legolas there is one match here so I will take the left side and I will take so I’m looking for id2 so I will take this row over here that’s all we have and then we have gimle and he also has one match so I’ll will take it here and the resulting column and then finally Frodo has no match so I will not add him to my result this is exactly what we’ve done before so now that we have this new table we can proceed with our next join which is with items okay so the resulting table will be the result of our first join combined with items and to show you that we’ve already computed uh this and now it’s one table I have added round brackets now the rules for joining are just the same so take all of the columns in the left side table and then take all of the columns in the right side table and now we have the resulting structure of our table and then let us go through every row so let us look at the first row what does the joint condition say Item ID needs to be in the ID table of items so I can see a match here so I will simply take this row on the left side and the matching row on the right side and add it here second row the item ID is four do I have a match yes I can see that I have a match so I will paste the row on the left and the mat matching row on the right third column item id 2 do I have a match no I don’t so I don’t need to do anything and in the final row item id 101 I don’t see a match so I don’t have to do anything and so this is my final result in short multiple join works just like a normal join combine the first two tables get the resulting table and then keep doing this until you run out of joins now there’s another special case of join uh which is the self join and this is something that people who are getting started with SQL tend to find confusing but I want to show you that there’s nothing uh confusing about it because really it’s just a regular join that works just like all the other joints that we’ve seen there’s nothing actually special about it so we can see here uh the characters table and you might remember that for each character we are we have a column of Mentor ID now in a lot of cases this column has value null so it means that there’s nothing there but in some cases there is a value there and what this means is that this particular character so we are looking at number three uh that is Saruman uh this particular character has a mentor and who is this Mentor uh all we know is that their ID is six and it turns out that the ID in this column is referring to the ID in the characters table so to find out who six is I just have to look who has an ID of six and I can see that it is Gandalf so by eyeballing it I know that San has a mentor and that Mentor is Gandalf and then elron also has the same Mentor which is Gand so I can solve this by eyeballing the table but how can I get a table that shows for each character who has a mentor who their Mentor is it turns out that I have to take the character’s table and join it on the characters table on itself so let’s see how that works in practice so let me start a new query here on the right and so my goal here is to list every character in the table and then to also show their Mentor if they have one so I will of course have to get the characters table for this and the first time I take this table it is simply to list all of the characters right so to remind myself of that I can give it a label which is chars now as you know each character has a mentor ID value and but to find out who like what is the name of this Mentor I actually need to look it up in the characters table so to do this I will join on another instance of the characters table right this is another let’s say copy of the same data but now I’m going to use it for a different purpose I will not use it to list my characters I will use it to get the name of the mentor so I will call this mentors to reflect this use now what is The Logical connection between these two copies of the characters table each character in my list of characters has a mentor ID field and I want to match this on the the ID field of my mentor table so this is The Logical connection that I’m looking for and I can now add a select star to quickly complete my query and see the results over here so the resulting table has all of The Columns of the left table and all of The Columns of the right table which means that the columns of the characters table will be repeated uh twice in the result as you can see here but on the left I simply have my list of characters okay so the first one is Saruman and then on the right I have the data about their Mentor so Saran has a mentor ID of six and then here starts the data about the mentor he has ID of six and his name is Gandalf so you can see here that our self jooin has worked as intended but this is actually a bit messy uh we don’t need uh all of these columns so let us now select Only The Columns that we need so from my list of characters I want the name and then from the corresponding Mentor I also want the name and I will label these columns so that they make sense to whoever is looking at my data so I will call this character character name and I will call this Mentor name and when I run this query you can see that quite simply we get what we wanted we have the list of all our characters at least the ones who have a mentor and for each character we can see the name of their Mentor so a self join works just like any other join and the key to avoiding confusion is to realize that you are joining on two different copies of the same data okay you’re not actually joining on the same exact table so one copy of fantasy characters we call characters and we use for a purpose and then a second copy we call mentors and we use for another purpose and when you realize this you see that you are simply joining two tables uh and all the rules that you’ve learned about normal joints apply it just so happens that in this case the two tables are identical because you’re getting the data from the same source and to drive the point home let us quickly simulate this in our trusty spreadsheet and so as you can see here uh I have the query that I’ve run in B query and we’re now going to simulate it so the important thing to see here is that that we’re not actually joining one table to itself although that’s what it looks like we’re actually joining two tables which just happen to look the same okay and so one is called chars and one is called mentors based on the label that we’ve given them but then once we join them the rules are just the same as we’ve seen until now so to create the structure of the resulting table take all the columns from the left left and then take all the columns from the right and then go row by row and look for matches based on on the condition now the condition is that Mentor ID in chars needs to be in the ID column of mentors so first row Aragorn has Mentor 2 is this in the ID column yes I can see a match here so let me take all the values from here and all the values from the matching rows paste them together are there any other matches no second row we’re looking for Mentor ID 4 do we have a match yes I can see it here so let me take all of the values from the left and all of the values from the matching row on the right now we have two more rows but but as you can see in both cases Mentor ID is null which means that they have no mentor and basically for the purposes of the join we can ignore these rows we are not going to find a match in these rows in fact as an aside even if there was a character whose ID was null uh we wouldn’t match with Mentor ID null on a character whose ID was null because in squl in a sense null does not equal null because null is not a specific value but it represents the absence of data so in short when Mentor ID is null we can be sure that in this case uh there will be no match and the row will not appear in the join now that we have our result we simply need to select the columns that we want and so the first one is name which comes from the charge table which is this one over here and the second one is name that comes from the mentor table which is this one over here and here is our result so that’s how a self join works so until now we have seen uh joint conditions which are pretty strict and and straightforward right so there’s a column in the left table and there’s a column in the right table and they represent the same thing and then you look for an exact match between those two columns and typically they’re an ID number right so one table has the item id the other table also has the item ID and then you look for an exact match and if there’s an exact match you include the row in the join otherwise not that’s pretty straightforward but what I want to show you here is that the join is actually much more flexible and and powerful than that and you don’t always need you know two columns that represent the exact same thing or an exact match in order to write a joining condition in fact you can create your own you know complex conditions and combinations that decide how to join two tables and for this you can simply use the Boolean algebra magic that we’ve learned about in this course and that we’ve been using for example when working on the wear filter so so let us see how this works in practice now I’ve tried to come up with an example that will illustrate this so let’s say that we have a game you know board game or video game or whatever and we have our characters and we have our items okay and in our game um a character cannot simply use all of the items in the world okay there is a limit to which items a character can use and a limit is based on the following rule um let me write it here as a comment and then we will uh use it in our logic so a character can use any item for which the power level is equal or greater than the characters experience divided by 100 okay so this is just a rule uh that exists in our game and now let us say that we wanted to get a list of all characters and the items that they can use okay and this is clearly uh a case where we would need a join so let us actually write this query I will start by getting my data from fantasy. characters and I will call this c as a shorthand and I will need to join on the items table right and what is the condition of the join the condition of the join is that the character’s experience divided by 100 is greater or equal than the items power level and I forgot here to add a short hand I for the items table so this is the condition that refects our Rule and out of this table that I’ve created I would like to see the characters name and the characters experience divided by 100 and then I would like to see the items name and the items power to make sure that my um join is working as intended so let us run this and look at the result so this looks a bit weird because we haven’t given a label to this column but basically I can see um that I have Gandalf and his experience divided by 100 is 100 and he can wear the item Excalibur that has a power of 100 which satisfies our condition let me actually order by character name so that I can see in one place all of the items that a character can wear so we can see that Aragorn is first and his experience divided by 100 is 90 and then uh this is the same in all all of these rows that we see right now but then we see all of the items that Aragorn is allowed to use and we see their power and in each case you will see that their power does not exceed this value on the left so the condition uh that we wrote works as intended so as you can see what we have here is a Boolean expression just like the ones we’ve seen before which is a logical statement that eventually if you run it it evaluates to either true or false and all of the rules that we’ve seen for Boolean Expressions apply here as well for example I can decide that this rule over here does not apply to Mages because Mages are special and then I can say that if a character is Mage then I want them to be able to use all of the items well how can I do this in this query can you pause the video and figure it out so what I can do is to Simply expand my Boolean expression by adding an or right and what I want to test for is that character class equals Mage so let me check for a second that I have class and I have Mage so this should work and if I run this going through the result I will not do it but you can uh do it yourself and and verify for yourself that if a character is a Mage you will find out that they can use all of the items and this of course is just a Boolean expression um in which you have two statements connected by an or so if any of this is true if at least one of these two is true then the whole statement will evaluate to true and so the row will match if you have trouble seeing this then go back to the video on the Boolean algebra and uh everything is explained in there so this is just what we did before when we simulated The Joint in the spreadsheet you can imagine taking the left side table which is uh characters and then going row by row and then for the first row you check all of the rows in the right side table which is items all of the rows that have a match but this time you won’t check if the ID corresponds you will actually run this expression to see whether there is a match and when this expression evaluates as true you consider that to be a match and you include the row in the join however if this condition does not evaluate to true it’s not a match and so the row is not included in the join so this is simply a generalization from the exact match which shows you that you can use any conditions in order to join uh two tables now I’ve been pretending that there is only one type of join in SQL but that is actually not true there are a few different types of join that we need to know so let us see uh what they are and how they work now this is the query that we wrote before and this is exactly how we’ve written it before and as you can see we’ve simply specified join but uh it turns out that what we were doing all the time was something called inner join okay and now that I’ve written it explicitly you can see that if I rerun the query I will get exactly the same results and this is because the inner join is by far the most common type of join that you find in SQL and so in many uh styles of SQL such as the one used by bigquery they allow you to skip this specification and they allow you to Simply write join and then it is considered as an inner join so when you want to do an inner join you have the choice whether to specify it explicitly or to Simply write join but what I want to show you you now is another type of join called Left join okay and to see how that works I want to show you um how we can simulate this query in the spreadsheet so as you can see this is very similar to what we’ve done before I have the query uh that I want to simulate and notice the left join and then I have my two tables now what is the purpose of the left join in the previous examples which were featuring the inner join we’ve seen that when we combine two tables with an inner join the resulting table will only have rows that have a match in both tables okay so what we did is that we went through every Row in the characters table and if it had a match in the inventory table we kept that row but if there was no match we completely discarded that row but what if we wanted in our resulting table to see all of the characters to make sure that our list of characters was complete regardless of whether they had a match in the inventory table this is what left join is for left join exists so that we can keep all of the rows in the left table whether they have a match or not so let us see that in practice okay so when we need to do a left join between characters and inventory so first of all I need to determine the structure of the resulting table and to do this I will take all of the columns from the left table and all of the columns from the right table nothing new there next step let us go row by Row in the left table and look for matches so we have Aragorn and he actually has two matches uh by now we’ve uh remembered this so these two rows have a match in character id with the ID of characters so I will take these two rows and add them to my resulting table next is Legolas and I see a match here so I will take the rows where Legolas matches and put it here it’s only one row actually gimly has also a single match so I will create the row over here um and so this is the match for gimly and of course I can ensure that I’m doing things correctly by looking at this ID column and uh this character id column over here and they have to be identical right if they’re not then I’ve made a mistake and finally we come to Frodo now Frodo you will see does not have a match in this table so before we basically discarded this row because it had no match right now though we are dealing with the left join that means that all of the rows in the characters table need to be included so I don’t have a choice I need to take this row and include it and add it here and now the question is what values will I put in here well I cannot put any value from the inventory table because I don’t have a match so the only thing that I can do is to put NS in here NS of course represent the absence of data so they’re perfect for this use case and that basically completes uh the sourcing part of our left join now you may have noticed that there is an extra row here in inventory which does not have a match right it is referred into character id 10 but there is no character id 10 so here the frao row also did not have a match but we included it so should we include this row as well the answer is no why not because this is a left joint okay so left joint means that we include all of the rows in the left table even if they don’t have a match but we do not include rows in the right table when they do not have a match okay this this is why it’s a left join so but if you’re still confused about this don’t worry because it will become clearer once we see the other types of join and of course for the sake of completeness I can actually finish the query by selecting my columns which would be the uh character id and the character name and the item ID and the item quantity and this is my final result and in the case of Frodo we have null values which tells us that this row found no match in the right table which in this case means that Frodo does not have any items now that you understand the left join you can also easily understand the right joint it is simply the symmetrical operation to the left joint right right so whether you do characters left joint inventory or you do inventory right join characters the result will be identical it’s just the symmetrical operation right this is why I wrote here that table a left joint b equals table B right joint a so hopefully that’s pretty intuitive but of course if I I did characters right join inventory then the results would be reversed because I would have to keep all of the rows of inventory regardless of whether they have a match or not and only keep rows in characters which have a match so if you experiment for yourself on the data you will easily convince yourself of this result let us now see the left joint in practice so remember the query from before um where we take each character and then we see their Mentor this is the code exactly as we’ve written it before and so now you know that this is an inner join because when you don’t specify what type of join you want SQL assumes it’s an inner join at least that’s what the SQL in bigquery does and you can see that if I write inner join um I think I have a typo there uh the result is absolutely identical and in this case we’re only including characters who have a mentor right we are missing out on characters who don’t have a mentor meaning that Mentor ID is null because in the inner join there is no match and so they are discarded but what would happen if I went here and instead turn this into a left join what I expect to happen is that I will keep all of my characters so all of the rows from the left side table regardless of whether they have a match or not regardless of whether they have a mentor or not and so let us run this and let us see that this is in fact the case I now have a row for each of my characters and I have a row for Gandalf even though Gandalf does not have mentor and so I have a null value in here so the left join allows me to keep all of the rows of the left table now we’ve seen the inner join the left join and the right join which are really the same thing just symmetrical to each other and finally I want to show you the full outer join this is the last type of join that I want to that I want to show you now you will see that a full outer joint is like a combination of all of the joints that we’ve seen until now so a full outer join gives us all of the rows uh that have a match in the two tables plus all of the rows in the left table that don’t have a match with the right table plus all of the rows in the right table that don’t have a match in the left table so let us see how that works in practice what I have here is our usual query but now as you can see I have specified a full outer join so let us now simulate this join between the two tables now the first step as usual is to take all of the columns from the left table and all of the columns from the right table to get the structure of the resulting table and now I will go row by Row in the left table so as usual we have Aragorn and you know what I’m already going to copy it here because even if there’s not a match I still have to keep this row uh because this is a full outer joint and I’m basically not discarding any row now that I’ve copied it is there a match well I already know from the previous examples that there are two rows uh in the inventory table that match because they have character id one so I’m just going to take them and copy them over here and in the second row I will need to replicate these values perfect let me move on to Legolas and again I can already paste it because there’s no way that I’m going to discard this row but of course we know that Legolas has a m match and moving quickly cuz we’ve already seen this gimly has a match as well and now we come to Frodo now Frodo again I can already copy it because I’m keeping all the rows but Frodo does not have a match so just like before with the left join I’m going to keep this row but I’m going to add null values in the columns that come from the invent table so now I’ve been through all of the rows in the left table but I’m not done yet with my join because in a full outer join I have to also include all of the rows from the right table so now the question is are there any rows in the inventory table that I have not considered yet and for this I can check the inventory ID from my result 1 2 3 4 and compare it with the ID from my table 1 2 3 4 5 and then I realize that I have not included row number five because it was not selected by any match but since this is a full outer join I will add this row over here I will copy it and of course it has no correspondent uh in the left table so what do I do once again I will insert null values and that completes the first phase of my full outer join the last phase is always the same right pick the columns that are listed in the select so you have the ID the name Item ID and quantity and this completes my full outer join so remember how I said that a full outer join is like an inner join plus a left join plus a right join here is a visualization that demonstrates now in the result the green rows are the rows in which you have a match on the left table and the right table right and these rows correspond to the inner join and if you run an inner join this this will be the only rows that are returned right now the purple row is including a row that is present in the left table but does not have any match in the right table so if you were to run a left join what would the result be a left joint would include all of the green rows because they have a match and and additionally they would also include the purple row because in the left joint you keep all of the rows from the left if on the other hand you were to run a right join and you wouldn’t like swap the names of the tables or anything right you would do characters right join inventory you would get of course all of the green rows because they are a match Additionally you would get the blue row at the end because this row is present in the right table even though there’s no match and in the right join we want to keep all the rows that are in the right table and finally in a full outer join you will include all of these rows right so first of all all of the rows that have a match and then all of the rows in the left table even though they don’t have a match and finally all of the rows in the right table even though they don’t have a match and these are the three or four types of joint that you need to know and that you will find useful in solving your problems now here’s yet another way to think about joints in SQL and to visualize joints which you might find helpful so one way to think about SQL tables is that a table is a set of rows and that joints correspond to different ways of uh combining sets and you might remember this from school this is a v diagram it represents the relation uh between uh two sets and the elements that are inside these two sets so you can take set a to be our left table uh containing all of the rows from um the left table and set B to be our right table with all of the rows from the right table and in the middle here you can see that there is an intersection between the sets this intersection represents the rows that have a match uh so this would be the rows that I have colored green in our example over here so what will happen if I select if I want to see only the rows that are a match only the rows that belong in both tables let me select this now and you can see that this corresponds to an inner joint because I only want to get the rows that have a match then what would happen if I wanted to include all of the rows in the left table regardless of whether they have a match or not to what type of join does that correspond I will select it here and you can see that that corresponds to a left join the left join produces a complete set of records from table a with the matching records in table B if there is no match the right side will contain null likewise if I wanted to keep all of the rows in uh table B including the ones that match with a I would of course get a right join which is just symmetrical to a left join finally what would I have to do to include all of the rows from both tables regardless of whether they have a match or not if I do this then I will get a full outer join so this is just one way to visualize what we’ve already seen there is one more thing you can actually realize from this uh tool which is in some cases you might want to get all of the records that are in a except those that match in B so all of the record that records that a does not have in common with b and you can see how you can actually do this this is actually a left join with an added filter where the b key is null so what does that mean the meaning will be clear if I go back to our example for the left join you can see that this is our result for the left join and because Frodo had no match in the right table the ID column over here is null so if I take this table and I apply a filter where ID where inventory ID is null I will only get this result over here and this is exactly the one row in the left table that does not have a match in the right table so this is more of a special case you don’t actually see this a lot in practice but I wanted it wanted to show it briefly to you in case you try it and get curious about it likewise the last thing that you can do you could get all of the rows from A and B that do not have a match so the set of Records unique to table a and table B and this is actually very similar you do a full outer join and you check that either key is null so either inventory ID is null or character id is null and if you apply that filter you will get these two rows which is the set of rows that are in a and only in a plus the rows that are in B and only in B once again I’ve honestly never used this in practice I’m just telling you for the sake of completeness in case you get curious about it now a brief but very important note on how SQL organizes data so you might remember from the start of the course that I’ve told you that in a way SQL tables are quite similar to spreadsheet tables but there are two fundamental difference one difference is that each SQL table has a fixed schema meaning we always know what the columns are and what type of data they contain and we’ve seen how this works extensively the second thing was that SQL tables are actually connected with each other which makes SQL very powerful and now we are finally in a position to understand just exactly how SQL tables can be connected with each other and this will allow you to understand how SQL represents data so I came here to DB diagram. which is a very uh nice website for building representations of SQL data and this is uh this type of um of chart of representation that we see here is also known as ER as you can see me writing here which is stands for entity relationship diagram and it’s basically a diagram that shows you how your data is organized in your SQL system and so you can see a representation of each table uh this is the example that’s shown on the web website and so you have three tables here users follows and posts and then for each table you can see the schema right you can see that the users table has four columns one is the user ID which is an integer the other is the username which is varar this is another way of saying string so this is a piece of text rooll is also a piece of text and then you have a Tim stamp that shows when the user was created and the important thing to notice here is that these tables are actually they’re not they don’t exist in isolation but they are connected with each other they are connected through these arrows that you see here and what do these arrows represent well let’s look at the follows table okay so each row of this table is a fact shows that one user follows another and so in each row you see the ID of the user who follows and the ID of the user who is followed as well as the time when this event happened and what are these uh arrows telling us they’re telling us that the IDS in this table are the same thing as the user ID column in this table which means that you can join the follows table with the users table to get the information about the two users that are here the user who is following and the user who is followed so like we’ve seen before a table has a column which is the same thing as another tables column which means that you can join them to combine their data and this is how in SQL several tables are connected with each other they are connected by logical correspondences that allow you to join those tables and combine their data likewise you have the post table and each row represent a post and each post post has a user ID and what this arrow is telling you is that uh you can join on the user table using this ID to get all the information you need about the user who has created this post now of course as we have seen you are not limited to joining the tables along these lines you can actually join these tables on whatever condition you can think of but this is a guarantee of consistency between these tables that comes from how the data was distributed and it’s a guarantee it’s a promise that you can get the data you need by joining on these specific columns and that is really all you need to know in order to get started with joints and use them to explore your data and solve SQL problems to conclude this section I want to go back to our diagram and to remind you that from and join are really one and the same they are the way for you to get the data that you need in order to answer your question and so when the data is in one table alone you can get away with just um using the from and then specifying the name of the table but often your data will be distributed in many different tables so you can look at the ER diagram such as this one if you have it to figure out how your uh data works and then once you decided which tables you want to combine you can write a from which combines with a join and so create a new table uh which is a combination of two or more tables and then all of the other operations that you’ve learned will run on top of that table we are finally ready for a in-depth discussion of grouping and aggregations in SQL and why is this important well as you can see I have asked Chad GPT to show me some typical business questions that can be answered by data aggregation so let’s see what we have here What’s the total revenue by quarter how many units did did each product sell last month what is the average customer spent per transaction which region has the highest number of sales now as you can see these are some of the most common and fundamental business questions um that you would be asking when you do analytics and this is why grouping and aggregation are so important when we talk about SQL now let’s open our date once again in the spreadsheet and see what we might achieve through aggregation so I have copied here four columns from my characters table Guild class level and experience and I’m going to be asking a few questions the first question which you can see here is what are the level measures by class so what does this mean well earlier in the course we looked at aggregations and we call them simple aggregations because we were running them over the whole table so you might remember that if I select the values for level here I will get a few different aggregations in the lower right of my screen so what you can see here is that I have a count of of 15 which means that there are 15 rows for level and that the maximum level is 40 the minimum is 11 and then I have an average level of 21.3 more or less and if you sum all the levels you get 319 so this is already some useful information but now I would like to take it a step further and I would like to know this aggregate value within each class so for example what is the maximum level for warriors and what is the maximum level for Hobbits are they different how do they compare this is where aggregation comes into play so let us do just that now let us find the maximum level Within each class and let us see how we might achieve this now to make things quicker I’m going to sort the data to fit my purpose so I will select the range over here and then go to data sort range and then in the in the advanced options I will say that I want to sort by column B because that’s my class and now as you can see the data is ordered by class and I can see the different values for each class next I will take all the different values for class and separate them just like this so first I have Archer then I have hobbit then I have Mage and finally I have Warrior so here they are they’re all have their own sp right now finally I just need to take to compress each of these ranges so that each of them covers only one row so for Archer I will take the value of the class Archer and then I will have to compress these numbers to a single number and to do that I will use the max function this is the aggregation function that we are using and quite intuitively this function will look at the list of values we’ll pick the biggest one and it will reduce everything to the biggest value and you can also see it here in this tool tip over here doing the same for Hobbit compress all of the values to a single value and then compress all of the numbers to a single number by applying a an aggregation function so I’ve gone ahead and done the same for mage and Warrior and all that’s left to do is to take this and bring all these rows together and this is my result this is doing what I have asked for I was looking to find the maximum level Within each class so I have taken all the unique values of class and then all the values of level within each class I have compressed them to a single number by taking the maximum and so here I have a nice summary which shows me what the maximum level is for each class and I can see that mes are much more powerful than everyone and that Hobbits are much more weaker according to this measure I’ve learned something new about my data now crucially and this is very important in my results I have class which is a grouping field and then level which is an aggregate field okay so what exactly do I mean by this now class is a grouping field because it divides my data in several groups So based on the value of class I have divided my data as you see here so Archer has three values Hobbit has four values and so on level is an aggregate field because it was obtained by taking a list of several values so here we have three here we have four and in the wild we could have a thousand or 100 thousand or Millions it doesn’t matter it’s a list of multiple values and then I’ve taken these values and compressed them down to one value I have aggregated them down to one value and this is why level is an aggregate field and whenever you work with groups and aggregations you always have this division okay you are have some fields that you use for grouping you know for subdividing your data and then you have some fields on which you run aggregations and aggregations such as for example looking at a list of value and taking the maximum value or the average or the minimum and so on aggregations are what allow you to understand the differences between groups so after aggregating you can say oh well the the Mages are certainly much more powerful than the hobbits and so on and if you look work with the dashboards like Tableau or other analytical tools you will see that another way to refer to these terms is by calling the grouping Fields dimensions and the aggregate Fields measures okay so I’m just leaving it here you can say grouping field and aggregate field or you can talk about dimensions and measures and they typically refer to the same type of idea now let’s see how I can achieve the same result in SQL so I will start a new query here and I want to get data from fantasy. characters and after I’ve sourced this table I want to Define my groups okay so I will use Group by which is my new clause and then here I will have to specify the grouping field I will have to specify the group that I want to use in order to subdivide the data and that group is class in this case after that I will want to define the columns that I want to see in my result so I will say select and first of all I want to see the class and then I want to see the maximum level within each class so if I run this you will see that I get exactly the same result that I have in Google Sheets so we have seen this before Max is an aggregation function it takes a list of Val vales and then compresses them down to a single value right except that before we were running it on at the level of the whole table right so if I select this query alone and run it what do you expect to see I expect to see a single value because it has looked at all the levels in the table and it has simply selected the biggest one it has reduced all of them to a single value however if I run it after defining a group buy then this will run not on the whole table at once it will run within each group identified by my grouping field and we’ll compute the maximum within that group and so the result of this will be that I can see the maximum level for each group now I’m going to delete this and I don’t need to limit myself to a single aggregation I can write as many aggregations as I wish so I will put this down here and I’ll actually give it a label so that it makes sense and then I will write a bunch of other aggregations such as count star which basically is the number of values within that class um I can also look at the minimum level I can also look at the average level so let’s run this and make sure that it works so as you can see we have our unique values for class as usual and then and for each class we can compute as many aggregated values as we want so we have the maximum level the minimum level and we didn’t give a label to this so we can call it average level and then number of values n values is not referring to level in itself it’s a more General aggregation which is simply counting how many examples I have of each class right so I know I have four Mages three archers four Hobbits and four Warriors by looking at this value over here and here’s another thing I am absolutely not limited to the level column as you can see I also have the experience column which is also an integer and the health column which is a floating Point number so I can get the maximum health and I can get the minimum [Music] experience and it all works all the same all the aggregations are computed within each class but one thing I need to be really careful of is the match between the type of aggregation that I want to run and the data type of the field on which I plan to run it so all of these that we show here they’re number columns right either integers or floats what would happen if I ran the average aggregation on the name column which is a string what do you expect to happen you can already see that this is an error why no matching signature for aggregate function average for a type string so it’s saying this function does not accept the type string it accepts integer float and all types of number columns but if you ask me to find the average between a bunch of strings I have no idea how to do that so I can add as many aggregations as I want within my grouping but the aggregations need to make sense but these Expressions can be as complex as I want them to be so instead of taking the average of the name which is a string it doesn’t make sense I could actually run another function instead of this inside of this which is length and what I expect this to do is that for each name it will count how long that name is and then after I’ve done all these counts I can aggregate them uh I could take the average for them and what I get back is the average name length within each class doesn’t sound really helpful as a thing to calculate but this is just to show you that these Expressions can get quite complex now whatever system you’re working with it will have a documentation in some place which lists all the aggregate functions that you have at your disposal so here is that page for big query and as you can see here we have our aggregate functions and if you go through the list you will see some of the ones that I’ve shown you such as count Max mean and some others that uh I haven’t shown you in this example such as sum so summing up all the values um any value which simply picks uh one value I think it it happens at random and U array a which actually built a list out of those values and so on so when you need to do an analysis you can start by asking yourself how do I want to subdivide the data what are the different groups that I want to find in the data and then after that you can ask yourself what type of aggregations do I need within each group what do I want to know um about each group and then you can go here and try to find the aggregate function that works best and once you think you found it you can go to the documentation for that function and you can read the description so Returns the average of non-null values in an aggregated group and then you can see what type of argument is supported for example average supports any numeric input type right so any data type that represents a number as well as interval which represents a space of time now in the previous example we have used a single grouping field right so if we go back here we have our grouping field which is class and we only use this one field to subdivide the data but you can actually use multiple grouping Fields so let’s see how that works what I have here is my items table and for each item we have an item type and a rarity type uh and then for each item we know the power so what would happen if we wanted to say to see the average Power by item type and Rarity combination one reason we might want to see this is that we might ask ourselves is within every item type is it always true that if you go from common to rare to Legendary the power increases is this true for all item types or only for certain item types let us go and find out so what what I’m going to do now is that I’m going to use two fields to subdivide my data I’m going to use item type and Rarity and to do this as a first step I will sort the data so that it makes it convenient for me so I will go here and I will say sort range Advanced ranged sorting option and first of all I want to sort by column A which is item type and I want to add another sort column which will be column B and you can see that my data has been sorted next I’m going to take each unique combination of the values of my two grouping Fields okay so the first combination is armor common so I’m going to take this here and then I’m going to to write down all the values that come within this combination so in this case we only have one value which is 40 next I have armor legendary and within this combination I only have one value which is 90 next I have armor rare So for armor rare I actually have two values so I’m going to write them here next we have potion and common for this we actually have three values so I’m going to write them here so I’ve gone ahead and I’ve done it for each combination and you can see that each unique combination of item type and Rarity I’ve now copied the re relevant values and now I need to get the average power with in these combinations so I will take the first one put it over here and then I will take the average of the values this is quite easy because there’s a single value so I’ll simply write 40 next I will take the armor legendary combination and once again I have a single value for armor rare I have two values so I will actually press equal and write average to call the the spreadsheet function and then select the two values in here to compute the average and here we have it and I can go on like this potion common get the average Within These values potion legendary is a single value so I’ve gone ahead and completed this and this gives me the result of my query here I have all the different combinations for the values of uh what were they item type and Rarity and within each combination the average power so to answer my question is it that within each item type the power grows with the level of Rarity where for armor it goes from 40 to 74 to 90 so yes for potion we don’t have um a rare potion but basically it also grows from common to Legendary and in weapon we have uh 74 87 and 98 so I would say yes within each item type power grows with the level of Rarity so what are these three fields in the context of my grouping well item type is grouping field and Rarity is also a grouping field and the average power within each group is a aggregate field right so I am now using two grouping fields to subdivide my data and then I’m Computing this aggregation within those groups so let us now figure figure out how to write this in SQL it’s actually quite similar to what we’ve seen before we have to take our data from the items table and then we want to group by and here I have to list my grouping Fields okay so as I’ve said I have two grouping Fields they are item type and and Rarity so this defines my groups and then in the select part I will want to see my grouping fields and then within each group I will want to see the average of power I believe we used yes so I will get the average of power and here are our results just like in the sheets now as a tiny detail you may notice that power here is colored in blue and the reason for this is that power is actually a big query function so if you do power of two three you should get uh eight because it calculates the two to to to the power of three so it can be confusing when power is the name of a column because B query might think it’s a function but there’s an easy way to remedy this you can just use back ticks and that’s your way of telling big query hey don’t get confused this is not the name of a function this is actually the name of a column and as you can see it also works and it doesn’t create issues and just like before we could add as many aggregations as we wanted and for example we could take the sum of power also on other fields not just on Power and everything would be computed within the groups defined by the two grouping fields that I have chosen as expected now now let us see where Group by fits in The Logical order of SQL operations so as you know a SQL query starts with from and join this is where we Source the data this is where we take the data that we need and as we learned in the join section we could either just specify a single table in the from clause or we could specify a join of two or more tables either way the result is the same we have assembled the table where our data leaves and we’re going to run our Pipeline on that data we’re going to run all the next operations on that data next the work Clause comes into play which we can use in order to filter out rows that we don’t need and then finally our group group Pi executes so the group Pi is going to work on the data that we have sourced minus the rows that we have excluded and then the group Pi is going to fundamentally alter the structure of our table because as you have seen in our examples the group I basically compresses down our values or squishes them as I wrote here because in the grouping field you will get a single Row for each distinct value and then in the aggregate field you will get an aggregate value within each class okay so if I use a group bu it’s going to alter the structure of my table after doing the group bu I can compute my aggregations like you’ve seen in our examples so I can compute uh minimum maximum average sum count and and all of that and of course I need to do this after I have applied my grouping and after that after I I’ve computed my aggregations I can select them right so I can choose which columns to see um and this will include the grouping fields and the aggregated fields we shall see this more in detail in a second and then finally there’s all the other oper ations that we have seen in this course and this is where Group by and aggregations fit in our order of SQL operations now I want to show you an error that’s extremely common when starting to work with group pi and if you understand this error I promise you you will avoid a lot of headaches when solving SQL problems so I have my IDE items table here again and you can see the preview on the right and I have a simple SQL query okay so take the items table Group by item type and then show me the item type and the average level of power within that item type so so far so good but what if I wanted to see what I’m showing you here in the comments what if I wanted to see each specific item the name of that item the type of that item and then the average Power by the type of that item right so let’s look at the first item chain mail armor this is a armor type of item and we know that the average power for armors is 69.5 so I would like to see this row and then let’s take Elven bow now Elven baow is a weapon as you can see here the average powerful weapons is 85. 58 and so I would like to see that now stop for a second and think how might I achieve this how might I modify my SQL query to achieve this oh and there is a error in the column name over here because I actually wanted to say name but let’s see how to do it in the SQL query so you might be tempted to Simply go to your query and add the name field in order to reproduce What you see here and if I do this and I run it you will see that I get an error select expression references column name which is neither grouped nor aggregated understanding this error is what I want to achieve now because it’s very important so can you try to figure out on your own why this query is failing and what exactly this error message means so I’m going to go back to my spreadsheet and get a copy of my items table and as you can see I have copied the query that doesn’t work over here so let us now uh go ahead and reproduce this query so I have to take the items table here it is and then I have to group by item type and as you can see I’ve already sorted by item type to facilitate our work and then for each item we want to select the item type so that would be armor and we want to select the average power so to find that I can run a spreadsheet function like this it’s called average and get the power over here and then I am asked to get the name so if I take the name for armor and put it here this is what I have to add and here you can already see the problem that we are facing for this particular class armor there is a mismatch in the number of rows that each column is providing because as an effect of group by item type now there is only one row in which item type is armor and as an effect of applying average to power within the armor group now there is only one row of power corresponding to the armor group but then when it comes to name it’s neither present in a group Pi nor is it present in an aggregate function and that means that in the case of name we still have four values four values instead of one and this mismatch is an issue SQL cannot accept it because SQL doesn’t know how to combine columns which have different numbers of rows in a way it’s like SQL is telling us look you’ve told me to group the data by item type and I did so I found all the rows that correspond to armor and then you told me to take the average of the power level for those rows and I did but then you asked me for name now the item type armor has four names in it what am I supposed to do with them how am I supposed to combine them how am I supposed to squish them into a single value you haven’t explained how to do that so I cannot do it and this takes us to a fundamental rule of SQL something I like to call the law of grouping and the law of grouping is actually quite simple but essential it tells you what type of columns you can select after you’ve run a group pi and there are basically two types of columns that you can select after running a group bu one is grouping Fields so those those are the columns that appear after the group by Clause those are the columns you are using to group the data and two aggregations of other fields okay so those are fields that go inside a Max function a mean function a sum function a count function and so on now those are the only two types of columns that you can select if you try to select any other column you will get an error and the reason you will get an error is Illustrated here after a group Pi each value in the grouping Fields is repeated exactly once and then for that value the aggregation makes sure that there’s only one corresponding value in the aggregated field in this case there’s only one average power number within each item type however any other field if it’s not a grouping field and you haven’t run an aggregation on it you’re going to get all of its values and then there’s going to be a mismatch so the law of grouping is made to prevent this issue now if we go back to our SQL hopefully you understand now better why this error Isen happening and in fact this error message makes a lot more sense after you’ve heard about the law of grouping you are referencing a column name which is neither grouped nor aggregated so how could we change this code so that we can include the column name without triggering an error well we have two options either we turn it into a grouping field or we turn it into an aggregation so let’s try turning it into an aggregation let’s say for example that I said mean of name what do you expect would happen in that case so if I run this you will see that I have my grouping by item type I have the average power within each item type and then I have one name and so when you run mean on a sequence of uh text values what it does is that it gives you the first value in alphabetical order so we are in fact seeing the first name in alphabetical order within each item type so we’ve overcome the error but this field is actually not very useful we don’t really care to see what’s the first name in alphabetical order within each type but at least our aggregation is making sure that there’s only one value of name for each item type and so the golden rule of grouping is respected and we don’t get that error anymore the second alternative is to take name and add it as a grouping field which simply means putting it after item type type in here now what do you expect to happen if I run this query so these results as they show here are a bit misleading because there’s actually the name column is hidden so I will also add it here and as you can see I can now refer the name column in select without an aggregation why because it is a grouping field okay and what do we see here in the results well we’ve seen what happens when you Group by multiple columns that the unique combinations of these columns end up subdividing the data so in fact our values for average power are not divided by item type anymore we don’t have the average power for armor potion and weapon anymore we have the average power for an item that’s type armor and it’s called chain mail armor and that is in fact there’s only one row that does that and has power 70 likewise we have the average power for uh any item called cloak of invisibility which is of item type armor and again there’s only one example of that so we’ve overcome our error by adding name as a grouping field but we have lost the original group division by item type and we have subdivided the data to the point that it doesn’t make sense anymore so as you surely have noticed by now we made the error Disappear by including name but we haven’t actually achieved our original objective which was to show the name of each item the item type and then the average power within that item type well to be honest my original objective was to teach you to spot this error and understand the law of grouping but now you might rightfully ask how do I actually achieve this and the answer unfortunately is that you cannot achieve this with group Pi not in a direct simple way and this is a limitation of group Pi which is a very powerful feature but it doesn’t satisfy all the requirements of aggregating data the good news however is that this can be easily achieved with another feature called window functions now window functions are the object of another section of this course so I’m not going to go into depth now but I will write the window function for you just to demonstrate that it can be done easily with that feature so I’m going to go down here and write a a new query I’m going to take the items table and I’m going to select the name and the item type and then I’m going to get the average of power and again I’m going to use back ticks so bigquery doesn’t get confused with the function that has the same name and then I’m going to say take the average of power over Partition by item type so this is like saying average of power based on this item type and I will call this average Power by type and if I select this and run the query you will see that I get what I need I have a chain mail armor it’s armor and the average power for an armor is 69.5 so this is how we can achieve the original objective unfortunately not with grouping but with window functions now I want to show you how you can filter on aggregated values after a group buy so what I have here is a basic Group by query go to the fantasy characters table group it by class and then show me the class and within each class the average of the experience for all the characters in that class and you can see the results here now what if I wanted to only keep those classes where the average experience is at least 7,000 how could I go and do that one Instinct you might have is to add a wear filter right for example Le I could say where average experience is greater than or equal to 7,000 and if I run this I get an error unrecognized name average experience the wear filter doesn’t work here maybe it’s a labeling problem what if I actually add the logic instead of the label so what if I say where average of experience is bigger or equal to 7,000 well an aggregate function is actually not allowed in the work Clause so this also doesn’t work what’s happening here now if we look at the order of SQL operations we can see that the where Clause runs right after sourcing the data and according to our rules over here an operation can only use data produced before it and doesn’t know about data produced after it so the wear operation cannot have any way of knowing about aggregations which are computed later after it runs and after running the group bu and this is why it is not allowed to use aggregations inside the wear filter luckily SQL provides us with a having operation which works just like the wear filter except it works on aggregations and it works on aggregations because it happens after the group buy and after the aggregations so to summarize you can Source the table and then drop rows before grouping this is what the wear filter is for and then you can do your grouping and Compu your aggregations and after that you have another chance to drop rows based on a filter that runs on your aggregations so let us see how that works in practice now instead of saying where average experience actually let me just show you what we had before this is our actual result and we want to keep only those rows where average experience is at least 7,000 so after group Pi I will write having and then I will say average experience greater than or equal to 7,000 let me remove this part here run the query and you can see that we get what we need and you might be thinking well why do I have to to write down the function again can’t I just use the label that I’ve assigned well let’s try it and see if it still works and the answer is that yes this works in Big query however you should be aware that bigquery is an especially userfriendly and funto use product in many databases however this is actually not allowed in the sense that the database will not be kind enough to recognize your label in the having operation instead you will have to actually repeat the logic as I’m doing now and this is why I write it like this because I want you to be aware of this limitation another thing that you might not realize immediately is that you you can also filter by aggregated columns which you are not selecting so let’s say that I wanted to group by class and get the average experience for each class but only keep classes with a high enough average level I am perfectly able to do that I just have to write having average level greater than or equal to 20 and after I run this you will see that instead of four values I actually get three values so I’ve lost one value and average level is not shown in the results but I can of course show it and you will realize that out of the values that have stayed they all respect this condition they all have at least 20 of average level so in having you are free to write filters on aggregated values regardless of the columns that you are selecting so to summarize once more you get the data that you need you drop rows that are not needed you can then Group by if you want subdivide the data and then compute aggregations within those groups if you’ve done that you have the option to now filter on the result of those aggregations and then finally you can pick which columns you want to see and then apply all the other operations that we have seen in the course we are now ready to learn about window function a very powerful tool in SQL now window functions allow us to do computations and aggregations on multiple rows in that sense they are similar to what we have seen with aggregations and group bu the fundamental difference between grouping and window function is that grouping is fundamentally altering the structure of the table right because if I go here and I take this items table and I group by item type right now I’m looking at uh about 20 rows right but if I were to group the resulting table would have one two three three rows only because there’re only three types of items so that would significantly compress the structure of my table and in fact we have seen with the basic law of grouping that after you apply a group ey you have to work around this fundamental alteration in the structure of a table right because here you can see that the items table has 20 rows but how many rows do you expect it to have after you Group by item type I would expect it to have three rows because there’s only three types of items and so my table is being compressed my table is changing its structure and the basic law of grouping teaches you how to work with that it tells you that if you want a group by item type you can just select power as is because your table will have three rows but you have 20 values of power so you have to instead select an aggregation on power so that you can compress those values to a single value for each item type and if you want to select name you also cannot select name as is you also have to apply some sort of aggregation for example you could put the names into a list an array uh or so on but window functions are different window functions allow us to do aggregations allow us to work on multiple values without however altering the structure of the table without changing the number of rows of the table so let us see how this works in practice now imagine that I wanted to get the sum of all the power values for my items so what is the total power for all of my items so you should already be aware of how to do this in SQL to just get that sum right I can I can do this by getting my fantasy items table and then selecting the sum over the power so if I take this query and paste it in big query I will get exactly that and this now is a typical aggregation right the sum aggregation has taken 20 different values of power and has compressed them down to one value and it has done the same to my table it’s taken 20 different rows to my table and it has squished them it has compressed them down to one row and this is how aggregations work as we’ve seen in the course but what if I wanted to show the total power without altering the structure of the table what if I wanted to show the total power on every Row in other words I can take the sum of all the values of power and this is the same number that we’ve seen in B query and I can paste it over here and hopefully I can now expand it and this is exactly what I meant what if I can take that number and put it on every row and why would I want to do this well there’s several things that I can do with this setup right for example I could go here um for Phoenix Feather which is power 100 and I could say take this 100 and divide it by the total power in this row and then turn this into a percentage and now I have this 6.5 approximately percentage and thanks to this I can say Hey look um the phoenix feather covers about 6 or 7% of all the power that is in my items of all the power that is in my game and that might be a useful information a more mundane concern uh could be that this is uh your your budget so this is the stuff you’re spending on and instead of power you have the the price of everything and then you get the total sum right which is maybe what you spent in a month and then you want to know going at the movies what percent of your budget it covered and so on now I will delete this value because we’re not going to use it and let us see what we need to write to obtain this result in SQL so once again we go to the fantasy items table and I’m going to move it a bit down and then we select the sum power just just like before except that now I’m going to add this over open round bracket and close round bracket and this is enough to obtain this result well to be precise when I write this in B query I will want to see a few columns as well so I will want to see the name item tab Ty and power and here I will need a comma at the end as well as the sum power over and I will also want to give a label to this just like I have in the spreadsheet now this is the query that will reproduce What you see here in the spreadsheet so how this works is that the over keyword is signaling to SQL that you want to use a window function and this means that you will get an aggregation you will do a calculation but you’re not going to alter the structure of the table you are simply going to take the value and put it in each row this is what the over keyword signals to SQL now because this is a window function we also need to define a window what exactly is a window a window is the part of the table that each row is is able to see now we will understand what this means much more in detail by the end of this lecture so don’t worry about it but for now I want to show you that this is the place where we usually specify the window inside these brackets after the over but we have nothing here and what this means is that our window for each row is the entire table so that’s pretty simple right each row sees the entire table so to understand how the window function is working we always have to think row by row because the results can always be different on different rows so let us go row by row and figure out how this window function is working so now we have the first row and what is the window in this case meaning what part of the table does does this row see well the answer is that this row sees all of the table given that it sees all of the table it has to do the sum of power and so it will take this thing compute a sum over it put it in the cell now that was the first row moving on to the second row now what’s the window here what part of the table does this row see once again it sees all of the table given that it sees all of the table it takes power computes some over it gets the result and puts it in the cell now I hope you can see that the result has to be identical in every cell in every Row in other words because every row sees the same thing and every Row computes the same thing and this is why every Row in here gets the same value and this is probably the simplest possible use of a window function so let us now take this code and bring it to B query and make sure that it runs as intended and like I said in the lecture on grouping you will see that power is blue because bequer is getting confused with its functions so always be best practice to put it into back tis to be very explicit that you are referring to a column but basically what you see here is exactly what we have in our sheet and now of course we have this new field which shows me the total of power on every row and like I said we can use this for several purposes for example I can decide to show for each item what p percentage of total power it covers right that’s what I did before in the sheet so to do this I can take the power and I can divide by this window expression which will give me the total power not sure what happened there but let me copy paste here and I can call this percent total power now this is actually just a division so if I want to see the percentage I will have to also multiply by 100 but we know how to do this and once I look at this we can see that when we have power 100 we have almost 6.5% of the total power so this is the same thing that we did before and this goes to show that you can use these fields for your calculations and like I said if this was your budget you could use this to calculate what percentage of your total budget is covered by each item it’s a pretty handy thing to know now why do I have to take this uh to repeat uh all of this logic over here why can’t I just say give me power divided by some power well as you know from other parts of the course the select part is not aware of these aliases it’s not aware of these labels that we are providing so when I try to do this it won’t recognize the label so unfortunately if I want to show both I have to repeat the logic and of course I’m not limited to just taking the sum right what I have here is an aggregation function just like the ones we’ve seen with simple aggregations and grouping in aggregation so instead of sum I could use something like average using the back TI over right I need to remember uh to add the over otherwise it won’t work because it won’t know it’s a window function and I can give it a label and now for each row I will see the same value which is the average of power over the whole data set and you you can basically use any aggregation function that you need it will work all the same few more btics to put in here just to be precise but the result is what we expect now let us proceed with our Explorations so I would like now to see the total power for each row but now I’m not interested in the total power of the data set I’m interested of in the total Power by item type okay so if my item is an armor I want to see the total power of all armors if my have item is a potion I want to see the total power of all potions and so on because I want to compare items within their category I don’t want to compare every item with every item so how can I achieve this in the spreadsheet well let us start with the first r row so I need to check what item type I have and conveniently I have sorted this so we can be quicker now we have an armor so I want to see the total power for armor so what I can do is to get the sum function and be careful to select only rows where the item type is armor and this is what I get and then the next step would be to Simply copy this value and then fill in all of the rows which are armor because for all of the rows but again you have to be careful because the spreadsheet wants to complete the pattern but what I want is the exact same number and then all of the rows that have item type armor will have this value because I’m looking within the item type now I will do it for potion so here I need to get the sum of power for all items that are potions 239 and then make sure to co copy the exact same value and to extend it to all potions and next we have weapons so sum of all power by weapon which is here then copy it and copy it and then let’s see if it tries to complete the pattern it does so I’m just going to go ahead and paste it and now make this a bit nicer and now I have what I wanted to get each row is showing the total power within the items that are the same as the one that we see in the row now how can I write this in SQL so let me go ahead and write it here now two parts of this query will be the same same because we want to get the items table and see these columns but we need to change how we write the window function so once again I want to get the sum of power and I will need now to define a specific window now remember the window defines what each row sees so what do I want each row to see when it takes the sum of power for example what do I want the first row to see when it takes the sum of power I wanted to see only rows which have the item type armor or in other words all the rows with the same item type and I can achieve this in the window function by writing Partition by item type by adding a partition defining the window as a partition by item type means that each row will look at its item type and then we’ll partition the table so that it only sees rows which have the same item type so this row over here will see only these four rows and then you will take the sum of power and then you will put it in the cell and for this uh the second third third and fourth row the result will be the same because they will each see this part of the table when we come to potion so this row over here will say hey what is my item type it’s potion okay then I I will only look at rows that have item type potion and so this will be the window for these four rows and then in those rows I’m going to take power and I’m going to Summit and finally when we come to to these rows over here so starting with this row it will look at its item type and say okay I have item type uh weapon let me look at all the rows that share the same item type and so each window will look like this so let me color it properly its window will look like this and then it will take the sum of these values of power that fit in the window and put it in the cell second cell sees the same window sums over these values of power puts it in the cell and this is how we get the required result this is how we use partitioning in window functions so let’s go now to Big query and make sure that this actually works and when I run this I didn’t put a label but you can see that I’m basically getting the same result when I have a weapon I see a certain value when I have a potion I see uh another one and when I have an armor I see the third value so now for each item I am seeing the total power not over the whole table but within the item type now next task find the cumulative sum of power which is this column over here what is a cumulative sum it’s the sum of the powers of this item plus all of the items that are less powerful so to do this in the spreadsheet I will first want to reorder my data because I want to see it simply in order of power so I will actually take this whole range and I will go to data sort range Advance options and I will say that the data has a header row so that I can see the names of the columns and then I will order by power ascending so as you can see my records have now been sorted in direction of ascending power now how do I compute the cumulative sum of power in the first row all we have is 30 so the sum will be 30 in the second row I have 40 in this row plus 30 before so E I will have 70 when it comes here I have 50 in this row and then the sum up to now was actually 70 which I can see by looking at these two cells or I can see more simply by looking at the last cell so 50 + 70 will be 820 and proceeding like this I could compute the cumulative power over the whole column now for your reference I have figured out the correct Google Sheets formula that will allow you to compute the cumulative sum of power for our example and I went ahead and computed it so that we have it for all our data now this is is the formula right here and I’m not going to go in depth into it because this is not a course on on spreadsheets but I will show you the formula just in case you’re curious so the sum IF function will take the sum over a range only but it will only consider values that satisfy a certain logical condition so the first argument is the range that we want to sum over and this is the power and the Criterion so what needs to be true for a value to be um to be considered is that this value is lesser than or equal to the level of power in this row so what this formula is saying is take the level of power in this row and then take all the values of power which are lesser or equal and then sum them up this is exactly what our window function does and so our formula reproduces this now if you go and look what’s the way to do a cumulative sum in Google Sheets or what’s the way to do a running total there are other Solutions but they do come with some um pitfalls they do come with some Corner cases so this is a Formula that’s actually reproducing the behavior of SQL now let us go back to actually SQL and see how we would write this so I’m going to take the fantasy items table and I’m still going to select the columns and now I have to write my window function now the aggregation is just the same so take the sum of power and now I have to Define my window now my window is not defined Now by a partition but it is defined by an ordering order by power and when I say order by power in a window function what’s implicit in this is the keyword ask for ascending so this means that the window will order power from the smallest to the biggest and I can choose to write this keyword or not because just like in order by in SQL when you don’t specify it the default value is ascending from smallest to biggest so how does this window work work let’s start with the first row and let’s say we need to fill in this value so I’m going to look at my power level it is 30 and then the window says that I can only see rows where the power level is equal or smaller and what are the rows where the power level is equal or smaller to 30 there’re these rows over here so effectively this this is the only part of the table that this window sees on the first row and then take the sum over power so sum over 30 is 30 move on to the second row the power level is 40 the window says I only see rows where the power level is smaller uh or equal and this includes these two rows over here now take the sum of power over here you get 70 put it in the cell third row I have power level 50 I’m only seeing these rows so take the sum of power over this it’s 120 put it in the cell and I can continue like this until I get to the highest value in my data set it’s 100 never mind that is not the last row because both of the last two rows they have the highest value and when you look at this um when you come to this row and you look at 100 and and you say what’s the window what rows can I see I can see all rows where power is 100 or less and that basically includes all of the table right it includes all of the table so when you take the sum of power you will get the total sum and in fact you can see that in this case the cumulative power is equal to the total power that we computed before just as we would expect so this is easy to see here because we have ordered um our data conveniently but it works in any case and so what the order by does in a window function is that it makes sure that each row only sees rows which come before it given your ordering so if I want to order from the smallest power to the biggest power each row will only see rows that come before it in this ordering so they have the same level of power or lower but they don’t have a higher level of power so let us now take it to Big query and make sure it works as intended and I will add an ordering by power and here I will see the same thing that I’ve shown you in the spreadsheet I notice now that some numbers are different that these two items have 90 instead of 100 but never mind that the logic is the same and the numbers make sense now I’m also able to change the direction of the ordering right so let’s say that I take this field and copy it just the same except that instead of ordering by power ascending I order by power descending so what do you expect to see in this case let’s take a look now what I see here is that each item is going to look at its level of power and then it’s only going to consider items that are just as powerful or more powerful right so it’s the exact same logic but it’s reversed so when you look at the weakest item potion it has 30 and so it is looking at all the items because there’s no weaker item and so it finds the total level of power in our data set but if you go to the strongest item like Excalibur it has a power level of 100 and there’s only two items in the whole data set that have this power level itself and the phoenix feather so if you sum the power over this you get 200 so you can see it’s the exact same logic but now each row only sees items that have the same level of power or higher so when you order inside a window function you can decide the direction of this ordering by using descending or ascending or if you are a lazy programmer you can omit the um ascending key word and it will work just the same because that’s the default and finally we want to compute the cumulative sum of Power by type and you might notice that it is in a way the combination of these two uh requirements so let us see how to do that now the first thing I want to do is to sort our data in order to help us so I’m going to get this whole thing and I’m going to say sort range I’m going to need the advanced options I have a heading row and so first of all I want to order by type and then within each type I want to order by power and this is our data now now for each item I want to show the cumulative sum of power just like I did here except that now I only want to do it within the same item type so if we look at Armor it’s already sorted right so I have power 40 and this is the smallest one so I will just put 40 over here next I have uh this item with power 70 it’s still armor has power 70 and so I’m going to look at these two values and sum them up now I have uh 7 8 so I will take this plus 78 which is the sum of these three values and finally I have um 90 which is the sum of those values and now I’m done with armor right I’m beginning with a new item type so I have to start all over again I’m looking at potions now so we start with 30 that is the smallest value then we move to uh 50 so this is now seeing 30 and 50 uh which is 80 add 60 to 80 that is 140 and finally we want to add we want to add 99 plus 140 which is another way of saying that we want to add these values all the values for potion so this is what we want cumulative sum of power within item type so we do it within the item type and then when we find a new type we start over so to calculate it for weapon I could copy my function from here paste it in weapon and then I would need to modify it right I would need the range to only include weapon so that’s from C10 so go here C10 is the first one and the value that I want to look at here would have to be C10 as well because I want to start by looking at the power level for the for weapon and for some reason it’s purple however it should be correct it should always be the sum of the previous value so we start with 65 then we have 65 + 75 66 75 65 and so on so this is our result it’s cumulative power within the item type and to write this in SQL I will take my previous query over here and now when we Define the window we can simply combine what we’ve done before we can combine the partition buy with the order bu and you need to write them in the following order first the partition and then the order so I will Partition by item type and I will order by power ascending and this will achieve the required result so for each row in this field the window will be defined as follows first Partition by item type right so first of all you can only see rows which have the same item type as you have but then within this partition you can you have to keep only rows where the power is equal or smaller than what you have so in the case of the first item you only get this row likewise in the case of the first potion item you only get this row if you look at the second armor item again it looks it partitions right so it looks at all the items which have armor but then it has to discard those that have a bigger power than itself so it will be looking at these two rows and if for example example we look at the last row over here so this row will say oh okay I’m a weapon so I can only see those that are weapon and then I can only see those that have a level of power that’s equal or smaller than mine and that checks out those are all the rows and in fact the sum over here is equal to the sum of Power by type which is what we would expect so once again let us verify that this works in Big query and I will actually want to order by item type and power just so I have the same ordering as in my sheet and I should be able to see that within armor you have this like growing uh cumulative sum and then once the item changes it starts all over right it starts again at the value it grows it grows it accumulates and then we’re done with potions and then we have weapons and then again it starts and then it grows and it goes all the way to include the total sum of all powers in the weapon item type so here’s a summary of all the variants of Windows that we’ve seen we have seen four variants now in all of those for clarity we’ve kept the aggregation identical right we are doing some over the power field but of course you know that you can use any aggregate function here on any column which is compatible with that aggregate function and then we have defined four different Windows the first one is the simplest one there’s actually nothing in the definition we just say over and this means that it will just look at all the table so every row will see the whole table and so every row will show you the total of power for the whole table simple as that the second window is introducing a partition by item type and what this means in practice is that each row will uh look at its own item type and then only consider rows which share the same exact item type and So within those rows it will calculate the sum of power third window we have an ordering field so what this means is that each row is going to look at its level of power because we are ordering by power and then it’s going to only see rows where the power level is equal or smaller and the reason why we’re looking in this direction is that when we order by power is implicitly uh understood that we want to order by power ascending If instead we ordered by power descending it would be the same just in the opposite direction each row would would look at its level of power and then only consider rows where power is equal or bigger and then finally we have a combination of these two right a we have a window where we use both a partition and an order and so what this means is that uh each row is going to look at its item type and discard all of the rows which don’t have the same item type but then within the rows that remain it’s going to apply that ordering it’s going to only consider rows which have the same level of power or lesser so it’s simply a combination of these two conditions and this is the gist of how window functions work first thing to remember window function provide aggregation but they don’t change the structure of the table they just insert a specific value at each row but after applying a window function the number of rows in your table is the same second thing thing to remember is that in the window definition you get to Define what each row is able to see when Computing the aggregation so when you are thinking about window function you should be asking yourself what part of the table does each row see what’s the perspective that each row has and there are two dimensions on which you can work in order to Define these windows one is the partition Dimension and the other is the ordering Dimension the partition Dimension Cuts up the table based on the value of a column so you will only keep rows that have the same value the order Dimension Cuts up the table based on the ordering of a field and then depending on ascending or descending depending on the direction that you choose you can you can look at rows that are after you in the ordering or you can look at rows that are before you in the ordering and you can pick either of these right either partitioning or ordering or you can combine them and by using this you can Define all of the windows that you might need to get your data now as a quick extension of this I want to show you that you’re not limited to defining windows on single fields on single columns you can list as many columns as you want so in this example I’m going to the fantasy characters table I’m getting a few columns and then I’m defining an aggregation uh on a window function so I’m taking the level uh field and I’m summing it up and then I’m partitioning by two Fields actually by Guild and is alive so what do you expect to happen if I do this this is actually the exact same logic as grouping by multiple fields which we’ve seen in the group ey now the data is not going to be divided by Guild and is not going to be divided by whether the character is alive or not but by the all the mutual combinations between these fields okay so um merkwood and true is one combin ation and so the people in here are going to fit together right so in fact we have two characters here 22 and 26 and their sum is 48 so you can see here that they both get 48 for sum of level and likewise when you look at Sher folk true these three they all end up in the same group and so they all share the same sum of level which is 35 but sh Fulk fals this is another group and they’re actually alone right it’s 12 and then the sum is 12 so again when you Partition by multiple Fields the data is divided in groups that are obtained by all the combinations between the values that these fields can have and if you experiment a bit by yourself you should have an easier time to convince yourself of this likewise the same idea applies to the order uh part of a window we have until now for Simplicity ordered by one field to be honest most times you will only need to order by one field but sometimes you might want to order by different fields so in this example you can see that we are defining our ordering based on two Fields power and then weight and then based on that ordering we calculate the sum of power and this is again a case of cumulative sum however now the ordering is different and you will realize this if we go to the most powerful items in our data these last two which are both at 100 so if you remember when we were ordering by power alone these two uh Fields had the same value in this um window function because when you order just by power they are actually the same they both have 100 but because now we’re ordering by weight and again we’re ordering by weight ascending so from the smallest weight to the biggest weight now the phoenix feather comes first because although it has the same power as Excalibur the Phoenix weather is lighter and because it comes first it has a different value for this aggregation and of course we have the power to to say ascending or descending on each of the fields by which we order so if I wanted to reverse this I could simply write descending after the weight and be careful that in this case descending is only referring to weight it’s not referring to power so this is just as if I’ve wrote this right so the this one can be omitted um because it’s ascending by default but I would write both to be clear and now if I run this you will see that our result is reversed right Excalibur comes first because we have weight descending so it’s heavier and then last we have the phoenix feather which is lighter and again understanding this theoretically is one thing but I do encourage you to experiment with this with your data with exercises and then you will um you will be able to internalize it and now we are back to our schema for The Logical order of SQL operations and it is finally complete again because we’ve seen all of the components that we can use to assemble our SQL query and now the question is where do window functions fit into this well as you can see uh we have placed them right here so what happens is that again you get your data and then the we filter runs dropping rows which you don’t need and then you have a choice whether to do a group by right now if you do a group by you’re going to change the structure of your table it’s not going to have the same number of rows it’s going to have a number of rows that depends of the unique values of your grouping field or the unique combinations of values of your Fields if you have used more than one if you group you will probably want to compute some aggregations and then you may want to filter on those aggregations meaning dropping rows uh based on the values of those aggregations and here is where window functions come into play it is on this result that window functions work so if you haven’t done a group bu then window functions will work on your data after the wear filter runs if you have done a group buy we window functions will work on the result of your aggregation and then after applying the window function you can select which columns you want to show give them uh labels and then all the other parts run right so you can choose to drop duplicates from your result meaning duplicate rows rows which have the same value on every column you can stack together different tables right you can put them on top of each other and then finally when you have your result you can apply some ordering and also you can cut the result you can limit it so you only show a few uh rows and this is where window functions fit into the big scheme of things and there are some other implications of this ordering one interesting one is that if you have computed aggregations such as the sum of a value Within within a um a class um you can actually use those aggregations in the window function so you can sort of do an aggregation of an aggregation but this is uh in my opinion an advanced topic and it doesn’t fit into this um fundamentals course it may fit uh someday in a later more advanced course I want to show you another type of window functions which are very commonly used and very useful in SQL challenges and SQL interviews and these are numbering functions numbering functions are functions that we use in order to number the rows in our data according to our needs and there are several numbering functions but the three most important ones are without any doubt row number dense Rank and rank so let’s let’s see how they work in practice now what I have here is a part of my uh inventory table I’m basically showing you the item ID and the value of each number and conveniently I have ordered our rows uh by value ascending okay and now we are going to number our rows according to the value by using these window functions now I’ve already written the query that I want to reproduce so I’m going to the fantasy inventory table and then I’m selecting the item ID and the item value as you see here and then I’m using uh three window functions so the syntax is the same as what we’ve seen uh in the previous exercise except that now I’m not using an aggregation function over a field like I did before when I was doing a sum of power and so on but I’m using another type of function this is a numbering function okay so this functions over here they don’t actually take a parameter as you can see that there’s nothing between these round brackets because I don’t need to provide it an argument or a parameter all I need to do is to call the function but what really uh what’s really important here is to define the correct window and as you can see in the three examples here the windows are all the same I am simply ordering my rows by value ascending which means that when it’s going to compute the window function every row will look at its own value and then say okay I’m only going to see rows where the value is the same or smaller I’m not going to be able to visualize rows where the value is bigger than mine and this is what the window does so the first row over here will’ll only see value of 30 the second row will see this the third row will see these and so on up until the last row which will see itself and all the other rows as well now let us start with row number so row number is going to use this ordering over here in order to number my rows and it’s as simple as saying putting one in the first row two in the second one 3 four and so on so if I extend this pattern I’m going to get a number for every row and that’s it that’s all that row number does it assigns a unique integer number to every row based on the ordering that’s defined by the window function and you might think oh big deal why do I need this don’t I already have like row numbers over here in the spreadsheet well in Pro SQ problems you often need to order things based on different values and um row number allows you to do this you can also have many different orderings coexisting in the same table based on different conditions and that can come in handy as you will discover if you do SQL problems now let’s move on to ranking so first of all we have dense rank okay and ranking is another way of counting but is slightly different sometimes you just want to count things you know sometimes uh like we did here in row number like I don’t know you are a dog sitter and you’re given 20 dogs and you getting confused between all their their names and then you assign a unique number to every dog so that you can identify them uh and you can sort them by I don’t know by age or by how much you’re getting paid to docit them sometimes on the other hand you want to rank things like when choosing which product to buy or expressing the results of a race right if and the difference between ranking and Counting can be seen when you have the same value right so when you want to Simply number like we did here when you want to Simply assign assign a different number to each element and two things have the same value then you don’t really care right you need to sort of arbitrarily decide that okay one of them will be a number two and one of them will be number three but you cannot do the same for ranking if two students in a classroom get the best score you can’t just randomly choose that one of them is number one and the other is number two they have to both be number one right and if two people finish a race at at the same time and is the best time you can’t say that one uh won the race and the other didn’t that because one is number one the other is arbitrarily number two they both have to be number one right they have to share that Rank and this is where ranking differs so let’s go in here and apply our rank now we are ordering by value ascending which means that the smallest value will have rank number one and so 30 has rank number one now we go to the second row and again remember window functions that you always have to think row by row you have to think what each row sees and what each row decides so again the row is going to order by uh value so it’s only going to see these values over here and it has to decide its rank so this row says uh oh I’m not actually number one because there is a value which is smaller than me so that means I have to be number number two and then we get to the third row and this row is uh seeing all the values that come before it right they’re equal or or or smaller and now it’s saying oh I’m not number one because there’s something smaller but then uh the value 50 which uh this guy has uh is rank two and I have the same value number 50 we arrived in the same spot so I must have the same rank okay and this is the difference between row number and rank that identical values get the same rank but they don’t get the same row number and now we come to this row which is 60 so it’s going to look back and it’s going to say oh from what I see 30 is the smallest one so it has a rank of one and then you have 50 and 50 they both share a rank of two but I am bigger so I need a new rank and so what am I going to pick now as a new rank well I’m going to pick three because it’s the next uh number in the sequence then the next one is going to pick four the next one is going to pick five and then we have six and then it proceeds in the following way so I’ll do it quickly now so 7 8 9 10 11 and again careful here we’re sharing the same value so they are both 11 next we can proceed to 12 13 again the same value right so they have to share the 13th spot 14 so 14 for 1700 and then 14 again and then 15 and then 16 and this is what we expect to see when we compute the dense rank and finally we come to rank now rank is very similar to dense rank but there is one important difference so let’s do this again smallest value has rank number one like before and then we have 50 which has rank number two and then 50 is once more sharing rank number two and now we move from 50 to 60 so we need a new rank but instead of three we put four over here why do we put four because the previous rank covered uh two rows and it sort of at the three it sort of expanded to eight the three So based on the rules of Simply rank we have to lose the three and put four over here so this is just another way of managing ranking and you will notice that it conveys another piece of information compared to dense rank because not only I see that um this row over here has a different rank than the previous row but I can only I can also see how many members were covered by the previous uh ranks I can see that in the previous ranks uh they must have involved three members because I’m at four already and this piece of information was not available for dence rank so I will continue over here and so I have a new value which is uh rank five and then I have rank six rank seven rank 8 rank n Rank 10 rank 11 now I have rank 12 and again I have to share the rank 12 because two identical values but now because 12 has eaten up two spots I can’t use the 13 anymore the second 12 has like eaten the 13 and so I need to jump straight to 14 15 15 again and now I have to jump to 17 because 15 had two spots 17 again and now I have to jump to 19 and then finally I have 20 so you can see that the final number uh is 20 for rank just as with row number because it’s not only differentiating between ranks but it’s also counting for me how many elements have come before me how many rows are contained in the previous ranks I can tell that there’s 19 rows in the previous ranks uh because of how rank Works whereas with 10 rank we end ended up using only 16 uh ended up being only up to 16 so we sort of lost information on how many records we have and this might be one of the reasons why by default you have this method of ranking instead of this method of ranking even though dense rank seems more intuitive when you are uh building the ranking yourself so we can now take this query and hopefully I’ve written it correctly and go to big query and try to run it and as you can see we have our items they are sorted by value and then we have our numbering functions so row number should go from one to 20 without any surprises CU it’s just numbering the rows this dense rank should have rank one for the first and then these two should share the same rank because they have both have 50 and then the next rank is three so just as I’ve shown you in the spreadsheet similarly here you have 11 11 and then 12 rank uh instead starts off uh just the same uh smallest value has rank number one and the next two values have rank number two but then after using up two and two it’s like you’ve used up the three so you jump straight to four and after doing 15 and 15 you jump straight to 17 after doing 17 17 you jump straight to 19 and then the the highest number here is 20 which tells you how many rows you’re dealing with of course what you see here are window functions they work just the same as we I’ve shown you and so you could pick up Rank and you could order by value descending and then you will see you will find the inverse of that rank in the sense that the highest value item will give you rank one and it will go from there and the lowest value item will have sort of the the biggest rank number and and rank is often used like this you know the thing that has the most of what we want you know the biggest salary the biggest value the most successful product we rank it we make it so that it’s rank one it’s like the first in our race and then everyone else goes from there and so we often have actually we order by something descending when we calculate the rank and of course because these numbering functions are window functions they can also be combined with Partition by if you want to cut the data into subgroups so here’s an example on the fantasy characters table we are basically uh partitioning by class meaning that each row only sees the other rows that share the same class so archers only care about archers Warriors only care about Warriors and so forth and then within the class we are ordering by level descending okay so the highest levels come first and using this to rank the characters okay so if I go here then I can see that within the archers the highest level Archer has level 26 so they get the first Rank and then all the others is go down down from there and then we have our Warriors and the highest level Warrior is 25 and they also get rank one because they are being ranked within Warriors so this is like when you have races and there are categories this like when you have a race and there are categories within the race so there are like many people who arrive first because they arrive first in their category it’s not that everyone competes with everyone and so on and so forth you can see that each uh class of character has their own dedicated ranking and you can check the uh bigquery page on numbering function if you want to learn more about these functions you can see here the ones we’ve talked about rank row number and dense rank there are a few more but these are the ones that are most commonly used in SQL problems and because I know that it can be a bit confusing um to distinguish between row number dense Rank and rank here’s a visualization that you might find useful so let’s say that we have a list of values uh which are these ones and we are ordering them in descending order so you can see that there’s quite some repetition in these values and given this list of values how would these different numbering functions work on them right so here’s row number row number is easy it just um assigns a unique number to to each of them so it doesn’t matter that the values are sometimes the same you sort of arbitrarily pick um one to be one the other to be two and then you have three and then here you have 10 10 10 but it doesn’t matter you just want to order them so you uh do four five six and then finally seven dense rank is actually cares about the values being the same so 50 and 50 they both get one uh 40 gets two and then uh the 10 get three and then five gets four so easy the rank just grows uh using all the integer numbers dense rank is also assigning rank one to 50 and 50 but it’s also throwing away the two because there are two elements in here then the next one is getting rank three because the two has already been used and then the next batch 1011 is getting rank four but it’s also burning five and six and the next one then can only get rank seven so these are the differences between row number dance Rank and rank visualized we have now reached the end of our journey through the SQL fundamentals I hope you enjoyed it and I hoped that you learned something new you hopefully now have some understanding of the different components of SQL queries and the order in which they work and how they come together to allow us to do what we need with the data now of course learning the individual components and understanding how they work is only half the battle the other half of the battle is how do I put these pieces together how do I use them to solve real problems and in my opinion the response to that is not more Theory but it’s exercises go out there and do SQL challenges do SQL interviews find exercises or even better find some data that you’re interested in upload it in big query and then try to analyze it with SQL I should let you know that I have another playlist where I am solving 42 SQL exercises in postrest SQL and I think this can be really useful to get the other half of the course which is doing exercises and knowing how to face real problems with SQL and I really like this playlist because I’m using a free website a website that doesn’t require any sign up or any login uh it just works works and you get a chance to go there and do all of these exercises that cover all the theory that we’ve seen in this course and then after trying it yourself you get to see me solving it and my thought process and my explanation and I think it could be really useful if you want to deepen your SQL skills but in terms of uh how do I put it all together how do I combine all of this stuff I do want to leave you with another resource that I have created which is this table and this table shows you the fundamental moves that you will need to do whenever you do any type of data analytics and I believe that every sort of analytics that you might work on no matter how simple or complicated can ultimately be reduced to these few basic moves and what are these moves they should actually be quite familiar to you by now so we have joining and this is where we combine data from multiple tables based on some connections between columns and in SQL you can do that with the join then we have filtering filtering is when we pick certain rows and discard others so you know let’s look only at customers that joined after 2022 now how do you do that in SQL there are a few tools tools that you can use to do that the most important one is the wear filter and the wear filter comes in action right after you’ve loaded your data and it decides which rows to keep which rows to discard having does just the same except that it works on aggregated fields it works on fields that you’ve obtained after a group by qualify we actually haven’t seen it in this course because it’s not a universal component of SQL certain systems have it others don’t but qualify is basically also a filter and it works on the result of window functions and finally you have distinct which runs quite at the end of your query and it’s basically removing all duplicate rows and then of course you have grouping and aggregation and we’ve seen this in detail in the course you subdivide the data um on certain dimensions and then you calculate aggregate values within those Dimensions fundamental for analytics how do we aggregate in SQL we have the group by we have the window functions and for both of them we use aggregate functions such as sum average and so on and then we have column Transformations so this is where you apply logic uh arithmetic to transform columns combine column values and take take the data that you have in order to compute data that you need and we do this where we write the select right we can write calculations that involve our columns we have the case when which allows us to have a sort of branching logic and decide what to do based on some conditions and of course we have a lot of functions that make our life easier by doing specific next we have Union Union is pretty simp simple take tables that have the same columns and stack them together meaning put their rows together and combine them and finally we have sorting which can change how your data is sorted when you get the result of your analysis and can be also used in window functions in order to number or rank our data and these are really the fundamental elements of every analysis and every equal problem that you will need to solve so one way to face a problem even if you are finding it difficult is to come back to these fundamental components and try to think of how do you need to combine them in order to solve your problem and how can you take your problem and break it down to simpler operations that involve these steps now at the beginning of the course I promised you that uh we we would be solving a hard squl challenge together at the end of the course so here it is let us try now to solve this challenge applying the concepts in this course now as a quick disclaimer I’m picking a hard challenge because it’s sort of fun and it gives us um a playground to Showcase several Concepts that we’ve seen in the course and also because I would like to show you that even big hard scary ch Alles that are marked as hard and even have advanced in their name can be tackled by applying the basic concepts of SQL however I do not intend for you to jump into these hard challenges um from the very start it would be much better to start with basic exercises and do them step by step and be sure that you are confident with the basic steps before you move on to more advanced steps so if you have trouble uh approaching this problem or even understanding my solution don’t worry about it just go back to your exercises and start from the simple ones and then gradually build your way up that being said let’s look at the challenge marketing campaign success Advanced on strata scratch so first of all we have one table that we will work on for this challenge marketing campaign so marketing campaign has a few columns and it actually looks like this okay so there’s a user ID created that product ID quantity price now when I’m looking at the new table the one question that I must ask to understand it is what does each row represent and just by looking at this table I can have some hypotheses but I’m actually not sure what each row represents so I better go and read the text until I can get a sense of that so let’s scroll up and read you have a table of inapp purchases by user okay so this explains my table what does each row represent it represents an event that is a purchase okay so it means that user ID 10 bought product ID 101 in a quantity of three at the price of 55 and created that tells me when this happened so this happened 1st of January 2019 so great now I understand my table and now I can see what the problem wants from me let’s go on and read the question so I have a table of inapp purchases by users users that make their first inapp purchase are placed in a marketing campaign where they see call to actions for more Ina purchases find the number of users that made additional purchases due to the success of the marketing campaign the marketing campaign doesn’t start until one day after the initial app purchase so users that made one or multiple purchases on the first day do not count nor do we count users that over time purchase only the products they purchased on the first day all right so that was a mouthful okay so this on the first run it’s actually a pretty complicated problem so our next task now is to understand this text and to simplify it to the point that we can convert it into code okay and a good intermediate step before jumping into the code is to write some notes and we can use the SQL commenting feature for that so what I understand from this text is that users make purchases and we are interested in users that make additional purchases we’re interested in users who make additional purchases thanks to this marketing campaign how do we Define additional purchases additional purchase is defined as and the fundamental sentence is this one users that made one or multiple Pur purchases on the first day do not count so additional purchase happens after the first day right nor do we count users that over time purchase only the products they purchased on the first day so the other condition that we’re interested in is that it involves a product that was not bought the first day and finally what we want is the number of users so get the number of these users that should be a good start for us to begin writing the code so let us look at the marketing campaign table again and I remind you that each row represents a purchase so what do we need to find First in this table so we want to compare purchases that happen on the first day with purchases that happen the following day so we need a way to count days and what do we mean first day and following days do we mean the first day that the shop was uh open no we actually mean the first day that the user ordered right because the user signs up does the first order and then after that the marketing campaign starts so we’re interested in numbering days for each user such that we know what purchases happened on the first day what purchases happened on the second day third day and so on and what can we use to run a numbering by user we can use a window function with a numbering function right so I can go to my marketing campaign table and I can select the user ID and the date in which they bought something and the product ID for now now I said that I need a window function so let me start and Define the window now I want to count the days within each user so I will actually need to Partition by user ID so that each row only looks at the rows that correspond to that same user and then there is an ordering right there is a a sequence from the first day uh in which the user bought something to the second and the third and so on so my window will also need an ordering and what column in my table can provide an ordering it is created at and then what counting function do I need to use here well the the way to choose is to say what happens when the same user made two two different purchases on the same date what do I want my function to Output do I want it to Output two different numbers as a simple count or do I want them want it to Output the same number and the answer is that I wanted to Output the same number because all of the purchases that happened on day one need to be marked as day one and all the purchases that have happened on day two need to be marked as day two and so on and so the numbering function that allows us to achieve this is Rank and if you remember ranking is works just like ranking the winners of a race everyone who shares the same spot gets the same number right and this is what we want to achieve here so let us see what this looks like now and let us order by user ID and created at let us now see our purchases now user 10 started buying stuff on this day they bought one product and the rank is one Let’s us actually give a better name to this column so that it’s not just rank and we can call it user day all right so this user id10 had first user day on the this date and they brought one product then at a later date they had their second user day and they bought another product and then they had a third now user 14 started buying on this date this was their first user day they bought product 109 and then the same day they bought product 107 and this is also marked as user day one so this is what we want and then at a later day they bought another product and this is marked as user day three remember with rank you can go from 1 one to three because this the F the spot marked as one has eaten the spot Mark as two that’s not an issue in this problem so we are happy with this now if we go back to our notes we see that we are interested in users who made additional purchases and additional means that it happen s after the first day and how can we identify purchases that happened after the first day well there’s a simple solution for this we can simply filter out rows that have a user day one right all of the rows where the user day is one represent purchases that the user made on their first day so we can discard this and keep only purchase that happened on the following days now I don’t really have a way to filter on this uh window function because as you recall from the order of SQL operation the window function happens here and the wear filter happens before that so the wear filter cannot be aware of what happens in the window function and the having also happens before it so I need a different solution to filter on this field what I need to do is to use a Common Table expression so that I can break this query in two steps so I’m going to wrap this logic into a table called T1 or I can call it purchases for it to be more meaningful and if I do select star from purchases you will see that the result does not change but what I can do now is to use the wear filter and make sure that the user day is bigger than one and if I look here you will see that I have all purchases which happened after the users first day but there is yet one last requirement that I have to deal with which is that the purchase must happen after the first day and it must involve a product that the user didn’t buy on the first day so how can I comply with this requirement now for all of the rows that represent a purchase I need to drop the rows that involve a product ID that the user bought the first day so if I find out that user 10 bought product 119 on day one this purchase does not count I’m not interested in it so how can I achieve this in code I’m already getting all the purchases that didn’t happen on day one and then I want another condition so I will say and product ID not in and here I will say products that this user bought on day one right it makes sense so this is all the filters I need to complete my problem show me all the purchases that happened not on day one and also make sure that the user didn’t buy this product on day one so what I need to do is to add a subquery in here and before I do that let me give a Alias to this table so so that I don’t get confused when I call it again in the subquery so this first version of purchases that we’re using we could call it next days because we’re only looking at purchases that happen after the first day whereas in the subquery we want to look at purchases but we’re interested in the ones that actually happened on day one so we could call this first day and and we can use a wear filter to say that first day user day needs to be equal to one so this is a way that we can use to look at the purchases that happened on the first day now when we make this list we need to make sure that we are use looking at the same user right and to do that we can say end first day user ID needs to be the same as next day’s user ID and this ensures that we’re looking at the same user and we’re not getting confused between users and finally what do we need from the list of first day purchases we need the list of products so let me first see if the query runs so it runs there’s no mistakes and now let us review the logic of this query we have purchases which is basically a list of purchases with the added value that we know if it happened on day one on day two on day three and so on and then we are getting all of these purchases the ones that happened after day one and we are also getting the the list of products that they this user bought on day one and we are making sure to exclude those products from our final list and this is a correlated subquery because it is a specific SQL query that provides different results for every row that must run for every row because in the first row we need to get the list of products that user ID 10 has bought on day one and make sure that this product is not in it um and then when we go to another row such as this one we need to get the list of all products that user 13 bought on day one and make sure that 118 is not in those products so this is why it’s a correlated subquery and the final step in our problem is to get the number of these users so instead of selecting star and getting all of the C columns I can say count distinct user ID and if I run this I get 23 checking and this is indeed the right solution so this is one way to solve the problem and hopefully it’s not too confusing but if it is don’t worry it is after all an advanced problem if you go to solution here I do think however that my solution is a bit clearer than what strata scratch provides this is actually a bit of a weird solution but that’s ultimately up to you to decide and I am grateful to strata scratch for providing problems that I can solve for free such as this one welcome to postgress SQL exercises the website that we will use to exercise our SQL skills now I am not the author of this website I’m not the author of these exercises the author is Alis D Owens and he has generously created this website for anyone to use and it’s free you don’t even need to sign up you can go here right away and start working on it I believe it is a truly awesome website in fact the best at uh what it does and I’m truly grateful to Alis there for making this available to all the way the website works is pretty simple you have a few categories of exercises here and you can select a session and once you select a session you have a list of exercises you can click on an exercise and then here in the exercise view you have a question that you need to solve and you see a representation of your three tables we’re going to go into this shortly and then you see your expected results and here in this text box over here you can write your uh answer and then hit run to see if it’s the correct one the results will appear in this lower quadrant over here and if you get stock you can ask for a hint um and uh here there are also a few keyboard shortcuts that you can use and then after you submit your answer uh or if you are completely stuck you can go here and see the answers and and discussion and that’s basically all there is to it now let’s have a brief look at the data and see what that’s about and the data is the same for all exercises and what we have here is the data about a newly opened Country Club and we have three tables here members represents the members of the country club so we have their surname and first name their address their telephone and uh the the date that which they joined and so on and then we have the bookings so whenever a member makes a booking into a facility that event is stored into this table and then finally we have a table of facility where we have information about each facility and U in there we have some some tennis courts some badminton courts uh massage rooms uh and so on now as you may know this is a standard way of representing how data is stored in a SQL system so you have um the tables and for each table you see the columns and for each column you see the name and then the data type right so the data type is the type of data that is allowed into this column and as you know each column has a single data type and you are not allowed to mix multiple data types within each column so we have a few different data types here and they have the postgress um name so in postgress an integer is a whole number like 1 2 3 and a numeric is actually a FL floating Point number such as 2.5 or 3.2 character varying is the same as string it represents a piece of text and if you wonder about this number in round brackets 200 it represents the maximum limit of characters that you can put into this piece of text so you cannot have a surname that’s bigger than 200 characters and then you have a time stamp which represents a specific point in time and this is actually all the data types that we have here and finally you can see that the tables are connected so in the booking table every entry every row of this table represent an event where a certain facility ID was booked by a certain member ID at a certain time for a certain number of slots and the facility ID is the same as the facility ID field in facilities and the M ID field field is the same as the M ID or member ID field in members therefore the booking table is connecting to to both of these table and these logical connections will allow us to use joins in order to build queries that work on all of these three tables together and we shall see in detail how that works finally we have an interesting Arrow over here which represents a self relation meaning that the members table has a relation to itself and if you and if you look here this is actually very similar to the example that I have shown in my U mental models course um for each member we can have a recommended bu field which is the ID of another member the member who recommended them into the club and this basically means that you can join the members table to itself in order to get at the same time information about a specific member and about the member who recommended them and we shall see that in the exercises and clearly the exercises run on post SQL and postgress is one of the most popular open-source SQL systems out there postgress SQL is a specific dialect of SQL which has some minor difference es from other dialects such as my SQL or Google SQL that used is used by bigquery but it is mostly the same as all the others if you’ve learned SQL with another dialect you’re going to be just fine postgress sqle does have a couple of quirks that you should be aware about but I will address them specifically as we solve these exercises now if you want to rock these exercises I recommend keep keeping in mind The Logical order of SQL operations and this is a chart that I have introduced and explained extensively in my mental models course where we actually start with this chart being mostly empty and then we add one element at a time making sure that we understand it in detail so I won’t go in depth on this chart now but in short this chart represents the logical order of SQL operations these are are all the components that we can assemble to build our SQL queries they’re like our Lego building blocks for for SQL and these components when they’re assembled they run in a specific order right so the chart represents this order it goes from top to bottom so first you have from then you have where and then you have all the others and there are two very important rules that each operation can only use data produced above it and an operation doesn’t know anything about data produced below it so if you can keep this in mind and keep this chart as a reference it will greatly help you with the exercises and as I solve the exercises you will see that I put a lot of emphasis on coming back to this order and actually thinking in this order in order to write effective queries let us now jump in and get started with our basic exercises so I will jump into the first exercise which is retrieve everything from a table so here I have my question and how can I get all the information I need from the facilities table and as you know all my data is represented here so I can check here to see where I can find the data that I need now as I write my query I aim to always start with the front part why start with the front part first of all it is the first component that runs in The Logical order so again if I go back to my chart over here I can see that the from component is the first and that makes sense right because before I do any work I need to get my data so I need to tell SQL where my data is so in this case the data is in the facilities table next I need to retrieve all the information from this table so that means I’m not going to drop any rows and I’m going to select all the columns and so I can simply write select star and if I hit run I get the result that I need here in this quadrant I can see my result and it fits the expected results now the star is a shortcut for saying give me all of The Columns of this table so I could have listed each column in turn but instead I took a shortcut and used a star retrieve specific columns from a table I want to print a list of all the facilities and their cost to members so as always let’s start with the front part where is the data that we need it’s in the facilities table again and now the question is actually not super clear but luckily I can check the expected results so what I need are two columns from this table which is name and member cost so to get those two columns I can write select name member cost hit run and I get the result that I need so if I write select star I’m going to get all the columns of the table but if I write the name of specific columns separated by comma I will get uh only those columns specifically control which rows are retrieved we need a list of facilities that charge a fee to members so we know that we’re going to work with the facilities table and now we need to keep certain rows and drop others we need to keep only the rows that charge a fee to members so what component can we use in order to do this if I go back to my components chart I can see that right after from we have the we component and the we component is used to drop rows that we don’t need right so in after getting the facilities table I can see I can say where member cost is bigger than zero meaning that they charge a fee to members and finally I can get all of the columns from this control which rows are retrieved part two so like before we want the list of facilities that charge a fee to members but our filtering condition is now a bit more complex because we need that fee to be less than 150th of the monthly maintenance cost so I copied over the code from the last exercise we’re getting the data from our facilities list and we’re filtering for those where the member cost is bigger than zero and now we need to add a new condition which is that that fee which is member cost is less than 150th of the monthly maintenance cost so I can take monthly maintenance over here and divide it by 50 and I have my condition now when I have multiple logical conditions in the wear I need to link them with the logical operator so SQL can figure out how to combine them because the final result of all my conditions needs to be a single value which is either true or false right so let’s see how to do this in my mental models course I introduced the Boolean operators and how they work so you can go there for more detail but can you figure out which logical operator do we need here to chain these two conditions as suggested in the question the operator that I need is end so I can put it here here and what end does is that both of these conditions need to be true for the whole expression to evaluate to true and for the row to be kept so only the rows where both of these conditions are true will be kept and all other rows will be discarded now to complete my exercise I just need to select a few specific columns because we don’t want to return all the columns here and I think that I will cheat a bit by copying them from the expected results and putting them here but normally you would look at the table schema and figure out which columns you need and that completes our exercise basic string searches produce a list of all facilities with the word tennis in their name so where is the data we need it’s in the CD facilities table next question do I need all the rows from this table or do I need to filter out some rows well I only want facilities with the word tennis in their name so clearly I need a filter therefore I need to use the wear statement how can I write the wear statement I need to check the name and I need to keep only facilities which have tennis in their name so I can use the like statement here to say that the facility needs to have tennis in its name but what this wild card signify is that we don’t care what precedes tennis and what follows tennis it could be zero or more characters before it and after it we just care to check that they have tennis in their name and finally we need to select all all the columns from these facilities and that’s our result beware like I said before of your use of the quotes So what you have here is a string it’s a piece of text that uh allows you to do your match therefore you need single quotes if you as it’s likely to happen used double quotes you would get an error here and the error tells you that the column tenis the does not exist because double quotes are used to represent column names and not pieces of text so be careful with that matching against multiple possible values can we get the details of facilities with id1 and id5 so where is my data is in the facilities table and do I need all the rows from this table or only certain ones I need only certain rows because I want those that have id1 and id5 so I need to use a wear statement Now what are my conditions here their ID actually facility ID equals 1 and facility ID equals 5 so I have my two logical conditions now what operator do I need to use in order to chain them I need to use the or operator right because only one of these need needs to be true in order for the whole expression to evaluate to true and in fact only one of them can be true because it’s impossible for the idea of a facility to be equal to one and five at the same time therefore the end operator would not work and what we need is the or operator and finally we need to get all the data meaning all the columns about this facility so I will use select star the problem is now solved but now let’s imagine that tomorrow we need this query again and we need to include another id id 10 so what we can do is put or facility ID equals 10 but this is becoming a bit unwieldy right because imagine having a list of 10 IDs and then writing or every time and it’s it’s not very scalable as an approach approach so as an alternative we can say facility ID in and then list the values like one and five so if I take this and make it into my condition I will again get the same result I will get the the solution but this is a more elegant approach and it’s also more scalable because it’s much easier to come back and insert other IDs inside this list so this is a preferred solution in this case and logically what in is doing is looking at the facility ID for each row and then checking whether that ID is included in this list if it is it returns true therefore it keeps the row if it’s not returns false therefore it drops the row and we shall see a bit later that the in uh notation is also powerful because in this case we have a static list of IDs we know that we want IDs one and five but in more advanced use cases instead of a static list we could provide another query a SQL query or a subquery that would dynamically retrieve a certain list and then we could use that in our query so we shall see that in later exercises classify result into buckets produce a list of facilities and label them cheap or expensive based on their monthly maintenance so we want to get our facilities do we need a filter do we need to drop certain rows no we actually don’t we want to get all facilities and then we want to label them and we need to select the name of the facility and then here we need to provide the label so what SQL statement can we use to provide a text level label according to the value of a certain column what we need here is a case statement which implements conditional logic which implements a branching right it’s similar to the if else statements in other programming languages because if the monthly maintenance cost is more than 100 then it’s expensive otherwise it’s cheap so this call for a case statement now I always start with case and end with end and I always write these at the beginning so I don’t forget them and then for each condition I write when and what is the condition that I’m interested in monthly maintenance being above 100 that’s my first condition what do I do in that case I output a piece of text which says expensive and remember single quotes for test text next I could write the next condition explicitly but actually if it’s not 100 then it’s less than 100 so all I need here is an else and in that case I need to Output the piece of text which says cheap and finally I have a new column and I can give it a label I can call it cost and I get my result so whenever you need to put values into buckets or you need to label values according to certain rules that’s usually when you need a case statement working with dates let’s get a list of members who joined after the start of September 2012 so looking at these tables where is our data it’s in the members table so I will start writing this and now do I need to filter this table yes I only want to keep members that joined after a certain time and now how can I run this the condition on this table I can say where join date is bigger than 2012 September 01 so luckily in SQL and in postgress filtering on dates is quite intuitive even though here we have a time stamp that represents a specific moment in time up to the second we can say bigger or equal actually because we also want to include those who joined on the first day we can write bigger or equal and just specify the the date and SQL will fill in the the rest of the remaining values and the filter will work and next we want to get a few columns for these members so I will copy paste here select and this solves our query removing duplicates and ordering results we want an ordered list of the first 10 surnames in the members table and the list must not contain duplicates so let’s start by getting our table which is the members table now we want to see the surnames so if I write this I will see that there are surnames which are shared by members so there are actually duplicates here so what what can we do in SQL in order to remove duplicates we have seen in the mental models course that we have the distinct keyword and the distinct is going to remove all duplicate rows based on the columns that we have selected so if I run this again I will not see any duplicates anymore now the list needs to be ordered alphabetically as I see here in the expected results and we can do that with the order by statement and when you use order by on a piece of text the default behavior is that the text is ordered alphabetically and uh if I were to use Des sending then it would be ordered in Reverse alphabetical order however that’s not what I need I need it in alphabetical order so now I see that they are ordered and finally I want the first 10 surnames so how can I return the first 10 rows of my result I can do that with the limit statement so if I say limit 10 I will get the first 10 surnames and since I have ordered alphabetically I will get the first 10 surnames in alphabetical order and this is my result now going back to our map over here we have the from which gets a table we have a where which drops rows that we don’t need from that table and then all the way down here we have the select which gets the columns that we need and then we have the distinct right and the distinct needs to know which columns we need because it’s it drops duplicates based on these columns so in this example over here we’re only taking a single column surname so the distinct is going to drop duplicate surnames and then at the end of it all when all the processing is done we can order our results and then finally once our results are ordered we can do a limit to limit the number of rows that we return so I hope this makes sense combining results from multiple queries so let’s get a combined list of all surnames and all facility names so where are the surnames there in CD members and from CD m mbers I can select surname right and this will give me the list of all surnames and where are the facility names there are in CD facilities and I could say select name from CD facilities and I would get a list of all the facilities now we have two distinct queries and they both produce a list or a column of text values and we want to combine them what does it mean we want to stack them on top of each other right and how does that work well if I just say run query like this I will get an error because I have two distinct query here queries here and they’re not connected in any way but when I have two queries or more defining tables and I want to stack them on top of each other I can use the union statement right and if I do Union here I will uh get what I want because all the surnames will be stacked uh vertically with all the names and I will get a unique list containing both of these columns now as I mentioned in the mental models course typically when you have just Union uh it means Union distinct and actually other systems like bigquery don’t allow you to write just Union they want you to specify Union distinct and what this actually does is that after stacking together these two tables it removes all duplicate rows and uh the alternative to this is Union all which um does not do this it actually keeps all the rows and as you know we have some duplicate surnames and then we get them here and it doesn’t fit with our result but if you write just Union it will be Union distinct and you won’t have any duplicates and if you look at our map for The Logical order of SQL operations we are getting the data from a certain table and uh filtering it and then doing all sorts of operations and um on on this data and then we are selecting The Columns that we need and then we can uh remove the the duplicates from this one table and then what comes next is that we could combine this table U with other tables right we can tell SQL that we want to Stack this table on top of another table so this is where the union comes into play and only after we have combined all the tables only after we have stacked them all up on top of each other we can order the results and limit the results also remember and I showed this in detail in the mental models course um when I combine two or more table tables with a union what I need is for them to have the exact same number of columns and all of the columns need to have the same data type so in this case both tables have one column and this column is a text so the the union works but if I were to add another column here and it’s an integer column it would not work because the union query must have the same number of columns right I will get an error however if I were to add an integer column in the second position in both tables they would work again because again I have the same number of columns and they have the same data type simple aggregation I need the sign up date of my last member so I need to work with the members table and we have a field here which is join date and I need to get the latest value of this date the time when a member last joined right so how can I do that I can take my join date field and run an aggregation on top of it what is the correct aggregation in this case it is Max because when it comes to dates Max will take the latest date whereas mean will take the earliest date and I can label this as latest and get the result I need now how aggregations work they are uh functions that look like this you write the name of the function and then in round brackets you provide the arguments the first argument is always the column on which to run the aggregation and what the aggregation does is that it takes a list of values could be 10 100 a million 10 million it doesn’t matter it takes a long list of values and it compresses this list to a single value it um does like we’ve seen in this case taking all of the dates and then returning the latest date now to place this in our map we get the data from the table we filter it and then sometimes we do a grouping which we we shall see later in the exercises but whether we do grouping or not here we have aggregations and if we haven’t done any grouping the aggregation works at the level of all the rows so in the absence of grouping as in this case the aggregation will look at all the rows in my table except for the rows that I filtered away but otherwise it will look at all the rows and then it will compress them into a single value more aggregation we need the first and last name of the last member who signed up not just the date so in the previous exercise we saw that we can say select Max join date from members and we would get the last join date the date when the last member signed up right so given that I want the first and the last name you might think that you can say first name and surname in here but this actually doesn’t work this gives an error the error is that the column first name must appear in the group by clause or be used in a aggregate function now the meaning behind this error and how to avoid it is described in detail in the mental models course in the group by section but the short version of it is that what you’re doing here is that with this aggregation you’re compressing join date to a single value but you’re doing no such compression or aggregation for first name and surname and so SQL is left with the um instruction to return something like this and as you can see here we have a single value but for these columns we have multiple values and this does not work in SQL because you need all columns to have the same number of values and so it it throws an error and what we really need to do here is to take this maximum join date and use it in a wear filter because we only want to keep that row which corresponds to the latest join date so we can take the members table and get the row where join date is equal to the max join date and from that select the name and the surname unfortunately this also doesn’t work so what we saw in the course is that you cannot you’re not allowed to use aggregations inside wear so you cannot use max inside where and the reason why is that actually pretty clear because aggregations happen at this stage in the in the process and aggregations need to know whether a group ey has occurred or not they need to know whether they have to happen over all the rows in the table or only within the groups defined by the group ey and when we are at the where stage the groupy hasn’t happened yet so we don’t know at which level to execute the aggregations and because of this we are not allowed to do aggregations inside the where statement so how can we solve the problem now well a a sort of cheating solution would be if we knew the exact value of join date we could place it here and then our filter would work we’re not using an aggregation and we could put join date in here to display it as well and that would would work however this is a bit cheating right because um the maximum join date is actually a dynamic value it will change with time so we don’t want to hardcode it we want to actually um compute it but because this is not allowed what we actually need is a subquery and the subquery is a SQL query that runs within a query to return a certain result and we can have a subquery by opening round brackets here and write writing a a query and in this query we need to go to the members table and select the maximum join date and this is our actual solution so in this execution you can imagine that SQL will go here inside the subquery run this get the maximum jointed place it in the filter uh keep only the row for the latest member who has joined and then retrieve what we need about this member let us now move to the joints and subqueries exercises the first exercise retrieve the start times of members bookings now we can see that the information we need is spread out into tables because we want the start time for bookings that and that information is in the bookings table but we want to filter to only get members named David farel and the name of the member is contained in the members table so because of that we will need a join so if we briefly look at the map for the order of SQL operations we we can see here that from and join are really the same uh step um and how this works is that in the from statement sometimes uh all my data is in one table and then I just provide the name of that table but sometimes I need to combine two or more different tables in order to get my data and in that case I would use the join but everything in SQL works with tables right so when I when I take two or more tables and combine them together at the end all I get is just another table and this is why from and join are actually the same component and they are the same step so as usual let us start with the front part and we need to take the booking table and we need to join it on the members table and I can give an alas to each table to make my life easier so I will call this book and I will call this mem and then I need to specify The Logical condition for joining this table and The Logical condition is that the M ID column in the booking table is really the same thing as the M ID column in the members table concretely you can imagine um SQL going row by Row in the booking table and looking at the M ID and then checking whether this m ID is present in the members table and if it’s present it combines the row uh the current Row from bookings with the matching Row for members does this with all the matching rows and then drops rows which don’t have a match and we saw that in detail in the mental models course so I’m not going to go in depth into it now that we have our table which is uh comes from the joint of members and bookings we can properly properly filter it and what we want is that the first name column is David in the column which comes from the members table right so m. first name is indicating the parent table and then the column name and the surname is equal to FAL and remember single quotes when using pieces of text this is a where filter you have two logical conditions and then we use the operator end because both of them need to be true so now we have uh filtered our data and finally we need to select the start time and that’s our query now remember that when we use join in a query what’s implied is that we are using inner join and there are several types of join but inner joint is the most common so it’s the default one and what inner joint means is that it’s going to return uh from the two tables that we’re joining is going to return only the rows that have a match and all the row that don’t have a match are going to be dropped so if there’s a row in bookings and it has a m ID that doesn’t exist in the members table that row will be dropped and conversely if there’s a row in the members table and it has a m ID that is not referenced in the booking table that row will also be dropped and that’s an inner join work out the start times of bookings for tennis courts so we need to get the facilities that are actually tennis courts and then for each of the facility we’ll have several bookings and we need to get the start time for those uh bookings and it will be in a specific date so we know that we need the data from these two tables because the name of the facility is here but the data about the bookings is here so I will go from CD facilities join CD bookings on what are the fields that we can join on logically now let me first give an alias to these tables so I will call this fox and this I will call book and now what I need to see is that the facility ID matches on both sides now we can work work on our filters so first of all I only want to look at tennis courts and if you look at the result here um it means that in the name of the facility we want to see tennis and so we can filter on uh string patterns on text patterns by using the like uh command so I can take facilities name and get it like tennis and the percentage signs are um wild cards which means that tennis could be preceded and followed by zero or more characters we don’t care we just want to get those strings that have tennis in them but that’s not enough as a condition we also need the booking to have happened on a specific date so I will put an end here so end is the operator we need because we’re providing two logical conditions and they both need to be true so end is what we need and then I can take the start time from the booking table and um say that it should be equal to the date provided in the instructions because I want the booking to have happened in this particular date however this will not work so I can actually complete the query and show you that it will not work because here we get zero results so can you figure out why this um command here did not work now I’m going to write a few comments here and uh this is how you write them and they are just pieces of text they’re not actually executed as code and I’ll just use them to show you what’s going on so the value for start time looks like this so this is a time stamp and is showing a specific point in time but the date that we are providing for the comparison looks like this so as you can see we have something that is uh less granular because we we’re not showing all of this data about hour minute and uh and second now in order to compare these two things which are different SQL automatically fills in uh this date over here and what it does is that since there’s nothing there it puts zeros in there and now that it has made this um extension it’s going to actually compare them so when you look at this uh comparison over here between these two elements this comparison is false false because the hour is different now when we write this uh filter command over here SQL is looking at every single start time and then comparing it with this value over here which is the very first moment of that date but there’s no start time that is exactly like this one so basically this is always false and thus we get uh zero rows in our result so what is the solution to this before when we take a start time from the data before comparing it we can put it into the date function and if I take my example here if I put it into the date function it’s going to drop that extra information about hour minute and second and it’s only going to keep uh the information about the date so once I do this if I uh if I pass it to the date function before comparing it to my reference date now this one is going to become the result which is this one and then I’m going to compare it with my reference date and then this is going to be true so all this to say that before we compare start time with our reference date we need to reduce its granularity and we need to reduce it to its uh to its date so if I run the query now I will actually get my start times and after this I just need to add the name and finally I need to order by time so I need to order bu um book start time there is still a small error here so sometimes you just have to look at what you get and what’s expected and if you notice here we are returning data about the table tennis facility but we’re actually just interested in tennis court so what are we missing here the string filter is not precise enough and we need to change this into tennis court and now we get our results produce a list of all members who have recommended another member now if we look at the members table we have all these data about each member and then we know if they were recommended by another member and recommended by is the ID of the member who has recommended them and because of this the members table like we said has a relation to itself because one of its column references its ID column so let’s see how to put this in practice so to be clear I simply want a list of members who appear to have recommended another member so if I wanted just the IDS of these people my task would be much simpler right I would go to the members table and then I could select recommended by and then I will put a distinct in here to avoid repetitions and what I would get here is the IDS of all members who have recommended another member however the problem does not want this because the problem wants the first name and Sur name of these uh of these people so in order to get the first name and the name of these people I need to plug this ID back into the members table and get the the data there so for example if I went to the members table and I selected everything where the M ID is 11 then I would get the data for this first member but now I need to do this for all members so what I will have to do is to take the members table and join it to itself and the first time I take the table I’m looking at the members quite simply but the second time I take the members table I’m looking at data about the recommenders of the members so I will call this second instance re so both of these they come from the same table but they’re now two separate instances and what is the logic to join these two tables the members table has this recommended by field and we take the ID from recommended by and we plug it back into the table into M ID to get the data about the recommenders and now we can go into the recommenders which we got by plugging that ID and get their first name and surname I want to avoid repetition because a member may have been recommending multiple members but I want to avoid repetition so I will put a distinct to make sure that I don’t get any uh repeated rows at the end and then finally I can order by surname and first name and I get my result so I encourage you to play with this and experiment a bit until it is clear and in my U mental models course I go into depth into the self joint and uh do a visualization in Google Sheets that also makes it uh much clearer produce a list of all members along with a recommender now if we look at the members table we have a few column and then we have the recommended by column and sometimes we have the ID of another member who recommended this member um it can be repeated because the same member may have recommended multiple people and then sometimes this is empty and when this is empty we have a null in here which is the value that SQL uses to represent absence of data now let us count the rows in members so you might know that to count the rows of a table we can do a simple aggregation which is Count star and we get 31 and let’s just make a note of this that members has 31 rows because in the result we want a list of all members so we must ensure that we return 31 rows in our results now I’m going to delete this select and as before I want want to go for each member and check the ID they have here in recommended bu and then plug this back into the table into M ID so I can get the data about the recommender as well and I can do that with a self jooin so let me take members and join on itself and the first time I will call it Ms and the second time I will call it Rex and the logic for joining is that in Ms recommended by is the same um is connected to to Rex M ID so this is taking the ID in the recommended by field and plugging it back into me ID to get the data about the recommender now what do I want from this I want to get the first name of the member and the last name uh surname and then the first name and last name of the recommender uh surname great so it’s starting to look like the right result but how many rows do we think we have here and in order to count the rows I can do select count star from and then if I simply take this table uh if I simply take this query and en close it in Brackets now this becomes a a subquery so I can ah the subquery must have an alias so I can give it an alias like this and I get 22 so how this works is that first SQL will compute the content of the subquery which is the table that we saw before and then it will uh we need to assign it an alas otherwise it doesn’t work this changes a bit by System but in post you need to do this so we we call it simply T1 and then we run a count star on this table to get the number of rows and we see that the result has 22 rows and this is an issue because we saw before that members has 31 rows and that we want to return all of the members therefore our result should also have 31 rows so can you figure figure out why are we missing some rows here now the issue here is that we are using an inner join so remember when we don’t specify the type of joint it’s an inner joint and what does an inner joint do it keeps only rows that have matches so if you we saw before that in members sometimes this field is empty it has a null value because U you know maybe the member wasn’t recommended by anyone maybe they just apply it themselves and what happens when we use this in an inner joint and it has a null value the row for that me member will be dropped because obviously it cannot have a match with M ID because null cannot match with with anything with any ID and so that row is dropped and we lose it however that’s not what we want to do therefore instead of an inner join we need to use a left join here the the left join will look at the left table so the table that is left of the join command and it will make sure to keep all the rows in that table even the rows that don’t have a match in the rows that don’t have a match it will not drop them it will just put a null in the values that correspond to the right table and if I run the count again uh I will get 31 so now I have I’m keeping all the members and I have the number of rows that I need so now I can get rid of all of these because I know I have the right amount of of rows and I can um get my selection over here and it would actually help if we could make this a bit uh more ordered and a assign aliases to the columns so I will follow the expected results here and call this m first name me surname W first name Rec surname now we have the proper labels and you can see here that we always have the name of the member but some member weren’t recommended by anyone and therefore for the first and last name of the recommender we simply have null values and this is what the left join does the last step here is to order and we want to order by the last name and the first name of each member and we finally get our result so typically you use inner joints which is the default joint because you’re only interested in the rows from both tables that actually have a match but sometimes you want to keep all the data about one table and then you would put that table on the left side and do a left join as we did in this case produce a list of all members who have used a tennis court now now for this problem we need to combine data from all our tables because we need to get look at the members and we need to look at their bookings and we need to check what’s the name of the facility for their bookings so as always let us start with the front part and let us start by joining together all of these tables CD facilities on facility ID and then I want to also join on members and that is my join so we can always join two or more tables in this case we’re joining three tables and how this works is that the first join creates a new table and then this new table is joined with the with the next one over here and this is how multiple joints are managed now I have my table which is the join of all of these tables and um we we’re only interested in members who have used the tennis court if a member has made no bookings um we are we don’t we’re not interested in that member and so it’s okay to have a join and not a left join and we’re for each booking we want to see the name of the facility and if there was a booking who didn’t have the name of the facility we wouldn’t be interested in that booking anyway and so um this joint here also can be an inner join and doesn’t need to be a left join this is how you can think about whether to have a join or left join now we want the booking to include a tennis court so we can filter on this table and we will look at the name of the facility and uh make sure that it has tennis court in it with the like operator and now that we have filtered we can get the first name and the surname of the member and we can get the facility name so here we have a starting result now in the expected result we have merged the first name and the surname into a single string and um in SQL you can do this with a concatenation operator which is basically taking two strings and putting them together into one string now if I do this here I will get um something like this and so this looks a bit weird and what I want to do here is to add an empty space in between and again concatenate it and now the names will look uh will look fine I also want to label this as member and this other column as facility to match the expected results next I need to ensure that there is no duplicate data so at the end of it all I will want to have distinct in order to remove duplicate rows and then I want to order the final result by member name and facility name so order by member and then facility and this will work because the order bu coming second to last coming at the end of our logical order of SQL operations over here the order by is aware of the alas is aware of the label that I have that I have put on the columns and here I get the results that I needed not a lot happening here to be honest it’s just that we’re joining three tables instead of two but it still works um just like uh any other join and then concatenating the strings filtering according to the facility name and then removing duplicate rows and finally ordering produce a list of costly bookings so we want to see all bookings that occurred in this particular particular day and we want to see how much they cost the member and we want to keep the bookings that cost more than $30 so clearly in this case we also need the information from from all tables because if you look at the expected results we want the name of the member which is in the members table the name of the facility which is in the facilities table and the cost for which we will need the booking table so we need to start with a join of these three tables and since we did it already in the last exercise I have copied the code for that uh join so if you want more detail on this go and check the last exercise as well as I have copied the code to get the first name of the member by concatenating strings and the name of the of the facility now we need to calculate the cost of each booking so how does it work looking at our data so we have here a list of bookings and um a booking is defined as a number of slots and a slot is a one uh is a 30 minute usage of that facility and then we also have mid which tells us whether the member is a guest or not I mean whether the person is a guest or a member because if mid is zero then that person is a guest otherwise that person is a member and then I also know the facility that this person booked and if I go and look at the facility it has uh two different prices right one price uh is for members the other price is for guests and the price applies to the slots so we have all of the ingredients that we need for the cost in our join right and to convince ourselves of that let us actually select the here so in Booking I can see facility ID member ID and then slots and then in facility I can see the member cost the guest cost and I guess that’s all I need really to calculate the cost and as you can see after the join I’m in a really good position because for each row I do have all of these values placed on each row so now I just have to figure out how to combine all of these values in order to get the cost now the way that I can get the cost is that I can look at the number of slots and then I need to multiply this by the right cost which is either member cost or guest cost and how do I know which of these to pick if it depends on the M ID if the M id M ID is zero then I will use the guess cost otherwise I will use the member cost so let me go back to my code here and after this I can say I want to take the slots and I want to multiply it by either member cost or guest cost now how can I put some logic in here that will choose uh either member cost or guest cost based on the ID of this person what can I use in order to make this Choice whenever I have such a choice to make I need to use a case statement so I can start with a case statement here and I will already write the end of it so that I don’t forget it and then in the case statement M what do I need to check for I need to check that the member ID is zero in that case I will use the guest cost and in all other cases I will use the member cost so I’m taking slots and then I’m using this case when to decide by which column I’m going to multiply it and this is actually my cost now let’s take a look at this and so I get this error that the column reference M ID is ambiguous so can you figure out why I got this error what’s happening is that I have joined U multiple tables and the M ID column appears twice now in my join and so I cannot refer to it just by name because SQL doesn’t know which column I want so I have to to reference the parent of the column every time I use it so here I will say that it comes from the booking table and now I get my result so if I see here then um I can see that I have successfully calculated my cost and let’s look at the first row uh first it’s um the me ID is not zero therefore it’s a member and here the member cost is zero meaning that this facility is free for members so regardless of the slots the cost will be zero and let’s look at one who is a guest so this one uh is clearly a a guest and they have uh taken one slot and the member cost is zero but uh so it’s free for members but it costs five per slot for guests so the total cost is five So based on this sanity check the cost looks good now I need to actually filter my table because we have um we should consider only bookings that occurred in a certain day so after creating my new table uh and joining I can write aware filter to drop the rows that I don’t need and I can say this is the the time column that I’m interested in the start time needs to be equal to this date over here and we have seen before that this will not work because start time is a Tim stamp it also shows hour um minute and seconds whereas here is just a date so this comparison will fail and so before I do the comparison I need to take this and reduce it to a date so that I’m comparing Apples to Apples on the time check that that didn’t break anything now we should have significantly fewer rows so now what we need to do is to only keep rows that have a cost which is higher than 30 so can I go here and say end cost bigger than 30 no I cannot do it column cost does not exist right typical mistake but if you look at the logical order of SQL operations first you have the sourcing of the data then you have the wear filter and then all of the logic um by which we calculate the cost happens here and the label cost happens here as well so we cannot um filter on this column on the column cost because the we component has no idea about the uh column cost so this will now work but what we can do is to take all of the logic we’ve done until now and wrap it in round brackets and then introduce a Common Table expression and call this T1 so I will say with T1 as and then I can from T1 and now I can use my filter right so cost bigger than 30 I can select star from this table and I’m starting to get somewhere because the cost has been successfully filtered now I have a lot of columns that I don’t want in my final result that I used to help me reason about the cost so I want to keep member and I want to keep the facility but I don’t want to keep any of these great now as a final step I need to order by cost descending and there’s actually a issue that I have because I copy pasted code from the previous exercise I kept a distinct and you have to be very careful with this especially if you copy paste code anyway for learning it would be best to write it always from scratch but the distinct will remove uh rows that are duplicate and can actually cause an issue now I remove the distinct and I get the um solution that I want and if you look here we have if you look at the last two rows you can see that they’re absolutely identical and so the distinct would remove them but there are two uh bookings that happen to be just the same uh in our data and we want to keep them we don’t want to delete them so having distinct was a mistake in this case to summarize what we did here first we joined all the tables so we could have all the columns uh that we needed side by side and then we filtered on on the date pretty straightforward and then we took the first name and surname and um concatenated them together as well as the facility name and then we computed the cost and to compute the cost we got the number of slots and we used used a case when to multiply this by either the guest cost or the member cost according to the member’s ID and at the end we wrapped everything in a Common Table expression so that we could filter on this newly computed value of cost and keep only those bookings that had a cost higher than 30 now I am aware that the question said not to use any subqueries technically I didn’t because this is a common table expression but if you look at the author solution it is slightly different than ours so here they did basically the same thing that we did to compute the the cost except that in the case when they inserted the whole uh expression which is fine works just the same the difference is that um in this case they added a lot of logic in the we filter so that they could use a we filter in the first query so clearly they didn’t use any columns that were added at the stage of the select they didn’t use cost for example because like we said that wouldn’t be possible so what they did is that they added the date filter over here and then in this case they added a um logical expression and in this logical expression either one of these two needed to be true for us to keep the row either the M ID is zero meaning that it’s a it’s a guest and so the calculation based on Guess cost ends up being bigger than 30 or the M ID is not zero which means it’s a member and then this calculation based on the member cost ends up being bigger than 30 so this works I personally think that there’s quite some repetition of the cost calculation both by putting it in the we filter and by uh putting it inside the case when and so I think that uh the solution we have here is a bit cleaner because we’re only calculating cost once uh in this case and then we’re simply referencing it thanks to the Common Table expression so if you look at the mental models course you will see that I warmly recommend not repeating logic in the code and using Common Table Expressions as often as possible because I think that they made the code uh clearer and um simpler to to understand produce a list of all members and the recommender without any joins now we have already Sol solved this problem and we have solved it with a self join as you remember we take the members table and join it on itself so that we can get this uh recommend by ID and plug it into members ID and then see the names of both the member and the recommender side by side but here we are challenged to do it without a join so let us go to the members table and let us select the first name and the surname now we actually want want to concatenate these two into a single string and call this member now how can we get data about the recommender without a self-join typically when you have to combine data you always have a choice between a join in a subquery right so what we we can do is to have a subquery here which looks at the recommended by ID from this table and um goes back to the members table and gets the the data that we need so let’s see how that would look let us give an alias to this table and call it Ms and now we need to go back to this table inside the subquery and we can call it Rex and we want to select again the first name and surname like we’re doing here and how are we able to identify the right row inside this subquery we can use aware filter and we want the Rex M ID to be equal to the Mims recommended by value and once we get this value we can call this recommender and now we want to avoid duplicates so after our outer select we can say distinct which will remove any duplicates from the result and then we want to sort I guess by member and recommender and here we get our result so replacing a join with a subquery so we go row by Row in members and then we take the recommended by ID and then we query the members table again inside the subquery and we use the wear filter to plug in that recommended by and find the row where the mem ID is equal to it and then getting first name and surname we get the data about the recommender and uh and that’s how we can do it in the mental models course we discuss the subqueries and um and this particular case we talk about a correlated subquery why is this a correlated subquery because you can imagine that the the query that is in here it runs again for every row because for every row row I have a different value recommended by and I need and I need to plug this value into the members table to get the data about the recommender so this is a correlated subquery because it runs uh every time and it is different for every row of the members table produce a list of costly bookings using a subquery so this is the exact exercise that we did before and as you will remember uh we actually ignored it instructions a bit and we did use not a subquery but a Common Table expression and by reference this is the code that we used and this code works with that exercise as well and we get the result so you can go back to that exercise to see the logic behind this code and why this works and if we look at the author’s uh solution they are actually using a subquery instead of a common table expression so they have an outer quer query which is Select member facility cost from and then instead of the from instead of telling the name of the table they have all of this logic here in this subquery which they call bookings and finally they they add a filter and order now this is technically correct it works but I’m not a fan of uh of writing queries like this I prefer writing them like this as a common table expression and I explain this in detail in my mental models course the reason I prefer this is because U it doesn’t break queries apart so in my case this is one query and this is another query and it’s pretty easy and simple to read however in this case you will start reading this query and then it is broken uh in in two by another query and when people do this sometimes they go even further and here when you have the from instead of a table you have yet another subquery it gets really complicated um so because of these uh two approaches are equivalent I definitely recommend going for a Common Table expression every time and avoiding subqueries unless they are really Compact and you can fit them in one row let us now get started with aggregation exercises and the first problem count the number of facilities so I can go to the facilities table and then when I want to count the number of rows in a table and here every row is a facility I can use the countar aggregation and we get the count of facilities so what we see here is a global aggregation and when you run an aggregation without having done any grouping it runs on the whole table therefore it will take all the rows of this table no matter how many compress them into one number which is determined by the aggregation function in this case we have a count and it returns a total of nine rows so in our map aggregation happens right here so we Source the table we filtered it if needed and then we might do a grouping which we didn’t do in this case but whether we do it or not aggregations happen here and if grouping didn’t happen the aggregation is at the level of the whole table count the number of expensive facilities this is similar to the previous exercise we can go to the facilities table but here we can add a filtering because we’re only interested in facilities that have guest cost greater than or equal to 10 and now once again I can get my aggregation count star to count the number of rows of this resulting table looking again at our map why does this work because with the from We’re sourcing the table and immediately after the wear runs and it drops unneeded rows and then we can decide whether to group by or not and in our case in this case we’re not doing it um but then the aggregations Run so by the time the aggregations run I’ve already dropped the rows in the wear and this is why in this case after dropping some rows the aggregation only sees six rows which is what we want count the number of recommendations each member makes so in the members table we have a field which is recommended by and here is the ID of the member who recommended the member that that this row is about so now we want to get all these uh recommended by values and count how many times they appear so I can go to my members table and what I need to do here is to group by recommended by so what this will do is that it will take all the unique values of this column recommended by and then you will allow me to do an aggregation on all of the rows in which those values occur so now I can go here to select and call this column again and if I run this query I get all the unique values of recommended buy without any repetitions and now I can run an aggregation like count star what this will do is that for recomend recomended by value 11 it will run this aggregation on all the rows in which recommended by is 11 and the aggregation in this case is Count star which means that it will return the number of rows in which 11 appears which in the result happens to be one and so on for all the values what I also want to do is to order by recommended buy to match the expected results now what we get here is almost correct we see all the unique values of this column and we see the number of times that it appears in our data but there’s one discrepancy which is this last row over here so in this last row you cannot see anything which means that it’s a null value so it’s a value that represents absence of data and why does this occur if you look at the original recommended by column there is a bunch of null values in this column because there’s a bunch of member that have null in recommended by so maybe we don’t know who recommended them or maybe they weren’t recommended they just applied independently when you group bu you take all the unique values of the recommended by column and that includes the null value the null value defines a group of its own and the count works as expected because we can see that there are nine members for whom we don’t have the recommended by value but the solution does not want to see this because we only want to see the number of recommendations each member has made so we actually need to drop this row therefore how how can I drop this row well it’s as simple as going to uh after the from and putting a simple filter and saying recommended by is not not null and this will drop all of the rows in which in which that value is null therefore we won’t appear in the grouping and now our results are correct remember when you’re checking whether a value is null or not you need to use the is null or is not null you cannot actually do equal or um not equal because um null is not an act ual value it’s just a notation for the absence of a value so you cannot say that something is equal or not equal to null you have to say that it is not null let’s list the total slots booked per facility now first question where is the information that I need the number of slots booked in the is in the CD bookings and there I also have the facility ID so I can work with that table and now how can I get the total slots for each facility I can Group by facility ID and then I can select that facility ID and within each unique facility ID what type of uh aggregation might I want to do in every booking we have a certain number of slots right and so we want to find all the bookings for a certain facility ID and then sum all the slots that are being booked so I can write sum of slots over here and then I want to name this column total slots uh looking at the expected results but this will actually not work because um it’s it’s two two separate words so I actually need to use quotes for this and remember I have to use double quotes because it’s a column name so it’s always double quotes for the column name and single quotes for pieces of text and finally I need to order by facility ID and I get the results so for facility ID zero we looked at all the rows where facility ID was zero and we squished all of this to a single value which is the unique facility ID and then we looked at all the slots that were occurring in these rows and then we compress them we squished them to a single value as well using the sum aggregation so summing them all up and then we get the slum the sum of the total slots list the total slots booked per facility in a given month so this is similar to the previous problem except that we are now isolating a specific time period And so let’s us think about how we can um select bookings that happened in the month of September 2012 now we can go to the bookings table and select the start time column and to help our exercise I will order by start time uh descending and I will limit our results to 20 and you can see here that start time is a time stamp call and it goes down to the second because we have year month day hour minutes second so how can we check whether any of these dates is corresponds to September 2012 we could add a logical check here we could say that start time needs to be greater than or equal to 2012 September 1st and it needs to be strictly smaller than 2012 October 1st and this will actually work as an alternative there is a nice function that we could use which is the following date trunk month start time let’s see what that looks like so what do you think this function does like the name suggests it truncates the date to a specific U granularity that we choose here and so all of the months are reduced to the very first moment of the month in which they occur so it is sort of cutting that date and removing some information and reducing the granularity I could of course uh have other values here such as day and then every um time stem here would be reduced to its day but I actually want to use month and now that I have this I can set an equality and I can say that I want this to be equal to September 2012 and this will actually work and I also think it’s nicer than the range that we showed before now I’ve taken the code for the previous exercise and copied it here because it’s actually pretty similar except that now after we get bookings we need to insert a filter to isolate our time range and actually we can use this logical condition directly I’ll delete all the rest and now what I need to do is to change the ordering and I actually need to order by the the total slots here and I get my result to summarize I get the booking table and then I uh take the start time time stamp and I truncate it because I’m only interested in the month of that of that time and then I make sure that the month is the one I actually need and then I’m grouping by facility ID and then I’m getting the facility ID and within each of those groups I’m summing all the slots and finally I’m ordering by this uh column list the total slots booked per facility per month in the year 2012 so again our data is in bookings and now we want to see how we how can we isolate the time period of the year 2012 for this table now once again I am looking at the start time column from bookings uh to see how we can extract the the year so in the previous exercise we we saw the date trunk function and we could apply it here as well so we could say date trunk start time um Year from start time right because we want to see it at the Year resolution and then we will get something like this and then we could check that this is equal to 2012 0101 and this would actually work but there’s actually a better way to do it what we could do here is that we could say extract Year from start time and when we look at here we got a integer that actually represents the year and it will be easy now to just say equal to 2012 and make that test so if we look at what happened here extract is a different function than date time because extract is getting the year and outputting it as an integer whereas date time is still outputting a time stamp or a date just with lower granularity so you have to use one or another according to your needs now to proceed with our query we can get CD bookings and add a filter here and insert this expression in the filter and we want the year to be 2012 so this will take care of isolating our desired time period next we want to check the total slots within groups defined by facility fac ID and month so we want a total for each facility for each month as you can see here in the respected results such that we can say that for facility ID zero in the month of July in the year 2012 we uh booked to 170 slots so let’s see how we can do that this basically means that we have to group by multiple values right and facility ID is easy we have it however we do not have the month so how can we extract the month from the start time over here well we can use the extract function right which is which we just saw so if we write it like this and we put month here um this function will look at the month and then we’ll output the month as an actual integer and um the thing is that I can Group by uh the names of columns but I can also Group by Transformations on columns it works just as well SQL will compute uh this expression over here and then it will get the value and then it will Group by that value now when it comes to getting the columns what I usually do is that when I group by I want to see the The Columns in which I grouped so I just copy what I had here and I add it to my query and then what aggregation do I want to do within the groups defined by these two columns I have seen it in the previous exercise I want to sum over the the slots and get the total slots I also want to take this column over here and rename it as month and now I have to order by ID and month and we get the data that we needed so what did we learn with this exercise we learned to use the extract function to get a number out of a date and we use that we have used uh grouping by multiple columns which simply defines a group as the combination of the unique values of two or more columns that’s what multiple grouping does we have also seen that not only you can Group by providing a column name but you can also Group by a logical operation and you should then reference that same operation in the select statement so that you can get the uh value that was obtained find the count of members who have made at least one booking so where is the data that we need it’s in the bookings table and for every booking we have the ID of the member who has made the booking so I can select this column and clearly I can run a count on this column and the count will return the number of nonnull values however this count as you can see is quite inflated What’s Happening Here is that uh a single member can make any number of bookings and now we’re basically counting all the bookings in here but if I put distinct in here then I’m only going to count the unique values of mid in my booking table and this give me gives me the total number of members who have made at least one booking so count will get you the count of non-null values and count distinct will get you the count of unique nonnull values list the facilities with more than 1,000 slots booked so what do we need to do here we need to look at each facility and how many slots they each booked so where is the data for this as you can see again the data is in the bookings table now I don’t need to do any filter so I don’t need the wear statement but I need to count the total slots within each facility so I need a group pi and I can Group by the facility ID and once I do that I can select the facility ID and to get the total slots I can simply do sum of slots and I can call this total slots it’s double quotes for a column name now I need to add the filter I want to keep those that have some of slots bigger than 1,000 and I cannot do it in a where statement right so if I were to write this in a where statement I would get that aggregate functions are not allowed in wear and if I look at my map uh we have been through this again the wear runs first right after we Source the data whereas aggregations happens happen later so the wear cannot be aware of any aggregations that I’ve done for this purpose we actually have the having component so the having component works just like wear it’s a filter it drops rows based on logical conditions the difference is that having runs after the aggregations and it works on the aggregations so I get the data do my first filtering then do the grouping compute an aggregation and then I can filter it again based on the result of the aggregation so I can now now go to my query and take this and put having instead of where and place it after the group pi and we get our result and all we need to do is to order bu facility ID and we get our result find the total revenue of each facility so we want a list of facilities by name along with their total revenue first question as always where is my data so if I want facility’s name it’s in the facilities table but to calculate the revenue I need to know about the bookings so I’ll actually need to join on both of these tables so I will write from CD bookings book join CD facilities fact on facility ID next I will want the total revenue of the facilities but I don’t even have the revenue yet so my first priority should be to compute the revenue let us first select the facility name and here I will now need to add the revenue so to do that I will need to have something like cost times slots and that determines the revenue of each booking however I don’t have a single value for cost I have two values member cost and guest cost and as you remember from previous exercises I need to choose every time which of them to apply and the way that I can choose is by looking at the member ID and if it’s zero then I need to use the guest cost otherwise I need to use the member cost so what can we use now in order to choose between these two variants for each booking we can use the case statement for this so I will say case and then immediately close it with end and I’ll say when uh book M ID equals zero then Fox guest cost I always need to reference the parent Table after a join to avoid confusion else fax member cost so this will allow me to get the C cost dynamically it allows me to choose between two columns and I can multiply this by slots and get the revenue now if I run this I get this result which is the name of the facility and the revenue but I need to ask myself at what level am I working here in other words what does each row represent well I haven’t grouped yet so each row here represents a single booking having joined bookings and facilities and not having grouped anything we are still at the level of this table where every row represent a single booking so to find the total revenue for each facility I now need to do an aggregation I need to group by facility name and then sum all all the revenue I can actually do this within the same query by saying Group by facility name and if I run this I will now get an error can you figure out why I’m getting this error now so I have grouped by facility name and then I’m selecting by facility name and that works well because now this column has been squished has been compressed to show only the unique names for each facility however I am then adding another column which is revenue which I have not compressed in any way therefore this column has a different number of rows than than this column and the general rule of grouping is that after I group by one or more columns I can select by The Columns that are in the grouping and aggregations right so nothing else is allowed so fax name is good because it’s in the grouping revenue is not good because it’s not in the grouping and it’s not an aggregation and to solve this I can simply turn it into an aggregation by doing sum over here and when I run this this actually works and now all I need to do is to sort by Revenue so if I say order by Revenue I will get the result that I need so there’s a few things going on here but I can understand it by looking at my map now what I’m doing is that I’m first sourcing the data and I’m actually joining two tables in order to create a new table where my data is then I’m grouping by a c a column which is the facility name so this compresses the column to all the unique facility name and next I run the aggregation right so the aggregation can be a sum over an existing column but as we saw in the mental models course the aggregation can also be a sum over a calculation I can actually run logic in there it’s very flexible so if I had a revenue column here I would just say sum Revenue as revenue and it would be simpler but I need to do some to put some logic in there and uh this logic involves uh choosing whether to get guest cost or member cost but I’m perfectly able to put that logic inside the sum and so SQL will first evaluate this Logic for each row and then um it will sum up all the results and it will give me Revenue finally after Computing that aggregation I uh select the columns that I need and then I do an order buy at the end find facilities with a total revenue of less than 1,000 so the the question is pretty clear but wait a second we calculate ated the total revenue by facility in the previous exercise so we can probably just adapt that code here’s the code from the previous exercise so check that out if you want to know how I wrote this and if I run this code I do indeed get the total revenue for for each facility and now I just need to keep those with a revenue less than 1,000 so how can I do that it’s a filter right I need to filter on this Revenue column um I cannot use a wear filter because this uh revenue is an aggregation and it was computed after the group buy after the wear so the wear wouldn’t be aware of that uh column but as we have seen there is a keyword there is a statement called having which does the same job as where it filters based on logical conditions however it works on aggregations so I could say having Revenue smaller than 1,000 unfortunately this doesn’t work can you figure out why this doesn’t work in our query we do a grouping and then we compute an aggregation and then we give it a label and then we try to run a having filter on this label if you look now at our map for The Logical order of SQL operations this is where the group by happens this is where we compute our aggregation and this is where having runs and now having is trying to use the Alias that comes at this step but according to our rules having does not know of the Alias that’s assigned at this step because it hasn’t happened yet now as the discussion for this exercise says there are in fact database systems that try to make your life easier by allowing you to use labels in having but that’s not the case with postgress so we need a slightly different solution here note that if I repeated all of my logic in here instead of using the label it would work so if I do this I will get my result I just need to order by Revenue and you see that I get the correct result why does it work when I put the whole logic in there instead of using the label once again the logic happens here and so the having is aware of this logic having happened but the having is just not aware of the Alias however I do not recommend repeating logic like this in your queries because it increases the chances of errors and it also makes them less elegant less readable so the simpler solution we can do here is to take this original query and put it in round brackets and then create a virtual table using a Common Table expression here and call this all of these T1 and then we can treat T1 like any other table so I can say from T1 select everything where revenue is smaller than 1,000 and then order by Revenue remove all this and we get the correct answer to summarize you can use having to filter on the result of aggregation ations unfortunately in postest you cannot use the labels that you assign to aggregations in having so if it’s a really small aggregation like if it’s select some revenue and then all of the rest then it’s fine to say sum Revenue smaller than 1,000 there’s a small repetition but it’s not an issue however if your aggregation is more complex as in this case you don’t really want to repeat it and then your forced to add an extra step to your query which you can do with a common table expression output the facility ID that has the highest number of slots booked so first of all we need to get the number of slots booked by facility and we’ve actually done it before but let’s do it again where is our data the data is in the booking table and uh we don’t need to filter this table but we need we do need to group by the facility ID and then once we do this we can select the facility ID this will isolate all the unique values of this column and within each unique value we can sum the number of slots and call this total slots and if we do this we get the total slots for each facility now to get the top one the quickest solution really would be to order by total slots and then limit the result to one however this would give me the one with the smallest number of slots because order is ascending by default so I need to turn this into descending and here I would get my solution but given that this is a simple solution and it solved our exercise can you imagine a situation in which this query would not achieve what we wanted it to let us say that there were multiple facilities that had the top number of total slots so the top number of slots in our data set is 1404 that’s all good but let’s say that there were two facilities that had this uh this top number and we wanted to see both of them for our business purposes what would happen here is that limit one so the everything else would work correctly and the ordering would work correctly but inevitably in the ordering one of them would get the first spot and the other would get the second spot and limit one is always cutting the output to a single row therefore in this query we would only ever see one facility ID even if there were more that had the same number of top slots so how can we solve this clearly in instead of combining order by and limit we need to figure out a filter we need to filter our table such that only the facilities with the top number of slots are returned but we cannot really get the maximum of some slots in this query because if I tried to do having some slots equals maximum of some slots I would be told that aggregate function calls cannot be nested and if I go back to my map I can see that having can only run after all the aggregations have completed but what we’re trying to do here is to add a new aggregation inside having and that basically doesn’t work so the simplest solution here is to just wrap all of this into a Common Table expression and then get this uh table that we’ve just defined and then select star where the total slots is equal to the maximum number of slots which we know to be 1404 however we cannot hardcode the maximum number of slots because for one we might not know what it is and for and second it uh it will change with time so this won’t work when the data changes so what’s the alternative to hardcoding this we actually need some logic here to get the maximum value and we can put that logic inside the subquery and the subquery will go back to my table T1 and you will actually find the maximum of total slots from T1 so first this query will run it will get the maximum and then the filter will check for that maximum and then I will get uh the required result and this won’t break if there are many facilities that share the same top spot because we’re using a filter all of them will be returned so this is a perfectly good solution for your information you can also solve this with a window function and um which is a sort of row level aggregation that doesn’t change the structure of the data we’ve seen it in detail in the mental models course so what I can do here is to use a window function to get the maximum value over the sum of slots and then I can I will say over to make it clear that this is a window function but I won’t put anything in the window definition because I I just want to look at my whole data set here and I can label this Max slots and if I look at the data here you can see that I will get the maximum for every row and then to get the correct result I can add a simple filter here saying that total slots should be equal to Max slots and I will only want to return facility ID and total slots so this also solves the problem what’s interesting to note here for the sake of understanding window functions more deeply is that the aggregation function for this uh window Clause works over an aggregation as well so here we sum the total slots over each facility and then the window function gets the maximum of all of those uh value and this is quite a powerful feature um and if I look at my map over here I can see that it makes perfect sense because here is where we Group by facility ID and here is where we compute the aggregation and then the window comes later so the window is aware of the aggregation and the window can work on on that so A few different solutions here and overall um a really interesting exercise list the total slots booked per facility per month part two so this is a bit of a complex query but the easiest way to get it is to look at the expected results so what we see here is a facility ID and then within each month of the year 2012 we get the total number of slots and um at the end of it we have a null value here and for facility zero and what we get is the sum of all slots booked in 2012 and then the same pattern repeats repeats with every facility we have the total within each month and then finally we have the total for that facility in the year here so there’s two level of aggregations here and then if I go at the end there’s a third level of aggregation which is the total for all facilities within that year so there are three levels of aggregation here by increasing granularity it’s total over the year then total by facility over the year and then finally total by Facility by month within that year so this is a bit breaking the mold of what SQL usually does in the sense that SQL is not designed to return a single result with multiple levels of aggregation so we will need to be a bit creative around that but let us start now with the lowest level of granularity let’s get this uh this part right facility ID and month and and then we’ll build on top of that so the table that I need is in the bookings table and first question do I need to filter this table yes because I’m only interested in the year 2012 so we have seen that we can use the extract function to get the year out of a Tim stamp which would be start time and we can use this function in a wear filter and what this function will do is that it will go to that time stamp and then we will get an integer out of it it will get a number and then we can check that this is uh the year that we’re interested in and let’s do a quick sanity check to make sure this worked so I will get some bookings here and they will all be in the year 2012 next I need to Define my grouping right so I will need to group by facility ID but then I will also need to group by month however I don’t actually have a column named uh month in this table so I need to calculate it I can calculate it once again with the extract function so I can say extract extract month from start time and once again this will go to the start time and sped out a integer which for this first row would be seven and uh as you know in the group bu I can select a column but I can also select an operation over a column which works just as well now after grouping I cannot do select star anymore but I want to see The Columns that I have grouped by and so let us do a quick sanity check on that it looks pretty good I get the facility ID and the month and I can actually label this month and next I simply need to take the sum over the slots within each facility and within each month and when I look at this I have my first level of granularity and you can see that the first row corresponds to the expected result now I need to add the next level of granularity which is the total within each facility so can you think of how can I add that next level of granularity to my results the key Insight is to look at this uh expected results table and to see it as multiple tables stacked on top of each other one table is the one that we have here and this is uh total by facility month a second table that we will need is the total by facility and then the third table that we will need is the overall total which you could see here at the bottom and how can we stack multiple tables on top of each each other with a union statement right Union will stack all the rows from my tables on top of each other so now let us compute the table which has the total by facility and I will actually copy paste what I have here and and I just need to remove a level of grouping right so if I do this I I will not Group by month anymore and I will not Group by month anymore and once I do this I get an error Union query must have the same number of columns so do you understand this error here so I will write a bit to show you what’s happening so how does it work when we Union two tables let’s say the first table in our case is facility ID month and then slots and then the second table if you look here it’s facility ID and then slots now when you Union these two tables SQL assumes that you have the same number of columns and that the ordering is also identical so here we are failing because the first table has three columns and the second table has only two and not only We are failing because there’s a numbers mismatch but we are also mixing the values of month and Slots now this might work because they’re both integers so SQL won’t necessarily complain about this but it is logically wrong so what we need to do is to make sure that when we’re unioning these two tables we have the same number of columns and the same ordering as well but how can we do this given that the second table does indeed have one column less it does have less information so what I can do is to put null over here so what happens if I do select null this will create a column of a of constant value which is a column of all NS and then the structure will become like this now when I Union first of all I’m going to have the same number of columns so I’m not going to see this uh this error again that we have here and second in u the facility ID is going to be mixed with the facility ID slots is going to be mixed with slots which is all good and then month is going to be mixed with null which is what we want because in some cases we will have the actual month and in some cases we won’t have any anything so I have added uh null over here and I am unioning the tables and if I run the query I can see that I don’t get any error anymore and this is what I want so I can tell that this row is coming from the second table because it has null in the value of month and so it’s showing the total slots for facility um zero in every month whereas this row came from the upper table because it’s showing the sum of slots for a facility within a certain month so this achieves the desired result next we want to compute the last level of granularity which is the total so once again I will select my query over here and and I don’t even need to group by anymore right because it’s the total number of slots over the whole year so I can simply say sum of slots as slots and remove the grouping next I can add the Union as well so that that I can keep stacking these tables and if I run this I get the same error as before so going back to our little uh text over here we are now adding a third table and this table only has slots and of course I cannot this doesn’t work because there’s a mismatch in the number of columns and so the solution here is to also add a null column here and a null column here and so I have the same number of columns and Slots gets combined with slots and everything else gets filled with null values and I can do it here making sure that the ordering is correct so I will select null null and then sum of slots and if I run this query I can see that the result works the final step is to add ordering sorted by ID and month so at the end of all of these unions I can say order by facility ID one and I finally get my result so this is now the combination of three different tables stacked on top of each other that show different levels of granularity and as you can see here in the schema we added null columns to uh two of these tables just to make sure that they have the same number of columns and that they can stack up correctly and now if we look again at the whole query we can see that there are actually three select statements in this query meaning three tables which are calculated and then finally stack with Union and all of them they do some pretty straightforward aggregation the first one um Aggregates by facility ad and month after extracting the month the second one simply Aggregates by facility ID and the third one gets the sum of slots over the whole data without any grouping and then we are adding the null uh constant columns here to make the the column count [Music] match and it’s also worth it to see this in our map of the SQL operations so here um you can see that this order is actually repeating for every table so for each of our three tables we are getting our data and then we are running a filter to keep the year 2012 and then we do a grouping and compute an aggregation and select the columns that we need adding null columns when necessary and then it repeats all over right so for the second table again the same process for the third table the same process except that in the third table we don’t Group by and then when all three tables are done the union r runs the union runs and stacks them all up together and now instead of three tables I only have one table and after the union has run now I can finally order my table and return the result list the total hours booked per named facility so we want to get the facility ID and the facility name and the total hours that they’ve been booked keeping keeping in mind that what we have here are number of slots for each booking and a slot represents 30 minutes of booking now to get my data I will need both the booking table and the facilities table because I need both the information on the bookings and the facility name so I will get the bookings table and the facilities table and join them together next I don’t really need to filter on anything but I need to group by facility so I will Group by facility ID and then I also need to group by facility name otherwise I won’t be able to use this in the select part and now I can select these two columns and to get the total hours I will need to get the sum of the slots so I can get the total number of slots within each facility and I will need to divide this by two right so let’s see what that looks like now superficially this looks correct but there’s actually a pitfall in here and to realize a pitfall I will take some slots as well before dividing it by two and you can see it already in the first row 9911 ided by 2 is not quite 455 so what is happening here the thing is that in postgress when you take an integer number such as some slots the sum of the slots is an integer number and you divide by another integer postgress assumes that you you are doing integer Division and since you are dividing two integers it returns uh an integer as well so that means that um that the solution is not exact if you are thinking in floating Point numbers and the solution for this is that at least one of the two numbers needs to be a Flo floating Point number and so we can turn two into 2.0 and if I run this I now get the correct result so it’s important to be careful with integer division in postest it is a potential Pitfall now what I need to do is to reduce the number of zeros after the comma so I need some sort of rounding and for this I can use the round function which looks like this and this is a typical function in uh in SQL and how it works is that it takes two arguments the first argument is a column and actually this is the column right this whole operation and then the second argument is how many uh figures do you want to see after the zero after the comma sorry so now I can clean this up a bit label this as total hours and then I will need to order by facility ID and I get my result so nothing crazy here really we Source our data from a join which is this part over here and then we Group by two columns we select those columns and U then we sum over the slots divide making sure to not have integer division so we use one of the numbers becomes a floating Point number and we round the result of this column list each Member’s First booking after September 1st 2012 so in order to get our data where does our data leave we need the data about the member and we also need data about their bookings so the data is actually in the members and bookings table so I will quickly join on these [Music] tables and we now have our data do we need a filter on our data yes because we only want to look after September 1st 2012 so we can say where start time is bigger than and it should be enough to just provide the date like this now in the result we need the members surname and first name and their memory ID and then we get to we need to see the first booking in our data meaning the earliest time so again we have an aggregation here so in order to implement this aggregation I need to group by all of these columns that I want to call so surname first name and member ID now that I have grouped by this columns I can select them so now I am I have grouped by each member and now I have all the dates for all their bookings after September 1st 2012 and now how can I look at all these dates and get the earliest date what type of aggregation do I need to use I can use the mean aggregation which will look at all of the dates and then compress them to a single date which is the smallest date and I can call this start time finally I need to order by member ID and I get the result that I needed so this is actually quite straightforward I get my data by joining two tables I make sure I only have the data that I need by filtering on the on the time period and then I group by all the information that I want to see for each member and then within each member I use mean to get the smallest date meaning the earliest date now I wanted to give you a bit of an insight into the subtleties of how SQL Compares timestamps and dates because the results here can be a bit surprising so I wrote three logical Expressions here for you and your job is to try to guess if either of these three Expressions will be true or false so take a look at them and try to answer that as you can see what we have here is a time stamp uh that indicates the 1st of September 8:00 whereas here we have uh simply the indication of the date the 1st of September and the values are the same in all three but my question is are they equal is this uh greater or is this smaller so what do you think I think the intuitive answer is to say that in the first case we have September 1st on one side September 1st on the other they are the same day so this ought to be true whereas here we have again the same day on both sides so this is not strictly bigger than the other one so this should be false and it is also not strictly smaller so this would be false as well now let’s run the query and see what’s actually happening right so what we see here is that we thought this would be true but it’s actually false we thought this would be false but it’s actually uh true and this one is indeed false so are you surprised by this result or is it what you expected if you are surprised can you figure out what’s going on here now what is happening here is that you are running a comparison between two expressions which have a different level of granularity the one on the left is showing you day hour minute seconds and the one on the right is showing you the date only in other words the value on the left is a Tim stamp whereas the value on the right is a date so different levels of precision here now to make the comparison work SQL needs to convert one into the other it needs to do something that is known technically as implicit type coercion what does it mean type is the data type right so either time stamp or date type coercion is when you take a value and you convert it to a different type and it’s implicit uh because we haven’t ask for it and SQL has to do it on its own behind the scenes and so how does SQL choose which one to convert to the other the choice is based on let’s keep the one with the highest precision and convert the other so we have the time stamp with the higher Precision on the left and we need to convert the date into the timestamp this is how SQL is going to handle this situation it’s going to favor the one with the highest Precision now in order to convert a date to a time stamp what SQL will do is that it will add all zeros here so this will basically represent the very first second of the day of uh September 1st 2012 now we can verify which I just showed you I’m going to comment this line and I’m going to add another logical expression here which is taking the Tim stamp representing all zeros here and then setting it equal to the date right here so what do we we expect to happen now we have two different types there will be a type coercion and then SQL will take this value on the right and turn it into exactly this value on the left therefore after I check whether they’re equal I should get true here turns out that this is true but I need to add another step which is to convert this to a Tim stamp and after I do this I get what I expected which is that this comparison here is true so what this notation does in postest is that it does the type coercion taking this date and forcing it into a time stamp and I’ll be honest with you I don’t understand exactly why I need to to do this here I thought that this would work simply by taking this part over here but u i I also need to somehow explicitly tell SQL that I want this to be a time stamp nonetheless this is the Insight that we needed here and it allows us to understand why this comparison is actually false because we are comparing a time stamp for the very first second of September 1st with a time stamp that is the first second of the eighth hour of September 1st and so it fails and we can also see why on on this line the left side is bigger than the right hand side and uh and this one did not actually fool us so we’re good with that so long story short if you’re just getting started you might not know that SQL does this uh implicit type coercion in the background and this dates comparison might leave you quite confused now I’ve cleaned the code up a bit and now the question is what do we need to do with the code in order to match our initial intuition so what do we need to do such that this line is true and the second line is false and this one is still false so we don’t have to worry about it well since the implicit coercion turns the date into a time stamp we actually want to do the opposite we want to turn the time stamp into a date so it will be enough to do the type coion ourselves and transform this into dates like this and when I run this new query I get exactly what I expected so now I’m comparing at the level of precision or granularity that I wanted I’m only looking at the at the date so I hope this wasn’t too confusing I hope it was a bit insightful and that you have a new appreciation for the complexities that can arise when you work with dates and time stamps in SQL produce a list of member names with each row containing the total member count let’s look at the expected results we have the first name and the surname for each member and then every single row shows the total count of members there are 31 members in our table now if I want to get the total count of members I can take the members table and then select the count and this will give me 31 right but I cannot add first name and surname to this I will get uh an error because count star is an aggregation and it takes all the 31 rows and produces a single number which is 31 while I’m not aggregating first name and surname so the standard aggregation doesn’t work here I need an aggregation that doesn’t change the structure of my table and that works at the level of the row and to have an aggregation that works at the level of the row I can use a window function and the window function looks like having an aggregation followed by the keyword over and then the definition of the window so if I do this I get the count at the level of the row and to respect the results I need to change the order a bit here and I get the result that I wanted so a window function has these two main components an aggregation and a window definition in this case the aggregation counts the number of rows and the window definition is empty meaning that our window is the entire table and so this aggregation will be computed over the entire table and then added to each row there are far more details about the window functions and how they work in my mental model course produce a numbered list of members ordered by their date of joining so I will take the members table and I will select the first name and surname and to to produce a numbered list I can use a window function with the row number aggregation so I’ll say row number over so row number is a special aggregation that works only for window functions and what it does is that it numbers the rows um monotonically giving a number to each starting from one and going uh forward and it never assigns the same number to two rows and in the window you need to define the ordering uh for for the numbering so what is the ordering in this case it’s um defined by the join date and by default it’s ascending so that’s good and we can call this row number and we get the results we wanted and again you can find a longer explanation for this with much more detail about the window functions and and row number in the mental models course output the facility ID that has the highest number of slots booked again so we’ve we’ve already solved this problem in a few different ways let’s see a new way to to solve it so we can go to our bookings table and we can Group by facility ID and then we can get the facility ID in our select and then we could sum on slots to get the total slots booked for each facility and since we’re dealing with window functions we can also rank facilities based on the total slots that they have booked and this would look like rank over order by some slots descending and we can call this RK for Rank and if I order by some slots uh descending I should see that my rank works as intended so we’ve seen this in the mental models course you can think of rank as U deciding the outcome of a Race So the person who did the most in this case gets ranked one and then everyone else gets rank two 3 four but if there were two um candidates that got the same score the highest score they would both get rank one because they would both have won the race so to speak and the rank here is defined over the window of the sum of slots descending so that is what we need and next to get all the facilities that have the highest score or we could wrap this into a Common Table expression and then take that table and then select the facility ID and we can label this column total then we will get total and filter for where ranking is equal to one and we get our result aside from how rank works the the other thing to note in this exercise is that we can Define the window based on an aggregation so in this case we are ordering the elements of our window based on the sum of slots and if we look at our map over here we can see that uh we get the data we have our group ey we have the aggregation and then we have the window so the window follows the aggregation and So based on our rules the window has access to the aggregation and it’s able to use it rank members by rounded hours used so the expected results are quite straightforward we have the first name and the surname of each member we have the total hours that they have used and then we are ranking them based on that so the information for this result where is it uh we can see that it’s in the members and bookings tables and so we will need to join on these two tables members Ms join bookings book on M ID and that’s our join now we need to get the total hours so we can Group by our first name and we also need to group by the surname because we will want to display it and now we can select these two columns and we need to compute the total hours so how can we get that for each member we know the slots that they got uh at every booking so we need to get all those those uh slots sum them up and uh every slot represents a 30 minute interval right so to get the hours we need to divide this value by two and remember if I take an integer like sum of slots and divide by two which is also an integer I’m going to have integer division so I won’t have the part after the comma in the result of the division and that’s not what I want so instead of saying divide by two I will say divide by 2.0 so let’s check um how the data looks like this is looking good now but um if we read the question we want to round to the nearest 10 hours so 19 should probably be 20 115 should probably be 120 because I think that we round up when we have 15 and so on as you can see here in the result so how can we do this rounding well we have a Nifty round function which as the first argument takes the column with all the values and the second argument we can specify how do we want the rounding and to round to the nearest 10 you can put -1 here so actually let’s keep displaying the the total hours as well as the rounded value to make sure that we’re doing it correctly so as you can see we are indeed um rounding to to the nearest 10 so this is looking good and for the to understand the reason why I used minus one here and how the rounding function works I will have a small section about it when we’re done with this exercise but meanwhile Let’s uh finish this exercise so now I want to rank all of my rows based on this value here that I have comped computed and since this is an aggregation it will already be available to a window function right because in The Logical order of operations aggregation happen here and then Windows happen afterward and they have access to the data uh from the aggregation so it should be possible to transform this into a window function so think for a moment uh of how we could do that so window function has its own aggregation which in this case is a simple Rank and then we have the over part which defines the window and what do we want to put in our window in this case we want to order by let’s say our um rounded hours and we want to order descending because we want the guest the member with the high hours to have the best rank but uh clearly we don’t have a column called rounded hours what we have here is this logic over here so I will substitute this name with my actual logic and I will get my actual Rank and now I can delete this column here that I was was just looking at and I can sort by rank surname first name small error here I actually do need to show the hour as well so I need to take this logic over here again and call this ours and I finally get my result so to summarize what we are doing in this exercise we’re getting our data by joining these two tables and then we’re grouping by the first name and the surname of the member and then we are summing over the slots for each member dividing by 2.0 to make sure we have an exact Division and uh using the rounding function to round down to the nearest hour and so we get the hours and we use the same logic inside a window function to have a ranking such that the members with the with most hours get rank of one and then the one with the second most hours get rank of two and so on as you can see here in the result and I am perfectly able to use use this logic to Define The Ordering of my window because window functions can use uh aggregations as seen in The Logical order of SQL operations here because window functions occur after aggregations and um and that’s it then we just order by the required values and get our results now here’s a brief overview of how rounding Works in SQL now rounding is a function that takes a certain number and then returns an approximation of that number which is usually easier to parse and easier to read and you have the round function and it works like this the first argument is a value and it can be a constant as in this case so we just have a number or it can be a column um in which case it will apply the round function to every element of the column and the second argument specifies how we want the rounding to occur so here you can see the number from which we start and the first rounding we apply has an argument of two so this means that we really just want to see two uh numbers after the decimal so this is what the first rounding does as you can see here and we we round down or up based on whether the values are equal or greater than five in which case we round up or smaller than five in which case we round down so in this first example two is lesser than five so we just get rid of it and then we have eight eight is greater than five so we have to round up and so when we round up this 79 becomes an 80 and this is how we get to this first round over here here then we have round with an argument of one which leaves one place after the decimal and which is this result over here and then we have round without any argument which is actually the same as providing an argument of zero which means that we really just want to see the whole number and then what’s interesting to note is that the rounding function can be generalized to continue even after we got rid of all the decimal part by providing negative arguments so round with the argument of-1 really means that I want to round uh round this number to the nearest 10 so you can see here that from 48,2 192 we end up at 48,2 190 going to the nearest 10 rounding with a value of -2 means going to the nearest 100 so uh 290 the nearest 100 is 300 right so we have to round up and so we get this minus 3 means uh round to the nearest thousand so if you look at here we have 48,3 and so the nearest thousand to that is 48,000 minus 4 means the nearest 10,000 ,000 so given that we have 48,000 the nearest 10,000 is 50,000 and finally round minus 5 means round to the nearest 100,000 and um the given that we have 48,000 the nearest 100,000 is actually zero and from now on as we keep going negatively we will always get zero on this number so this is how rounding Works in brief it’s a pretty useful function not everyone knows that you can provide it negative arguments actually I didn’t know and then when I did the first version of this course um commenter pointed it out so shout out to him U don’t know if he wants me to say his name but hopefully now you understand how rounding works and you can use it in your problems find the top three Revenue generating facilities so we want a list of the facilities that have the top three revenues including ties this is important and if you look at the expected results we simply have a the facility name and a bit of a giveaway of what we will need to use the rank of these facilities so there’s this other exercise that we did a while back which is find the total revenue of each facility and from this exercise I have taken the code that uh allows us to get to this point where we see the name of the facility and the total revenue for that facility and you can go back there to that exercise to see in detail how this code works but in brief we are joining the bookings and Facilities tables and we are grouping by facility name and then we are getting that facility name and then within each booking we are Computing the revenue by taking the slots and using a case when to choose whether to use guest cost or member cost and so this is how we get the revenue for each single booking and now given that we grouped by facility we can sum all of these revenues to get the total revenue of each facility and this is how we get to this point given this partial result all that’s left to do now is to rank these facilities based on their revenue so what I need here is a window function that will allow me to implement this ranking and this window function would look something like this I have a rank and why is rank the right function even though they sort of uh gave it away because if you want the facilities who have the top revenues including ties you can think of it as a race all facilities are racing to get to the top revenue and then if two or three or four facilities get that top Revenue if there are more in the top position you can’t arbitrarily say oh you are first and they are second second you have to give them all the rank one because you have to tell them um recognize that they are all first so these type of problems uh call for a ranking solution so our window function would use rank as the aggregation and then we need to Define our window and how do we Define our window we Define the ordering for the ranking here so we can say order by Revenue descending such that the high highest revenue will get rank one the next highest will get rank two and so on now this will not work because I don’t have the revenue column right I do have something here that is labeled as Revenue but the ranking part will not be aware of this label however I do have the logic to compute the revenue so I could take the logic right here and paste it over here and I will add a comma now this is not the most elegant looking code but let’s see if it works and we need to order by Revenue descending to see it in action and if I order by Revenue descending you can in fact see that the facility with the highest revenue gets rank one and then it goes down from there so now I just need to clean this up a bit first I will remove the revenue column and then I will remove the ordering and what I need here for the result is to keep only the facilities that have rank of three or smaller so ranks 1 2 three and there’s actually no way to do it in this query so I actually have to wrap this query into a common table expr expression and then take that table and say select star from T1 where rank is smaller or equal to three and I will need to order by rank ascending here and I get the result I needed so what happened here we built upon the logic of getting the total revenue for each facility and again we saw that in the previous exercise and um then what we did here is that we added a rank window function and within this rank we order by this total revenue so this might look a bit complex but you have to remember that when we have many operations that are nested you always start with the innermost operation and move your way up from there so the innermost operation is a case when which chooses between guest cost and member cost and then multiplies it by slots and this inner operation over here is calculating the revenue for each single booking the next operation is an aggregation that takes that revenue for each single booking and sums this these revenues up to get the total revenue by each facility and finally the outermost operation is taking the total revenue for each facility and it’s ordering them in descending order in order to figure out the ranking and the reason all of this works we can go back to our map of SQL operations you can see here that after getting the table the first thing that happens here is the group buy and then the aggregations and here is where we sum over the total of of Revenue and after the aggregation is completed we have the window function so the window function has access to the aggregation and can use them when defining the window and finally after we get the ranking we we have no way of isolating only the first three ranks in this query so we need to do it with a common table expression and if you look here back to our map this makes sense because what components do we have in order to filter our table in order to only keep certain rows we have the wear which happens here very early and we have the having and they both happen before the window so after the window function you actually don’t have another filter so you need to use a Common Table expression classify facilities by value so we want to classify facilities into equally sized groups of high average and low based on their revenue and the result you can see it here for each facility it’s classified as high average or low and the point is that we decid decided uh at the beginning that we want three groups and this is arbitrary we could have said we want two groups or five or six or seven and then but we have three and then all the facilities that we have are distributed equally Within These groups so because we have nine facilities we get uh three facilities within each group and I can already tell you that there is a spe special function that will do this for us so we will not go through the trouble of implementing this manually which could be pretty complex so I have copied here the code that allow allows me to get the total revenue for each facility and we have seen this code more than one time in past exercises so if you’re still not clear about how we can get to this point uh check out the the previous exercises so what we did in the previous exercise was rank the facilities based on the revenue and how we did that is that we took the ranking window function and then we def defined our window as order by Revenue descending except that we don’t have a revenue column here but we do have the logic to compute the revenue so we can just get this logic and paste it in here and when I run this I will get a rank for each of my facilities where the biggest Revenue gets rank one and then it goes up from there now the whole trick to solve this exercise is to replace the rank aggregation with a antile aggregation and provide here the number of groups in which we want to divide our facilities and if I run this you see that I get what I need the facilities have been equally distributed into three groups where group number one has the facilities with the highest revenue and then we have group number two and finally group number three which has the facilities with the lowest revenue and to see how this function works I will simply go to Google and say postest antile and the second link here is the postest documentation and this is the page for window functions so if I scroll down here I can see all of the functions that I can use in window functions and you will recognize some of our old friends here row number rank dance rank uh and here we have antile and what we see here is that antile returns an integer ranging from one to the argument value and the argument value is what we have here which is the number of buckets dividing the partition as equally as possible so we call the enti function and we provide how many buckets we want to divide our data into and then the function divides the data as equally as possible into our buckets and how will this division take place that depends on the definition of the window in this case we are ordering by Revenue descending and so this is how the ntile function works so we just need to clean this up a bit I will remove the revenue part because that’s not required from us and I will call this uh enti quite simply and now I need to add a label on top of this enti value as you can see in the results so to do that I will wrap this into a Common Table expression and when I have a common table expression I don’t need the ordering anymore and then I can select from the table that I have just defined and what what do I want to get from this table I want to get the name of the facility and then I want to get the enti value with a label on top of it so I will use a case when statement to assign this label so case when NTI equals 1 then I will have high when anti equals 2 then I will have average else I will have low uh and the case and call this revenue and finally I want to order by antile so the results are first showing High then average then low and also by facility name and I get the result that I wanted so to summarize uh this is just like the previous exercise except that we use a different window function because instead of rank we use end tile so that we can pocket our data and in the window like we said in the previous exercise there’s a few nested operations and you can figure it out by going to the deepest one and moving upwards so the first one picks up the guest cost or member cost multiplies it by slots gets the revenue Vue for each single booking the next one Aggregates on top of this within each facility so we get the total revenue by facility and then we use this we order by Revenue descending this defines our window and this is what the bucketing system uses to distribute the facilities uh in each bucket based on their revenue and then finally we need to add another layer of logic uh here we need to use a common table expression so that we can label our our percentile with the required um text labels calculate the payback time for each facility so this requires some understanding of the business reality that this data represents so if we look at the facilities table we have an initial outlay which represents the initial investment that was put into getting this facility and then we also have a value of monthly maintenance which is what we pay each month to keep this facility running and of course we will also have a value of monthly revenue for each facility so how can we calculate the amount of time that each facility will take to repay its cost of ownership let’s actually write it down so we don’t lose track of it we can get the monthly revenue of each facility but what we’re actually interested in is the monthly profit right um and to get the profit we can subtract the monthly maintenance for each facility so Revenue minus expenses equals profit and when we know how much profit we make for the facility each month we can take the initial investment and divided by the monthly profit and then we can see how many months it will take to repay the initial investment so let us do that now and what I have done here once again I copied the code to calculate the total revenue for each facility and um we have seen this in the previous exercises so you can check those out if you still have some questions about this and now that we have the total revenue for each facility we know that we have three complete months of data so far so how do we get to this to the monthly Revenue it’s as simple as dividing all of this by three and I will say 3.0 so we don’t have integer division but we have proper division you know and I can call this monthly revenue and now the revenue column does not exist anymore so I can remove the order buy and here I can see the monthly revenue for each facility and now from the monthly revenue for each facility I can subtract the monthly maintenance and this will give me the monthly profit but now we get this error and can you figure out what this is about monthly maintenance does not appear in the group by Clause so what we did here is that we grouped by facility name and then we selected that which is fine and all the rest was gation so remember as a rule when you Group by you can only select the columns that you have grouped by and aggregations and monthly maintenance uh is not an aggregation so in order to make it work we need to add it to the group by statement over here and now I get the monthly profit and finally the last step that I need to take is to take the initial outlay and divide it by by all of the rest that we have computed until now and we can call this months because this will give us the number of months that we need in order to repay our initial investment and again we get the same issue initial outlay is not an aggregation does not appear in the group by clause and easy solution we can just add it to the group by clause so something is pretty wrong here the values look pretty weird so looking at all this calculation that we have done until now can you figure out why the value is wrong the issue here is related to the order of operations because we have no round brackets here the order of operation will be the following initial outlay will be divided by the total revenue then it will be divided by 3.0 and then out of all of these we will subtract monthly maintenance but that’s not what we want to do right what we want to do is to take initial outlay and divide it by everything else which is the profit so I will add round brackets here and here and now we get something that makes much more sense because first we execute everything that’s Within These round brackets and we get the monthly profit and then all of it we divide initial outlay by and then what we want to do is to order by facility name so I will add it here and we get the result so quite a representative business problem calculating a revenue and profits and time to repay initial investment and uh overall is just a bunch of calculations starting from the group bu that allows us to get the total revenue for each booking we sum those revenues to get the total revenue for each facility divide by three to get the monthly Revenue subtract the monthly expenses to get the monthly profit and then take the initial investment and divide by the monthly profit and then we get the number of months that it will take to repay the facility calculate a rolling average of total revenue so for each day in August 2012 we want to see a rolling average of total revenue over the previous 15 days rolling averages are quite common in business analytics and how it works is that if you look at August 1st this value over here is the average of daily revenue for all facilities over the past 15 days including the day of August 1st and then this average is rolling by one win one day or sliding by one day every time so that the next average is the uh same one except it has shifted by one day because now it includes the 2nd of August so let’s see how to calculate this and in here I have basic code that calculates the revenue for each booking and I’ve taken this from previous exercises so if you have any questions uh check those out and what we have here is the name of each facility and um and the revenue for each booking so each row here represents just a single booking so this is what we had until now but if you think about it we’re not actually interested in seeing the name of the facility because we’re going to be uh summing up over all facilities we’re not interested in the revenue by each facility but we are interested in seeing the date in which each booking occurs because we want to aggregate within the date here so to get the date I can get the start part time field from bookings and because this is a time stamp so it shows hours minutes seconds I need to reduce it to a date and what I get here is that for again each row is a booking and for each booking I know the date on which it occurred and the revenue that it generated now for the next step I need to see the total revenue over each facility within the date right so this is a simple grouping so if I group by this calculation over here which gives me my date I can then get the date and now I have um I have compressed all the different occurrences of dates to Unique values right one row for every date and now I need to compress as well all these different revenues for each date to a single value and for that I can put this logic inside the sum aggregation as we have done before and this will give me the total revenue across all facilities for each day and we have it here for the next step my question for you is how can I see the global average over all revenues on each of these rows so that is a roow level aggregation that doesn’t change the structure of the table and that’s a window function right so I can have a window function here that gets the average of Revenue over and for now I can leave my window definition open because I will look at the whole table however um Revenue will not work because revenue is just a label that I’ve given on this column and but but this part here is not aware of the label I don’t actually have a revenue column at this point but instead of saying Revenue I could actually copy this logic over here and it would work because the window function occurs after Computing the aggregation so the window function is aware of it so this should work and now for every row I see the global average over all the revenues by day now for the next step I would like to first order by date ascending so we have it here in order and my next question of for you is how can we make this a cumulative average average so let’s say that our rows are already ordered by date and how can I get the average to grow by date so in the first case the average would be equal to the revenue because we only have one value on the second day the average would be the average of these two values so all the values we’ve seen until now on the third day it would be the average of the first three values and so on how can I do that the way that I can do that is that I can go to my window definition over here and I can add an ordering and I can order by date but of course the column date does not exist because that’s a label that will be assigned after all this part is done uh window function is not aware of labels but again window function works great with logic so I will take the logic and put it in here and now you can see that I get exactly what I wanted on the first row I get the average is equal to the revenue and then as it grows we only look at the current revenue and all the previous revenues to compute the average and but we don’t look at all of the revenues so on the second row uh we have the average between this Revenue over here and this one over here and then on the third row we have the average between these three revenues and so on now you will realize that we are almost done with our problem and the only piece that’s missing is that right now if I pick a random day within my data set say this one the the average here is computed over all the revenues from the previous days so all the days in my data that lead up to this one they get averaged and we compute this revenue and what I want to do to finish this problem is that instead of looking at all the days I only want to look 15 days back so I need to to reduce the maximum length that this window can extend in time from limited to 15 days back now here is where it gets interesting so what we need to do is to fine-tune the window definition in order to only look 15 days back and with window functions we do have the option to fine-tune the window and it turns out that there’s a another element to the window definition which is usually implicit it’s usually not written explicitly but it’s there in the background and it’s the rows part so I will now write rows between unbounded preceding and current rows row now what the rose part does is that it defines how far back the window can look and how far forward the the window can look and what we see in this command is actually the standard Behavior it’s the thing that happens by default which is why we usually don’t need to write it and what this means is that it says look as far back in the past as you can look as far back as you can based on the ordering and the current row so this is what we’ve been seeing until now and if I now run the query again after adding this part you will see that the values don’t change at all because this is what we have been doing until now so now instead of unbounded proceeding I want to look 14 rows back plus the current row which together makes 15 and if I run this my averages change because I’m now looking um I’m now averaging over the current row and the 14 previous rows so the last 15 values and now what’s left to do to match our result is to remove the actual Revenue over here and call this Revenue and finally we’re only interested in values for the month of August 2012 so we need to add a filter but we cannot add a filter in this table definition here because if we added a wear filter here um isolating the period for August 2012 can you see what the problem would be um if my data could only see um Revenue starting from the 1st of August he wouldn’t be able to compute the rolling average here because to get the rolling average for this value you need to look two weeks back and so you need to look into July so you need all the data to compute the rolling revenue and we must filter after getting our result so what that looks like is that we can wrap all of this into a Common Table expression and we can we won’t need the order within the Common Table expression anymore and then selecting this we can filter to make sure that the date fits in the required period so we could truncate this date at the month level and make sure that it is equal that the truncated value value is equal to the month of August and we have seen how day trunk works in the previous exercises and then we could select all of our columns and order by date I believe we may have an extra small error here because I kept the partial wear statement and if I run this I finally get the result that I wanted so a query that was a bit more complex it was the final boss of our exercises um so let’s summarize it we get the data we need by joining booking and facility um and then we are getting the revenue for each booking that is this um multiply slots by either guest cost or member cost cost depending on whether the member is a guest or not this is getting the revenue within each booking then we are grouping by date which you see uh over here and summing all of these revenues that we computed so that we get the total revenue within each day for all facilities then the total revenue for each day goes into a window function which computes an aggre ation at the level of each row and the window function computes the average for these total revenues within a specific window and the window is defines an ordering based on time so the the ordering based on date and the default behavior of the window would be to look at the average for the current day and all the days that precede up until the earliest date and we’re doing here is that we are fine-tuning the behavior of this function by saying hey don’t look all the way back in the past uh only look at 14 rows preceding plus the current row which means that given the time ordering we compute the average over the last 15 values of total revenue and then finally we wrap this in a Common Table expression and we filter so that we only see the rolling average for the month of August and we order by date and that were all the exercises that I wanted to do with you I hope you enjoyed it I hope you learned something new as you know there are more sections in here that go more into depth into date functions and string functions and how you can modify data I really think you can tackle those on your own these were the uh Essentials ones that I wanted to address and once again thank you to the author of this website aliser Owens who created this and made it available for free I did not create this website um so you can just go here and without signing up or paying anything you can just do these exercises my final advice for you don’t be afraid of repetition we live in the age of endless content so there’s always something new to do but there’s a lot of value to um repeating the same exercises over and over again when I Was preparing for interviews when I began as a date engineer I did these exercises and altogether I did them like maybe three or four times um and um I found that it was really helpful to do the same exercises over and over again because often I did not remember the solution and I had to think through it all over again and it strengthened those those uh those learning patterns for me so now that you’ve gone through all the exercises and seen my Solutions uh let it rest for a bit and then come back here and try to do them again I think it will be really beneficial in my course I start from the very Basics and I show you in depth how each of the SQL components work I um explore the logical order of of SQL operations and I spend a lot of time in Google Sheets um simulating SQL operations in the spreadsheet coloring cells moving them around making some drawings in excal draw uh so that I can help you understand in depth what’s happening and build those mental models for how SQL operations work this course was actually intended as a complement to that so be sure to check it out

    By Amjad Izhar
    Contact: amjad.izhar@gmail.com
    https://amjadizhar.blog