SQL

Find conflicting current-site copies

BOTIE

Connect rows, determinant field and dependent field to Group values by determinant. Inspect each asset’s distinct site values.
Ready to test
0 passed · 0 failed · 2 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Connect rows, determinant field and dependent field to Group values by determinant. Inspect each asset’s distinct site values.

Repeated job records disagree about where an asset currently lives.

Inspect the component calculation
Group values by determinant(
  Repeated fact records: Repeated job facts
  Determinant field: Determinant field
  Dependent field: Dependent field
)
Examples and results
Repeated job facts
[
  {
    "asset": "P7",
    "site": "north"
  },
  {
    "asset": "P7",
    "site": "south"
  },
  {
    "asset": "P8",
    "site": "south"
  }
]
Determinant field
asset
Dependent field
site
Required result
[
  {
    "id": "P7",
    "values": [
      "north",
      "south"
    ]
  },
  {
    "id": "P8",
    "values": [
      "south"
    ]
  }
]
Repeated job facts
[
  {
    "asset": "P8",
    "site": "east"
  },
  {
    "asset": "P8",
    "site": "west"
  }
]
Determinant field
asset
Dependent field
site
Required result
[
  {
    "id": "P8",
    "values": [
      "east",
      "west"
    ]
  }
]
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

Agreement in a finite sample does not prove a functional dependency for all future records. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

Your last tested pieces can start the full construction. An existing draft there keeps its own pieces.

A repeated model designation disagrees

This check uses the pieces from “Inspect the site dependency”.

BOTIE

This dependency now concerns model rather than site. P2 appears with M1 and M2; P3 appears once with M1. Predict the conflicting determinant IDs.
Repeated job facts
[
  {
    "asset": "P2",
    "model": "M1"
  },
  {
    "asset": "P2",
    "model": "M2"
  },
  {
    "asset": "P3",
    "model": "M1"
  }
]
Determinant field
asset
Dependent field
model

Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

Would different sites be an error if each row meant the site at inspection time?

Clarify the fact’s temporal meaning before calling a repeated value redundant.

Agreement in a finite sample does not prove a functional dependency for all future records.

Work through the SQL challenges →
Continue the courseChange the Requested Jobs Without Rewriting the Rest →