SQL & Smiles: Kai's Computing Adventure

Life, for our family, has always been a beautiful, colourful "mish-mash." From the bustling streets of Hong Kong and the serene beauty of Japan, to the vibrant energy of Singapore, and now back to the familiar comfort of the UK, we've collected stories, experiences, and a unique perspective on the world. And through it all, one constant joy has been watching my incredible son, Kai, grow.

Kai is autistic, and I navigate the world with my own mix of dyslexia and ADHD. This means our learning journey, and indeed, our whole lives, are often a little different – sometimes challenging, but always full of unexpected triumphs. We find our own ways to connect, to learn, and to thrive.

One of my biggest missions as a parent is to give Kai the best possible start in life, especially as he gets older and faces the challenge of finding his place in the working world. It's no secret that many talented neurodivergent individuals struggle to secure employment, often through no fault of their own. I want to equip Kai with practical, real-world skills that genuinely open doors.

That's where "computing" comes in. Kai has a real spark for it! He's doing a computing class at Nescot, which is fantastic, but it primarily focuses on Microsoft Access. Access is great for small projects, but let's be honest, it can be a bit "finicky" when you're trying to do more complex tasks, like handling vast amounts of data or truly understanding how databases really work.

So, I decided to take things a step further. I wanted to introduce him to the powerhouse that is SQL (Structured Query Language) – the universal language of real-world databases. And let me tell you, watching him grasp these concepts has been one of the most rewarding adventures yet! 🚀


From Access to Action: Stepping into the SQL Super League! 💻

Imagine data as building blocks. In Access, you're building with Lego. In SQL Server, you're building skyscrapers! SQL Server is a Relational Database Management System (RDBMS) used by professionals globally, and it offers the robust control and flexibility needed to truly understand what’s happening under the hood.

Our journey began with the very foundations. First, we needed a home for our data – a database. Think of it as a super-organized library for all our information. We kicked things off with:

CREATE DATABASE CollegeDB;
GO
USE CollegeDB;
GO

Next, we built our data "shelves" – the tables. We created Students (to store student names) and Enrollments (for their course sign-ups). The magic truly happened when we connected these tables using Foreign Keys. This is the secret handshake that ensures you can't enroll a student who doesn't actually exist. It's like having a bouncer at the door, keeping our data super clean and consistent. Kai loved the idea of data integrity, of making sure everything was "just right." ✅

Here’s a peek at how we built our Students table:

CREATE TABLE Students (
    StudentID INT IDENTITY(1,1) PRIMARY KEY,
    FirstName NVARCHAR(50) NOT NULL,
    LastName NVARCHAR(50) NOT NULL,
    DateOfBirth DATE NULL
);

And our Enrollments table, with its crucial Foreign Key linking back to Students:

CREATE TABLE Enrollments (
    EnrollmentID INT IDENTITY(1,1) PRIMARY KEY,
    StudentID INT NOT NULL,
    CourseName NVARCHAR(100) NOT NULL,
    EnrollmentDate DATE NOT NULL,
    CONSTRAINT FK_Enrollments_Students FOREIGN KEY (StudentID)
        REFERENCES Students(StudentID)
        ON DELETE CASCADE
        ON UPDATE CASCADE
);

The "Why" Behind the "How": Understanding SQL's Brain 🧠

What makes SQL so cool is not just what you can do with it, but how it works. We explored the two main types of SQL commands:

  • DML – Data Manipulation Language (The Data Whisperers): These are your daily commands for interacting with the data inside your tables.
    • SELECT: "Show me the goods!" (Retrieving data) 🔍
    • INSERT: "Add this new awesome thing!" (Adding data) ➕
    • UPDATE: "Oops, can you tweak this for me?" (Changing existing data) ✍️
    • DELETE: "Time to clear out some old stuff!" (Removing data) 🗑️
  • DDL – Data Definition Language (The Master Builders): These commands are about shaping the structure of your database – the very blueprint itself.
    • CREATE: "Let's build a new table!" (Making new objects) 🏗️
    • ALTER: "Time for a renovation on this table!" (Modifying existing objects) 📐
    • DROP: "Demolish this table entirely!" (Removing objects permanently) 💥

We also peered behind the curtain to see how SQL Server actually thinks. It's like a tiny operating system, managing memory, scheduling tasks, ensuring data integrity with transactions, and logging every change. This understanding is gold for troubleshooting and performance tuning – because sometimes, a slow query isn't your fault, but the engine's "to-do list" being a bit swamped! ⚙️


The "Aha!" Moments: Kai Takes the Wheel 💡

This past week, we delved deeper into the DML commands, and oh, the moments of pure joy!

We started with INSERTs. Kai was already good with adding one student at a time, so we moved to inserting multiple students in a single go. "That's so much faster!" he exclaimed. We used commands like:

-- Insert multiple students in one go (efficient!)
INSERT INTO Students (FirstName, LastName, DateOfBirth) VALUES
('Kai', 'Smith', '2000-06-15'),
('Emma', 'Johnson', '1999-11-22');

-- And later, more students:
INSERT INTO Students (StudentName) VALUES
('Liam'),
('Noah'),
('Emma');

Then came his brilliant question: "What if you insert the same name twice by accident?" This led us to IF NOT EXISTS clauses, a way to tell the database, "Only add this if it's not already there."

-- Only insert if the student doesn't already exist
IF NOT EXISTS ( SELECT 1 FROM Students WHERE StudentName = 'Emma' )
BEGIN
    INSERT INTO Students (StudentName) VALUES ('Emma');
END

"So we can stop people from sneaking in twice!" he proudly declared. Data integrity, folks – it clicked! ✅

Then came UPDATE. This command changes existing data, and it was the source of his biggest "Aha!" moment. He typed out:

-- Update a student's name
UPDATE Students SET StudentName = 'Kai A.' WHERE StudentName = 'Kai';

And after executing it, he looked up, eyes wide, with the biggest smile. "I changed the database!" he shouted. That feeling of control, of seeing his command instantly transform the data – it was everything. He even learned how to UPDATE data from another table, saying it was "like copy and paste, but smarter." ✂️📋

Finally, we tackled DELETE. I explained it like tidying a notebook – removing what you no longer need. We used:

-- Delete a student by name
DELETE FROM Students WHERE StudentName = 'Noah';

But then, the crucial lesson: what happens if you forget the WHERE clause? I showed him, and he gasped. "Whoa," he said, "Let's not do that." The power of DELETE with a missing WHERE clause can wipe out an entire table, and that clear understanding of the consequences, the "Oh, no!" moment, was a vital part of his learning. He even started asking about deleting data with JOINs, showing how much he was connecting the dots:

-- Deleting based on a join (advanced move!)
DELETE s
FROM Students s
INNER JOIN Enrollment e ON s.StudentID = e.StudentID
WHERE e.CourseID = 1;

And of course, we put all these pieces together with SELECT statements, using JOINs to combine data from different tables, like getting a list of students and their courses: 🤝

SELECT s.StudentID, s.FirstName, s.LastName, e.CourseName, e.EnrollmentDate
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID;

We explored different types of joins too, from INNER JOIN (only matching data) to LEFT OUTER JOIN (all from the left, even if no match on the right), RIGHT OUTER JOIN, FULL OUTER JOIN, and even the wild CROSS JOIN that generates every possible combination! Kai was fascinated by how NULL values would appear when there were no matches – a crucial clue for understanding data relationships. 🤔


Our Learning Path: Patience, Play, and Purpose 🌟

Teaching Kai isn't a linear process. Sometimes we repeat things, sometimes we draw diagrams, sometimes we just take a walk when either of us gets stuck. As someone with ADHD and dyslexia, I understand the need for different approaches, for breaking things down, and for the occasional "brain break." We lean into visuals, clear step-by-step instructions, and plenty of hands-on practice. When Kai smiles, or when he asks a truly insightful, "What if?" question, I know he's not just absorbing information – he's thinking critically, connecting concepts, and owning his learning.

This isn't just about SQL commands; it's about building a foundation for Kai's future. It's about equipping him with skills that are in demand, fostering his logical thinking, and showing him that computing can be a fascinating, powerful tool for solving real-world problems. The fact that he's taking to SQL so naturally, mastering SELECT, INSERT, UPDATE, and DELETE with such enthusiasm, fills me with immense pride and hope. ✨

For all the parents out there navigating the beautiful complexities of raising neurodivergent children, or for anyone learning alongside a child: remember that progress is more important than perfection. Celebrate the "Aha!" moments, embrace the detours, and always, always keep that curiosity alive. ❤️

Our journey continues, and next up, we'll dive into the crucial world of transactions, rollback, and building safeguards – because in the real world of data, protecting your information is just as important as knowing how to manipulate it. Stay tuned! 🔒

Comments

Popular posts from this blog

Free Monthly Budget Spreadsheet (UK-Friendly)

Financial Literacy and ADHD – Money, Mistakes, and Learning the Hard Way