Section 1 of 3 · 34 lessons
SQL
Botie's maintenance team has years of inspections, equipment details and sensor readings. How can we use those records to answer a specific question without counting the wrong visits or mixing up assets? Begin with a table and a small query, then work toward analytical queries and dependable databases. The lessons also follow the data into machine learning, where the time a record became available matters as much as its value.
Reading the Records
Botie has a table of inspections, but the team needs answers about particular pumps and visits. Start by defining what each row records, then choose the rows and columns that answer the question.
Missing Values and Decisions
An empty measurement is different from a measurement of zero. Follow what happens when an unknown value enters a comparison, then write decisions that handle those gaps deliberately.
Summarising Maintenance Work
A list of visits does not tell us which site is falling behind. Collect measurements into summaries, keeping the population and missing values visible as the question changes.
Connecting Tables Without Changing the Question
Asset details and inspection visits live in separate tables. Match the records that belong together, then investigate why a reasonable-looking join can count the same work several times.
Queries Built from Queries
Some questions depend on the answer to another question. Give each intermediate result a clear job, from checking whether a visit exists to following the equipment hierarchy.
Analysing Change Across Rows
An average hides the sequence of visits. Keep individual records while comparing neighbouring measurements, ranking results and following totals through time.
Preparing Records for Analysis
Dates, notes and nested records bring their own ambiguities. Work out what each value represents before turning it into something a query can compare.
Features from Historical Data
A prediction needs the records available when the decision was made. Rebuild that boundary for each training example, including measurements that arrived after the event they describe.
Designing Reliable Tables
If an asset appears under two conflicting site names, which record should a query trust? Design the stored relationships and constraints that keep these contradictions from becoming ordinary data.
Making Queries Practical
The query works on a handful of rows. What happens when the table contains years of inspections? Read its plan, choose useful indexes, and pass user inputs without changing the query's instructions.
Keeping Learning Data Trustworthy
A scheduled dataset refresh has to cope with corrections and late records. Build checks that explain failures, then update the dataset without quietly duplicating work or losing older changes.