Help for this page

Select Code to Download


  1. or download this
    create table nodes (
        node_id int primary key,
        name varchar(32)
        -- other node info goes here
    )
    
  2. or download this
    create table edges (
        from_node_id int not null references nodes(node_id),
    ...
        description varchar(32)
        -- other edge info goes here
    )
    
  3. or download this
    -- Allowed states for "Daily Work Task"
    insert graph_nodes values (1, 'Wait/Idle')
    ...
    insert graph_edges values (5, 2, 'Fault resolved normally')
    insert graph_edges values (1, 6, 'System halted')
    insert graph_edges values (2, 6, 'System halted')
    
  4. or download this
    -- Where can I go from node 5?
    select  FR.node_id, '-->', TO.node_id, 'When: ' + E.description
    ...
    join    nodes FR on FR.node_id=E.from_node_id
    join    nodes TO on TO.node_id=E.to_node_id
    where   E.from_node_id = 5
    
  5. or download this
    node_id     node_id
    ------- --- ------- ----------------------------------
          5 -->       2 When: Fault resolved normally
          5 -->       6 When: Manual intervention required