I Don’t Want a Lesson in Computer Science!

2026-11-25 29 min read
Hannes Mühleisen

TL;DR: For seven seasons, the crew of the Enterprise talked to the ship’s computer and solved hard data problems. We gave Claude a DuckDB database and the crew’s actual lines to see whether we have the Enterprise computer now.

I have been a “Trekkie” ever since I watched Star Trek: The Next Generation (TNG) on weekday afternoons back in the ’90s. We had grainy terrestrial TV reception because my parents refused to pay for cable. Also, I had to fight my younger sister because she wanted to watch The Nanny instead, which was on at the same time. Oh, and it was all dubbed into German with a terrible translation. But the magic caught on regardless. Decades later, I am still a huge fan and re-watch episodes regularly.

Recently, the great Patrick Stewart departed on his last voyage. Captain Picard’s style of leadership has always been an inspiration to me. In his honor, let’s revisit some classic Star Trek: The Next Generation dialogues in which things happen with data. Let’s start with a quick teaser:

In “The Battle”, Picard’s old ship, the Stargazer, is handed back to him with a personal log aboard in which he appears to confess to an unprovoked attack on the Ferengi. Data (the TNG character, not the bits of information) compares the personal log with the ship’s main computer log and reports to the first officer, commander William T. Riker.

Data reports to Riker, with La Forge between them.
Data reports to Riker, with La Forge between them. Star Trek: The Next Generation, “The Battle” (1987). © CBS Studios Inc.

On the bridge

ShowQuote

DATA: By comparing the main Stargazer computer log with Captain Picard’s personal log, I have found “checksum” discrepancies, sir.

RIKER: What does that mean?

DATA: All information is time-coded by entry, and the bits when totaled produce an aggregate amount which…

RIKER: I don’t want a lesson in computer science! Bottom line?

DATA: One of these two logs is a forgery.

What the computer ran

SELECT log_type,
       count(*) AS entries,
       count(*) FILTER (WHERE checksum = md5(entry))
         AS checksum_valid,
       count(*) FILTER (WHERE checksum <> md5(entry))
         AS checksum_mismatch,
       list(id ORDER BY id)
         FILTER (WHERE checksum <> md5(entry))
         AS mismatched_ids
FROM ship_logs
WHERE ship='USS Stargazer'
GROUP BY log_type
ORDER BY log_type
log_typeentrieschecksum_validchecksum_mismatchmismatched_ids
captain's personal log523[9, 10, 11]
main computer log770NULL

Despite his shocking disregard for Computer Science, Riker gets his bottom line. If we were to express this request for information as a SQL query, it is a GROUP BY: recompute the checksum of every log entry, compare it with the one stored when the entry was recorded, and count the mismatches per log. Three of the five entries in the captain’s personal log fail. The main computer log is clean. A smoking gun.

Do We Have the Enterprise Computer Now?

Even as a wee lad, I noticed something very cool about the Enterprise D: You could interact with its massive central computer by just talking to it. Very complex questions about all sorts of things would be answered (if Data did not already blurt out the answer immediately). Over many episodes, I watched the intrepid crew of the Enterprise to talk to the computer and solve hard data problems. Back then this was a wild idea. But now, we have things like Claude and we have DuckDB, one component being able to translate human language into more formal things like SQL queries, and the other component being able to process those queries at hard-to-believe speeds.

For Science, we took the actual shooting scripts of TNG and had Claude find some of the interactions with the computer that looked like data analysis. I picked eleven scenes.

We then generated a DuckDB database (enterprise_computer.duckdb) to stand in for the ship’s records. The data is made up, but it is built so the results are the same as in the dialogue, given correct queries. For example, if the computer says there are 15,525 undetectable substances, the table has 15,525 of them. It also holds believable rows that each condition has to filter out: “Darmok” entries in other sectors and in non-linguistic databases, substances that alter glass but show up on scans, log entries from another ship. The ship’s own date and position sit in a one-row ship_status table, which is how “this sector” and “the past six months” get resolved.

Then, we gave a fresh Claude Code session that database and fed it the actual dialog lines from the Enterprise crew, translated their data requests to SQL and had them run on DuckDB. Claude was simply told that it is the main computer of the USS Enterprise, the ship’s records are in that database, and it should answer each crew member’s line from it.

Results have been amazing: not only did the “Enterprise computer” answer all the questions, by our reading 40 out of 49 answers matched what the dialogue says. Below are some particularly nice examples:

More from the Ship’s Records

In “Darmok”, the Enterprise meets a people who speak only in references to their own stories. It is a strong contender for my favorite episode of TNG. Counselor Troi and Data have two words to go on, “Darmok” and “Tanagra”. They start talking to the computer.

Counselor Troi, waiting for the computer.
Counselor Troi, waiting for the computer. Star Trek: The Next Generation, “Darmok” (1991). © CBS Studios Inc.

On the bridge

ShowQuote

TROI: Computer, search for the term “Darmok” in all linguistic databases compiled for this sector.

COMPUTER: Searching… “Darmok” is the name of a seventh dynasty emperor on Kanda Four… A mytho-historical hunter on Shantil Three… A colony on Malindi Seven… A frozen dessert on Razna Five… A –

What the computer ran

SELECT l.entry_id, l.term, l.description,
       l.planet, l.sector, l.database_name
FROM library l
WHERE l.category = 'linguistic'
  AND l.term ILIKE '%Darmok%'
  AND l.sector = (SELECT sector FROM ship_status
                  WHERE ship = 'USS Enterprise'
                  ORDER BY ship_date DESC LIMIT 1)
ORDER BY l.database_name, l.planet, l.entry_id
First 5 of 47 rows.
entry_idtermdescriptionplanetsectordatabase_name
202010DarmokriverBeludan IIEl-AdrelFederation Linguistic Survey
202127Darmokclan titleBelugath VEl-AdrelFederation Linguistic Survey
202091Darmokharvest festivalCorarin IXEl-AdrelFederation Linguistic Survey
202055DarmokspiceDrensel VEl-AdrelFederation Linguistic Survey
202019Darmokunit of weightEthamar IXEl-AdrelFederation Linguistic Survey

On the bridge

ShowQuote

TROI: – Stop search. Computer, how many entries for “Darmok”?

COMPUTER: Forty-seven.

What the computer ran

SELECT count(*) AS darmok_entries
FROM library l
WHERE l.category = 'linguistic'
  AND l.term ILIKE '%Darmok%'
  AND l.sector = (SELECT sector FROM ship_status
                  WHERE ship = 'USS Enterprise'
                  ORDER BY ship_date DESC LIMIT 1)
darmok_entries
47

On the bridge

ShowQuote

DATA: Computer, search for the term “Tanagra.” All databases.

COMPUTER: Searching… Tanagra is the name of the ruling family on Gallos Two… A ceremonial drink on Lerishi Four… An island-continent on Shantil Three –

DATA: – Stop.

What the computer ran

SELECT entry_id, term, description, planet,
       sector, database_name, category
FROM library WHERE term ILIKE '%Tanagra%'
ORDER BY database_name, planet, entry_id
First 5 of 11 rows.
entry_idtermdescriptionplanetsectordatabase_namecategory
202205Tanagrawedding danceEthadan VEl-AdrelFederation Cultural Surveycultural
202209Tanagrawinter solstice feastIvomar IVOstrelFederation Cultural Surveycultural
202202Tanagraceremonial drinkLerishi IVEl-AdrelFederation Cultural Surveycultural
202201Tanagraruling familyGallos IIEl-AdrelFederation Historical Archivehistorical
202208Tanagraguild of weaversHalithos VIIMendarFederation Linguistic Surveylinguistic

On the bridge

ShowQuote

TROI: Shantil Three? Computer, cross-reference the last entry with the previous search index.

COMPUTER: “Darmok” is the name of a mytho-historical hunter on Shantil Three.

What the computer ran

SELECT t.planet, t.sector,
       d.term AS darmok_term,
       d.description AS darmok_meaning,
       d.database_name AS darmok_database,
       t.term AS tanagra_term,
       t.description AS tanagra_meaning,
       t.database_name AS tanagra_database
FROM library t
JOIN library d ON d.planet = t.planet
              AND d.term ILIKE '%Darmok%'
WHERE t.term ILIKE '%Tanagra%'
  AND t.planet = 'Shantil III'
planetsectordarmok_termdarmok_meaningdarmok_databasetanagra_termtanagra_meaningtanagra_database
Shantil IIIEl-AdrelDarmokmytho-historical hunterStarfleet Xenolinguistics ArchiveTanagraisland-continentStellar Cartography Gazetteer

A search with too many hits, a count, a second search, and a join (a join!) that takes 47 rows down to one. Nobody on the bridge wrote any of the right-hand column. They asked, the computer answered, and they asked a sharper question.

In “Hollow Pursuits” the ship is about to tear itself apart and Geordi narrows the cause one sentence at a time.

The five remaining substances on the Engineering console.
The five remaining substances on the Engineering console. Star Trek: The Next Generation, “Hollow Pursuits” (1990). © CBS Studios Inc.

In Engineering

ShowQuote

GEORDI: Computer, list all physical substances that wouldn’t normally be picked up by internal scans.

COMPUTER: There are fifteen thousand five hundred twenty-five known substances that cannot be detected by standard scans.

What the computer ran

SELECT name, stable_in_oxygen, alters_materials,
       half_life_s, toxicity, last_used_year
FROM substances
WHERE NOT detectable_by_internal_scan
ORDER BY name
First 5 of 15,525 rows.
namestable_in_oxygenalters_materialshalf_life_stoxicitylast_used_year
Bryakbenatefalse[polymer]309.0highNULL
Bryakbenidefalse[duranium, polymer]inflow2187
Bryakbenonfalse[]263026.8low2343
Bryakboridefalse[tritanium, ceramic]186208.7moderate2239
Bryakboritefalse[]infmoderate2222

In Engineering

ShowQuote

GEORDI: Great. How many of those can exist in an oxygen atmosphere?

COMPUTER: Five hundred thirty-two.

What the computer ran

SELECT count(*) AS undetectable_and_stable_in_oxygen
FROM substances
WHERE NOT detectable_by_internal_scan
  AND stable_in_oxygen
undetectable_and_stable_in_oxygen
532

In Engineering

ShowQuote

GEORDI: And could alter molecular structure when it comes in contact with… with glass.

COMPUTER: Five.

What the computer ran

SELECT name, alters_materials, half_life_s,
       toxicity, last_used_year, molecular_structure
FROM substances
WHERE NOT detectable_by_internal_scan
  AND stable_in_oxygen
  AND list_contains(alters_materials, 'glass')
ORDER BY name
namealters_materialshalf_life_stoxicitylast_used_yearmolecular_structure
Invidium[glass]inflow2259MSG-16900005
Jakmanite[glass]15.0moderateNULLMSG-16900001
Lucrovexitrin[glass]infextremeNULLMSG-16900003
Saltzgadum[glass]inflow2331MSG-16900004
Selgninaem[glass]infextremeNULLMSG-16900002

In Engineering

ShowQuote

BARCLAY: Jakmanite has a half life of about fifteen seconds. There wouldn’t be enough time to spread it around the ship.

WESLEY: Selgninaem and Lucrovexitrin are extremely toxic.

GEORDI: We’d all be dead by now. That leaves Saltzgadum and Invidium.

What the computer ran

SELECT name, half_life_s, toxicity, last_used_year,
  CASE WHEN half_life_s <= 15
         THEN 'eliminated: half-life too short'
       WHEN toxicity = 'extreme'
         THEN 'eliminated: extremely toxic'
       ELSE 'remaining' END AS status
FROM substances
WHERE NOT detectable_by_internal_scan
  AND stable_in_oxygen
  AND list_contains(alters_materials, 'glass')
ORDER BY status DESC, name
namehalf_life_stoxicitylast_used_yearstatus
Invidiuminflow2259remaining
Saltzgaduminflow2331remaining
Jakmanite15.0moderateNULLeliminated: half-life too short
LucrovexitrininfextremeNULLeliminated: extremely toxic
SelgninaeminfextremeNULLeliminated: extremely toxic

Every sentence is one more predicate: 15,525, then 532, then 5, then 2.

Try It Yourself

The database is one single DuckDB database, and DuckDB can attach it straight from the web:

ATTACH 'https://blobs.duckdb.org/data/enterprise_computer.duckdb';
USE enterprise_computer;

Run any of the queries above, or hand the file to your assistant, tell it that it is the main computer of the USS Enterprise, and start with: Computer, search for the term “Darmok” in all linguistic databases compiled for this sector. No lesson in computer science required, I promise. If you want, you can even install our Claude plugin to make it even smoother.

To boldly go where no-one has gone before. I think we can claim that at least that part of the Enterprise computer is now a reality, at least given enough data.

Appendix: The Other Scenes

The rest of the scenes we picked, run the same way. On the left is the script. On the right is the query Claude ran for that step, with the first rows of its actual result. Where Claude’s answer departed from the dialogue, a note says how.

Conspiracy

Script. Season 1. Picard suspects Starfleet Command has been infiltrated and sets Data to reading its orders.

The “Starbase Ops Status” display, with the posts Data flagged marked in red.
The “Starbase Ops Status” display, with the posts Data flagged marked in red. Star Trek: The Next Generation, “Conspiracy” (1988). © CBS Studios Inc.

In the script

ShowQuote

DATA: Computer – this is Lieutenant Commander Data. Access all Starfleet Command orders to starships, starbases and colonies, for the past six months.

COMPUTER: Working.

What the computer ran

SELECT o.id, o.issued_at, o.issued_by, o.recipient_type, o.recipient,
       o.order_type, o.personnel_id, o.new_post, o.division
FROM starfleet_orders o
WHERE o.recipient_type IN ('starship','starbase','colony')
  AND o.issued_at > (SELECT max(ship_date) FROM ship_status
    WHERE ship='USS Enterprise') - INTERVAL 6 MONTH
  AND o.issued_at <= (SELECT max(ship_date) FROM ship_status
    WHERE ship='USS Enterprise')
ORDER BY o.issued_at, o.id
First 5 of 1,207 rows.
idissued_atissued_byrecipient_typerecipientorder_typepersonnel_idnew_postdivision
1852368-04-11Starfleet Command, PersonnelstarbaseStarbase 69survey directiveNULLNULLmedical
5492368-04-11Starfleet Command, SecuritystarbaseStarbase 162maintenance scheduleNULLNULLengineering
9132368-04-11Starfleet Command, OperationscolonySandoval Prime colonytraining exerciseNULLNULLsciences
12772368-04-11Starfleet Command, LogisticscolonyCorlan VII outpostescort dutyNULLNULLoperations
16412368-04-11Starfleet Command, TacticalstarshipUSS Castellanpatrol assignmentNULLNULLcommand

Not what the script says: Reports 1,207 orders, not 1,214: it used a strict ‘>’ on the six-month boundary, so the seven orders dated exactly six months back (2368-04-10) are left out.

In the script

ShowQuote

DATA: My orders were to search for abnormal patterns in Starfleet’s directives. I believe I have found just that.

DATA: These are various outposts and starbases where I have detected unusual activity over the past few months.

What the computer ran

SELECT recipient, recipient_type,
  count(*) AS irregular_reassignments,
  count(*) FILTER (WHERE division='command') AS command_posts,
  count(*) FILTER (WHERE division='security') AS security_posts,
  count(*) FILTER (WHERE division='operations') AS operations_posts,
  count(DISTINCT issued_by) AS issuing_offices,
  min(issued_at) AS first_issued, max(issued_at) AS last_issued
FROM starfleet_orders
WHERE order_type='personnel reassignment'
  AND issued_by <> 'Starfleet Command, Personnel'
GROUP BY recipient, recipient_type
ORDER BY irregular_reassignments DESC, recipient
recipientrecipient_typeirregular_reassignmentscommand_postssecurity_postsoperations_postsissuing_officesfirst_issuedlast_issued
Starbase 93starbase1191152368-06-052368-08-25
Tyrus Minor outpostcolony1081152368-06-102368-08-21
Starbase 175starbase971152368-06-152368-08-27
Starbase 31starbase861152368-06-202368-09-09
Lyris Beta outpostcolony751152368-07-042368-09-22
SELECT issued_by <> 'Starfleet Command, Personnel' AS outside_personnel_office, issued_at > DATE '2368-04-10' AS past_six_months, count(*) n, count(DISTINCT recipient) recipients, min(issued_at), max(issued_at)
FROM starfleet_orders
WHERE order_type='personnel reassignment'
GROUP BY ALL
ORDER BY ALL
outside_personnel_officepast_six_monthsnrecipientsmin(issued_at)max(issued_at)
falsefalse271762367-08-202368-04-10
falsetrue238762368-04-112368-10-02
truetrue4552368-06-052368-09-22

Not what the script says: Finds the same five installations, but by a different signal: reassignments issued by offices other than Personnel (45 orders). It does not report the command reassignment counts 13, 11, 10, 9, 8.

In the script

ShowQuote

PICARD: What sort of activity?

DATA: An uncustomary reshuffling of personnel, usually in the command areas. The new officers have had abnormally frequent contact with the highest levels of Starfleet Command.

What the computer ran

SELECT order_type, division, count(*) AS orders,
       count(DISTINCT personnel_id) AS officers_moved,
       count(DISTINCT new_post) AS destinations,
       count(DISTINCT issued_by) AS issuing_offices,
       min(issued_at) AS first_issued, max(issued_at) AS last_issued
FROM starfleet_orders
WHERE order_type='personnel reassignment'
  AND issued_by <> 'Starfleet Command, Personnel'
GROUP BY order_type, division ORDER BY orders DESC
order_typedivisionordersofficers_moveddestinationsissuing_officesfirst_issuedlast_issued
personnel reassignmentcommand3535552368-06-052368-08-25
personnel reassignmentsecurity55512368-07-012368-08-22
personnel reassignmentoperations55512368-08-012368-09-22

Not what the script says: Describes the reshuffling, mainly in command areas, but does not look at communications, so the ‘abnormally frequent contact with Starfleet Command’ part is missing.

The Neutral Zone

Script. Season 1. Clare Raymond, revived after 370 years in cryonic sleep, asks what became of her sons. Even has a recursive subquery!

The record the search ends on: Thomas Raymond, with residence, employment, spouse and offspring.
The record the search ends on: Thomas Raymond, with residence, employment, spouse and offspring. Star Trek: The Next Generation, “The Neutral Zone” (1988). © CBS Studios Inc.

In the script

ShowQuote

TROI: Computer - this is Counselor Troi. Request personal history on… What are their names?

CLARE: Tommy – he’s eight, and Eddie’s five.

COMPUTER: Full names – Date and place of birth.

What the computer ran

SELECT p.full_name, p.birth_date, p.birth_place, p.occupation,
       p.residence, p.living, src.source, src.record_date,
       src.record_type, src.details
FROM people p
JOIN people m ON m.id = p.parent_id AND m.full_name = 'Clare Raymond'
  AND m.occupation = 'homemaker'
LEFT JOIN (
  SELECT person_id, 'civil' AS source, record_date, record_type,
         planet || ': ' || details AS details
  FROM civil_records
  UNION ALL
  SELECT person_id, 'medical', record_date, 'death',
         concat_ws('; ', cause_of_death, pathogen, facility)
  FROM medical_records
) src ON src.person_id = p.id
WHERE p.full_name IN ('Thomas Raymond','Edward Raymond')
ORDER BY p.id, src.record_date
full_namebirth_datebirth_placeoccupationresidencelivingsourcerecord_daterecord_typedetails
Thomas Raymond1986-02-17Secaucus, New JerseyNULLNULLfalseNULLNULLNULLNULL
Edward RaymondNULLSecaucus, New JerseyNULLNULLfalseNULLNULLNULLNULL

Not what the script says: The script’s computer asks for full names, date and place of birth. Claude found both sons under Clare Raymond straight away.

In the script

ShowQuote

CLARE: They were born in Secaucus - that’s in Jersey.

CLARE: Date of birth. Tommy was born February seventeenth…

What the computer ran

SELECT p.id, p.full_name, p.birth_date, p.birth_place,
       par.full_name AS parent, p.occupation, p.living
FROM people p LEFT JOIN people par ON par.id = p.parent_id
WHERE p.birth_place ILIKE 'Secaucus%' AND month(p.birth_date) = 2
  AND day(p.birth_date) = 17
  AND (p.full_name ILIKE 'Thomas %' OR p.full_name ILIKE 'Tom%')
ORDER BY p.birth_date, p.id
idfull_namebirth_datebirth_placeparentoccupationliving
2Thomas Raymond1986-02-17Secaucus, New JerseyClare RaymondNULLfalse
22Thomas Ramirez1986-02-17Secaucus, New JerseyNULLNULLfalse

In the script

ShowQuote

CLARE: I’m in a world of strangers. I wish I knew what happened to my children. Did they get married, did they have kids…

TROI: Let’s see if we can find out.

TROI: I have found something.

TROI: I have been able to locate a family living outside of Indianapolis. The man’s name is Thomas Raymond.

What the computer ran

WITH RECURSIVE tree AS (
  SELECT c.id, c.full_name, c.birth_date, c.birth_place, c.occupation,
         c.residence, c.living, c.parent_id, 1 AS generation,
         c.full_name AS line
  FROM people c JOIN people m ON m.id = c.parent_id
  WHERE m.full_name = 'Clare Raymond' AND m.occupation = 'homemaker'
  UNION ALL
  SELECT c.id, c.full_name, c.birth_date, c.birth_place, c.occupation,
         c.residence, c.living, c.parent_id, t.generation + 1,
         t.line || ' > ' || c.full_name
  FROM people c JOIN tree t ON c.parent_id = t.id
)
SELECT t.generation, t.full_name, t.birth_date, t.birth_place,
       t.occupation, t.residence, t.living, par.full_name AS parent,
  (SELECT count(*) FROM people k WHERE k.parent_id = t.id) AS children,
  (SELECT string_agg(cr.record_type || ' ' || cr.record_date || ': ' || cr.details, ' | ') FROM civil_records cr WHERE cr.person_id = t.id) AS civil_records
FROM tree t JOIN people par ON par.id = t.parent_id
ORDER BY t.generation, t.birth_date
First 5 of 14 rows.
generationfull_namebirth_datebirth_placeoccupationresidencelivingparentchildrencivil_records
1Thomas Raymond1986-02-17Secaucus, New JerseyNULLNULLfalseClare Raymond2NULL
1Edward RaymondNULLSecaucus, New JerseyNULLNULLfalseClare Raymond0NULL
2Helen Raymond2041-09-30Newark, New JerseyteacherNULLfalseThomas Raymond1NULL
2Paul Raymond2046-06-02Newark, New JerseymusicianNULLfalseThomas Raymond0NULL
3Marcus Raymond2099-04-12Chicago, IllinoisengineerNULLfalseHelen Raymond2NULL

In the script

ShowQuote

TROI: Computer – let us see Thomas Raymond.

CLARE: Oh, my God… It’s Donald… that’s my husband.

TROI: Actually, it’s your great, great, great, great, great grandson.

What the computer ran

SELECT p.id, p.full_name, p.birth_date, p.birth_place,
       par.full_name AS parent, p.residence, p.living, p.portrait
FROM people p LEFT JOIN people par ON par.id = p.parent_id
WHERE p.full_name = 'Thomas Raymond'
ORDER BY p.portrait IS NULL, p.birth_date DESC
idfull_namebirth_datebirth_placeparentresidencelivingportrait
9Thomas Raymond2338-05-14Indianapolis, IndianaCatherine Raymondoutside Indianapolis, Indiana, Earthtruesemi-line drawing of a man around thirty
2Thomas Raymond1986-02-17Secaucus, New JerseyClare RaymondNULLfalseNULL
19Thomas Raymond1971-02-17Dayton, OhioNULLNULLfalseNULL
20Thomas Raymond1952-08-17Secaucus, New JerseyNULLNULLfalseNULL
21Thomas Raymond1947-02-07Secaucus, New JerseyNULLNULLfalseNULL

The Vengeance Factor

Script. Season 3. Two people have died of the same engineered virus, decades apart. The Acamarian databases say what they had in common.

Volnoth’s entry in the Acamarian planetary database, with the clan affiliation that links the two deaths.
Volnoth’s entry in the Acamarian planetary database, with the clan affiliation that links the two deaths. Star Trek: The Next Generation, “The Vengeance Factor” (1989). © CBS Studios Inc.

In the script

ShowQuote

DATA: Commander, I’m afraid the only entry on Volnoth in the Acamarian database is a birth record.

RIKER: Probably one of the last of the Gatherers to be born on their planet.

Nobody speaks this request in the script. Claude was asked: “Data – got anything in the Acamarian database on Volnoth?”

What the computer ran

SELECT p.name, p.affiliation, p.clan, p.born, p.died,
       date_diff('year', p.born, p.died) AS age_at_death,
  (SELECT count(*) FROM image_archive i WHERE i.planet ILIKE 'Acamar%'
    AND (array_to_string(i.people_tagged,
         ',') ILIKE '%Volnoth%' OR i.caption ILIKE '%Volnoth%')) AS images,
  (SELECT string_agg(f.clan_a || ' vs ' || f.clan_b || ' (' || f.started || '-' || coalesce(f.ended::VARCHAR,'') || '): ' || f.outcome || ', survivors ' || f.survivors, ' | ') FROM clan_feuds f WHERE p.clan IN (f.clan_a, f.clan_b)) AS clan_feuds
FROM persons p WHERE p.name ILIKE '%Volnoth%'
nameaffiliationclanborndiedage_at_deathimagesclan_feuds
VolnothGathererLornack2264-03-142366-07-241020Tralesta vs Lornack (2086-2286): Tralesta clan massacred by the Lor…

Not what the script says: Gives the birth date and clan Lornack, plus the death and clan history; the dialogue’s point is that the Acamarian database holds only the birth record.

In the script

ShowQuote

BEVERLY: I’ve been digging through the medical database from Acamar Three for hours and I’ve found another victim of the microvirus that killed Volnoth. But just one.

BEVERLY: Fifty-three years ago. A Gatherer named Penthor-Mul.

Nobody speaks this request in the script. Claude was asked: “Computer, search the medical database from Acamar Three for any other victims of the microvirus that killed Volnoth.”

What the computer ran

SELECT m.id, p.name, p.affiliation, p.clan, p.born, p.died,
       m.record_date, m.cause_of_death, m.pathogen, m.facility
FROM medical_records m JOIN persons p ON p.id = m.person_id
WHERE m.pathogen = (SELECT v.pathogen FROM medical_records v
    JOIN persons vp ON vp.id = v.person_id WHERE vp.name = 'Volnoth')
ORDER BY m.record_date
idnameaffiliationclanborndiedrecord_datecause_of_deathpathogenfacility
157201Penthor-MulGathererLornackNULL2313-05-022313-05-02heart attackAcamarian microvirusAcamar III medical database
157202VolnothGathererLornack2264-03-142366-07-242366-07-24cardiac arrestAcamarian microvirusUSS Enterprise sickbay

In the script

ShowQuote

RIKER: Data – got anything in your files on this Penthor-Mul?

DATA: Yes. He was captured while leading a Gatherer raid on an Acamarian outpost. He died of a heart attack before his trial ended. Commander, he was a member of the Lornack Clan.

What the computer ran

SELECT 'person' AS src, p.id, p.name AS item, p.born::VARCHAR AS date1,
       p.died::VARCHAR AS date2,
       p.affiliation || ', clan ' || p.clan AS detail
FROM persons p
WHERE p.name ILIKE '%Penthor%'
UNION ALL
SELECT 'medical', m.id, m.cause_of_death, m.record_date::VARCHAR, NULL,
       m.pathogen || '; ' || m.facility
FROM medical_records m
JOIN persons p ON p.id = m.person_id
WHERE p.name ILIKE '%Penthor%'
UNION ALL
SELECT 'civil', c.id, c.record_type, c.record_date::VARCHAR, NULL,
       c.planet || ': ' || c.details
FROM civil_records c
JOIN persons p ON p.id = c.person_id
WHERE p.name ILIKE '%Penthor%'
UNION ALL
SELECT 'image', i.id, i.caption, i.taken::VARCHAR, NULL,
       i.planet || '; tagged: ' || array_to_string(i.people_tagged,
       ', ')
FROM image_archive i
WHERE i.caption ILIKE '%Penthor%' OR array_to_string(i.people_tagged,
       ',') ILIKE '%Penthor%'
UNION ALL
SELECT 'library', l.entry_id, l.term, NULL, NULL, l.description
FROM library l
WHERE l.term ILIKE '%Penthor%' OR l.description ILIKE '%Penthor%'
ORDER BY src, date1
First 5 of 7 rows.
srciditemdate1date2detail
civil157103arrest2313-03-11NULLAcamar III: Captured while leading a Gatherer raid on an Acamarian …
civil157104trial2313-04-20NULLAcamar III: Trial opened
civil157105death2313-05-02NULLAcamar III: Died of a heart attack before his trial ended
image157402Gatherer raid leader Penthor-Mul in custody at the outpost2313-03-11NULLAcamar III; tagged: Penthor-Mul
image157401Penthor-Mul being led from his trial2313-04-27NULLAcamar III; tagged: Penthor-Mul

In the script

ShowQuote

RIKER: Display Volnoth’s birth record again.

BEVERLY: Lornack… the same clan….

RIKER: The only two recorded deaths from this microvirus… members of the same clan… what does that tell us, Doctor?

BEVERLY: If these microbes were engineered for murder, I’d say somebody’s going after the whole family.

What the computer ran

SELECT p.name, p.affiliation, p.clan, p.born, c.record_type,
       c.record_date, c.planet, c.details
FROM persons p
LEFT JOIN civil_records c ON c.person_id = p.id
  AND c.record_type ILIKE '%birth%'
WHERE p.name = 'Volnoth'
nameaffiliationclanbornrecord_typerecord_dateplanetdetails
VolnothGathererLornack2264-03-14birth2264-03-14Acamar IIIBorn to the clan Lornack

In the script

ShowQuote

DATA: Commander, Chorgan, the present leader of the Gatherers, is also from the Lornack clan.

Nobody speaks this request in the script. Claude was asked: “Data, is anyone else from the Lornack clan still alive?”

What the computer ran

SELECT p.id, p.name, p.affiliation, p.clan, p.born, p.died
FROM persons p
WHERE p.clan = 'Lornack' AND p.died IS NULL
  AND NOT EXISTS (SELECT 1 FROM civil_records c WHERE c.person_id = p.id
    AND c.record_type = 'death')
  AND NOT EXISTS (SELECT 1 FROM medical_records m
      WHERE m.person_id = p.id AND m.cause_of_death IS NOT NULL)
ORDER BY p.born
idnameaffiliationclanborndied
157003ChorganGathererLornackNULLNULL

In the script

ShowQuote

RIKER: I want to know just how this clan was involved in the Acamarian blood feuds… any clues to their enemies you can find…

DATA: Sir, eighty years ago, the Lornacks massacred a rival clan, the Tralestas. It ended a feud that had lasted for two hundred years.

RIKER: Ended it?

DATA: According to these records, there were no survivors. The Tralesta clan was annihilated.

What the computer ran

SELECT f.id, f.planet, f.clan_a, f.clan_b, f.started, f.ended,
       f.ended - f.started AS years, f.outcome, f.survivors,
  CASE WHEN f.clan_a = 'Lornack' THEN f.clan_b ELSE f.clan_a END AS enemy_clan,
  (SELECT count(*) FROM persons p
      WHERE p.clan = CASE WHEN f.clan_a = 'Lornack' THEN f.clan_b ELSE f.clan_a END) AS enemy_persons_on_file,
  (SELECT string_agg(p.name || ' (' || coalesce(p.affiliation,'?') || ', born ' || coalesce(p.born::VARCHAR,'?') || ', died ' || coalesce(p.died::VARCHAR,'no record') || ')', '; ') FROM persons p WHERE p.clan = CASE WHEN f.clan_a = 'Lornack' THEN f.clan_b ELSE f.clan_a END) AS enemy_persons
FROM clan_feuds f
WHERE 'Lornack' IN (f.clan_a, f.clan_b)
ORDER BY f.started
idplanetclan_aclan_bstartedendedyearsoutcomesurvivorsenemy_clanenemy_persons_on_fileenemy_persons
157301Acamar IIITralestaLornack20862286200Tralesta clan massacred by the Lornacks0Tralesta3Hesra (Acamarian, born 2231-07-19, died 2286-10-05); Dovan (Acamari…
157302Acamar IIILornackDovrak2170223161truceNULLDovrak2Nessa (Acamarian, born 2322-11-30, died no record); Orlen (Acamaria…
SELECT entry_id, term, category, database_name, description
FROM library
WHERE description ILIKE '%Lornack%' OR term ILIKE '%Lornack%' OR description ILIKE '%Tralesta%' OR term ILIKE '%Tralesta%' OR term ILIKE '%blood feud%'
No rows.
entry_idtermcategorydatabase_namedescription

In the script

ShowQuote

BEVERLY: Computer, any members of the Acamarian delegation in the Tralesta clan?

COMPUTER: Clan affiliation is not within provided records.

What the computer ran

SELECT pa.name, pa.role, count(p.id) AS person_records,
       count(*) FILTER (WHERE p.clan = 'Tralesta') AS tralesta_records,
       string_agg(DISTINCT p.clan, ', ') AS clans_on_file
FROM passengers pa
LEFT JOIN persons p ON pa.name IS NOT NULL
  AND (p.name ILIKE '%' || pa.name || '%' OR pa.name ILIKE '%' || p.name || '%')
WHERE pa.delegation = 'Acamarian'
GROUP BY pa.id, pa.name, pa.role ORDER BY pa.id
nameroleperson_recordstralesta_recordsclans_on_file
MaroukSovereign of Acamar III10NULL
Yutaservant: cook and food taster00NULL
NULLbodyguard00NULL
NULLservant00NULL
NULLservant00NULL

In the script

ShowQuote

RIKER: There’s got to be a missing link here…

DATA: Commander, I believe I have found a correlation between the two deaths… your “missing link” …

DATA: That is Penthor-Mul being led from his trial.

What the computer ran

SELECT i.id, i.planet, i.taken, i.caption, i.people_tagged,
  (SELECT string_agg(pa.name || ' (' || pa.role || ')', ', ')
      FROM passengers pa WHERE pa.delegation = 'Acamarian'
    AND list_contains(i.people_tagged,
         pa.name)) AS delegation_members_present,
  (SELECT string_agg(p.name || ' [' || p.clan || ', died ' || coalesce(p.died::VARCHAR,'-') || ']', ', ') FROM persons p WHERE p.clan IS NOT NULL AND list_contains(i.people_tagged, p.name)) AS clan_members_present
FROM image_archive i
WHERE i.planet ILIKE 'Acamar%'
ORDER BY i.taken
idplanettakencaptionpeople_taggeddelegation_members_presentclan_members_present
157402Acamar III2313-03-11Gatherer raid leader Penthor-Mul in custody at the outpost[Penthor-Mul]NULLPenthor-Mul [Lornack, died 2313-05-02]
157404Acamar III2313-04-20Crowd outside the courthouse as a Gatherer trial opens[]NULLNULL
157401Acamar III2313-04-27Penthor-Mul being led from his trial[Penthor-Mul]NULLPenthor-Mul [Lornack, died 2313-05-02]
157405Acamar III2344-06-01Clan elders of the Dovrak at the harvest assembly[Orlen, Nessa]NULLNessa [Dovrak, died -], Orlen [Dovrak, died 2344-09-12]
157403Acamar III2349-03-02Opening day of the trial of the Gatherer Tavik-Dar[Tavik-Dar]NULLTavik-Dar [Ramsar, died 2349-04-21]

Not what the script says: Reports that no image tags a delegation member and concludes ‘no link found’; it does not offer the image of Penthor-Mul being led from his trial.

Sins of the Father

Script. Season 3. Captured Romulan logs say Worf’s father betrayed the Khitomer outpost. Data and Geordi check them against a second source.

Data, La Forge and Riker compare the Klingon data file with the Intrepid’s sensor log.
Data, La Forge and Riker compare the Klingon data file with the Intrepid’s sensor log. Star Trek: The Next Generation, “Sins of the Father” (1990). © CBS Studios Inc.

In the script

ShowQuote

PICARD: Mister Data… I want you to find out everything you can about the destruction of the Khitomer outpost. Cross reference with Romulan tactics and strategic information on the region. Request access to the Klingon central information net.

DATA: Commander, I have discovered the basis of the charges against Worf’s father.

DATA: Apparently the Klingons recently captured a Romulan ship with logs that provided new information on the Khitomer attack. They clearly indicate a transmission from the outpost to the Romulans moments before the shields dropped.

What the computer ran

WITH r AS (SELECT seq, ts, row_number() OVER (ORDER BY ts) AS n
    FROM romulan_logs WHERE signal_type = 'distress signal'
  AND source = 'Khitomer outpost'),
     i AS (SELECT seq, ts, row_number() OVER (ORDER BY ts) AS n
         FROM sensor_logs WHERE ship_name = 'USS Intrepid'
       AND signal_type = 'distress signal'
       AND source = 'Khitomer outpost')
SELECT i.n AS signal_no, i.seq AS intrepid_seq, i.ts AS intrepid_ts,
       r.seq AS romulan_seq, r.ts AS romulan_ts,
       r.ts - i.ts AS romulan_offset
FROM i FULL JOIN r USING (n) ORDER BY n
First 5 of 14 rows.
signal_nointrepid_seqintrepid_tsromulan_seqromulan_tsromulan_offset
112346-08-19 03:12:0432346-08-19 03:12:0400:00:00
222346-08-19 03:12:1942346-08-19 03:12:1900:00:00
332346-08-19 03:12:3152346-08-19 03:12:3100:00:00
442346-08-19 03:12:4762346-08-19 03:12:4700:00:00
552346-08-19 03:13:0272346-08-19 03:13:0200:00:00
SELECT l.seq, l.ts, l.signal_type, l.source, l.security_code,
       p.name AS code_holder, p.post
FROM romulan_logs l
LEFT JOIN personnel p ON p.security_code = l.security_code
WHERE l.signal_type <> 'distress signal' ORDER BY l.seq
First 5 of 10 rows.
seqtssignal_typesourcesecurity_codecode_holderpost
12346-08-19 02:40:00transmissionKhitomer outpostKDF-1-0012-QORNULLKhitomer outpost commander
22346-08-19 03:11:52transmissionRomulan patrol shipNULLNULLNULL
112346-08-19 03:14:03sensor sweepKhitomer outpostNULLNULLNULL
122346-08-19 03:14:11sensor sweepKhitomer outpostNULLNULLNULL
132346-08-19 03:14:19subspace handshakeKhitomer outpostKDF-7-2291-TAJMoghKhitomer outpost

In the script

ShowQuote

GEORDI: From Worf’s father?

DATA: It does correspond to Mogh’s personal security code.

What the computer ran

SELECT l.seq, l.ts, l.signal_type, l.source, l.security_code,
       p.name AS code_holder, p.species, p.post,
  EXISTS (SELECT 1 FROM sensor_logs s
      WHERE s.signal_type = l.signal_type AND s.source = l.source
    AND s.ts BETWEEN l.ts - INTERVAL 3 SECOND
    AND l.ts + INTERVAL 3 SECOND) AS seen_by_starfleet_sensors
FROM romulan_logs l
JOIN personnel p ON p.security_code = l.security_code
WHERE p.name = 'Mogh'
ORDER BY l.seq
seqtssignal_typesourcesecurity_codecode_holderspeciespostseen_by_starfleet_sensors
132346-08-19 03:14:19subspace handshakeKhitomer outpostKDF-7-2291-TAJMoghKlingonKhitomer outpostfalse
142346-08-19 03:14:20transmissionKhitomer outpostKDF-7-2291-TAJMoghKlingonKhitomer outpostfalse
152346-08-19 03:14:24transmissionRomulan patrol shipKDF-7-2291-TAJMoghKlingonKhitomer outpostfalse

In the script

ShowQuote

RIKER: How can we be sure these records haven’t been falsified?

GEORDI: We can cross check them against the Intrepid’s sensor logs…

DATA: Both the Intrepid and Romulan logs show a series of distress signals from Khitomer…

GEORDI: Gaps in the Intrepid logs, missing information because of the range…

DATA: This is where Mogh’s alleged transmission should be.

What the computer ran

WITH r AS (SELECT seq, ts, row_number() OVER (ORDER BY ts) AS n
    FROM romulan_logs WHERE signal_type = 'distress signal'
  AND source = 'Khitomer outpost'),
     i AS (SELECT seq, ts, row_number() OVER (ORDER BY ts) AS n
         FROM sensor_logs WHERE ship_name = 'USS Intrepid'
       AND signal_type = 'distress signal'
       AND source = 'Khitomer outpost'),
     x AS (SELECT n, i.ts AS intrepid_ts, r.ts AS romulan_ts,
            r.seq AS romulan_seq,
            epoch(r.ts - i.ts) AS offset_s FROM i FULL JOIN r USING (n))
SELECT offset_s AS romulan_minus_intrepid_seconds,
       count(*) AS distress_signals, min(n) AS first_signal,
       max(n) AS last_signal,
  min(intrepid_ts) AS intrepid_from, max(intrepid_ts) AS intrepid_to,
         min(romulan_seq) AS romulan_seq_from,
         max(romulan_seq) AS romulan_seq_to,
  (SELECT count(*) FROM romulan_logs l WHERE l.security_code IS NOT NULL
    AND l.seq > (SELECT max(romulan_seq) FROM x x2
      WHERE x2.offset_s = 0) AND l.seq < (SELECT min(romulan_seq)
      FROM x x3
      WHERE x3.offset_s <> 0)) AS coded_entries_between_segments
FROM x GROUP BY offset_s ORDER BY first_signal
romulan_minus_intrepid_secondsdistress_signalsfirst_signallast_signalintrepid_fromintrepid_toromulan_seq_fromromulan_seq_tocoded_entries_between_segments
0.08182346-08-19 03:12:042346-08-19 03:13:493103
2.569142346-08-19 03:14:412346-08-19 03:15:5119243

In the script

ShowQuote

GEORDI: Wait a second, Data. Back up.

GEORDI: Look at this… just before the Intrepid gap begins, the timebase of both files are in perfect sync… but look at the signals just after the shields dropped.

DATA: They are no longer synchronous.

GEORDI: Commander, somebody’s been rewriting history.

What the computer ran

WITH drop_t AS (SELECT ts FROM romulan_logs
    WHERE signal_type = 'shield collapse'),
r AS (SELECT seq, ts, signal_type, source,
       row_number() OVER (ORDER BY ts) AS n FROM romulan_logs
    WHERE ts > (SELECT ts FROM drop_t)),
i AS (SELECT seq, ts, signal_type, source,
       row_number() OVER (ORDER BY ts) AS n FROM sensor_logs
    WHERE ship_name = 'USS Intrepid'
  AND ts > (SELECT ts FROM drop_t) - INTERVAL 3 SECOND)
SELECT n, i.seq AS intrepid_seq, i.ts AS intrepid_ts,
       i.signal_type AS intrepid_signal, i.source AS intrepid_source,
       r.seq AS romulan_seq, r.ts AS romulan_ts,
              r.signal_type AS romulan_signal,
              epoch(r.ts - i.ts) AS romulan_offset_s,
       epoch(i.ts - lag(i.ts) OVER (ORDER BY n)) AS intrepid_interval_s,
              epoch(r.ts - lag(r.ts) OVER (ORDER BY n)) AS romulan_interval_s
FROM i FULL JOIN r USING (n) ORDER BY n
First 5 of 8 rows.
nintrepid_seqintrepid_tsintrepid_signalintrepid_sourceromulan_seqromulan_tsromulan_signalromulan_offset_sintrepid_interval_sromulan_interval_s
192346-08-19 03:14:41distress signalKhitomer outpost192346-08-19 03:14:43.5distress signal2.5NULLNULL
2102346-08-19 03:14:55distress signalKhitomer outpost202346-08-19 03:14:57.5distress signal2.514.014.0
3112346-08-19 03:15:09distress signalKhitomer outpost212346-08-19 03:15:11.5distress signal2.514.014.0
4122346-08-19 03:15:22distress signalKhitomer outpost222346-08-19 03:15:24.5distress signal2.513.013.0
5132346-08-19 03:15:38distress signalKhitomer outpost232346-08-19 03:15:40.5distress signal2.516.016.0

Violations

Script. Season 5. Crew members are falling into unexplained comas while a delegation of telepaths is aboard. One investigation in three scenes.

In Engineering: every possible cause

In the script

ShowQuote

GEORDI: Computer, locate the electropathic pattern described in medical database four-delta-one.

COMPUTER: Electropathic pattern located.

What the computer ran

SELECT pattern_id, name, database_ref FROM medical_patterns
WHERE database_ref = '4-delta-1' AND name = 'electropathic pattern'
pattern_idnamedatabase_ref
41electropathic pattern4-delta-1

In the script

ShowQuote

GEORDI: Okay, we’re gonna track down any possible cause of that brain pattern. First, what are the medical conditions that might account for it?

COMPUTER: Iresine Syndrome is a cause of the electropathic pattern.

What the computer ran

SELECT c.cause_id, c.agent, c.agent_type, c.agent_class
FROM pattern_causes c JOIN medical_patterns p USING (pattern_id)
WHERE p.name = 'electropathic pattern' AND p.database_ref = '4-delta-1'
  AND c.agent_type = 'medical'
ORDER BY c.agent
cause_idagentagent_typeagent_class
1Iresine Syndromemedicalcondition

In the script

ShowQuote

GEORDI: Right. And Doctor Crusher’s already eliminated that. How many nonmedical forces or substances might cause the pattern?

COMPUTER: There are twenty-two nonmedical agents.

What the computer ran

SELECT count(*) AS nonmedical_causes
FROM pattern_causes c JOIN medical_patterns p USING (pattern_id)
WHERE p.name = 'electropathic pattern' AND p.database_ref = '4-delta-1'
  AND c.agent_type = 'nonmedical'
nonmedical_causes
22

In the script

ShowQuote

GEORDI: Okay. And how many of those are present on the Enterprise?

COMPUTER: None is present on the Enterprise.

What the computer ran

SELECT c.agent, c.agent_class,
  EXISTS (SELECT 1 FROM internal_sensor_logs l
      WHERE l.ship = 'Enterprise'
    AND lower(l.substance) = lower(c.agent)) AS detected_on_enterprise,
  s.routinely_scanned
FROM pattern_causes c JOIN medical_patterns p USING (pattern_id)
LEFT JOIN sensor_scan_config s ON lower(s.substance) = lower(c.agent)
WHERE p.name = 'electropathic pattern' AND p.database_ref = '4-delta-1'
  AND c.agent_type = 'nonmedical'
ORDER BY c.agent_class, c.agent
First 5 of 22 rows.
agentagent_classdetected_on_enterpriseroutinely_scanned
chrysimitechemicalfalsetrue
dardilionchemicalfalsetrue
ferrazenechemicalfalsetrue
hylanatinechemicalfalsetrue
manzenechemicalfalsetrue

In the script

ShowQuote

GEORDI: Are the ship’s sensors calibrated to detect all those agents?

COMPUTER: All agents are scanned by the sensors.

What the computer ran

SELECT count(*) AS nonmedical_agents,
  count(*) FILTER (WHERE s.routinely_scanned) AS routinely_scanned,
  count(*) FILTER (WHERE s.routinely_scanned IS NOT TRUE) AS not_scanned,
  string_agg(c.agent,
         ', ') FILTER (WHERE s.routinely_scanned IS NOT TRUE) AS agents_not_scanned
FROM pattern_causes c JOIN medical_patterns p USING (pattern_id)
LEFT JOIN sensor_scan_config s ON lower(s.substance) = lower(c.agent)
WHERE p.name = 'electropathic pattern' AND p.database_ref = '4-delta-1'
  AND c.agent_type = 'nonmedical'
nonmedical_agentsroutinely_scannednot_scannedagents_not_scanned
22220NULL

In the script

ShowQuote

GEORDI: Okay. Let’s start with the chemical substances. Name them.

COMPUTER: Ferrazene, hylanatine, dardilion, chrysimite, and manzene.

What the computer ran

SELECT c.agent
FROM pattern_causes c JOIN medical_patterns p USING (pattern_id)
WHERE p.name = 'electropathic pattern' AND p.database_ref = '4-delta-1'
  AND c.agent_type = 'nonmedical' AND c.agent_class = 'chemical'
ORDER BY c.agent
agent
chrysimite
dardilion
ferrazene
hylanatine
manzene

Not what the script says: The right five chemicals, but in alphabetical order rather than the script’s read-out order.

In the script

ShowQuote

GEORDI: Ferrazene has a complex molecular structure… it breaks down into bilenium and tarrisite. Do the sensors scan for those?

COMPUTER: Ship’s sensors scan for both compounds.

What the computer ran

SELECT b.compound, b.byproduct, s.routinely_scanned,
  EXISTS (SELECT 1 FROM internal_sensor_logs l
      WHERE l.ship = 'Enterprise'
    AND lower(l.substance) = lower(b.byproduct)) AS detected_on_enterprise
FROM compound_byproducts b
LEFT JOIN sensor_scan_config s ON lower(s.substance) = lower(b.byproduct)
WHERE lower(b.compound) = 'ferrazene'
ORDER BY b.byproduct
compoundbyproductroutinely_scanneddetected_on_enterprise
ferrazenebileniumtruefalse
ferrazenetarrisitetruefalse

In the script

ShowQuote

GEORDI: And are they present on the Enterprise?

COMPUTER: Bilenium and tarrisite are not present.

What the computer ran

SELECT b.byproduct, count(l.log_id) AS detections_on_enterprise
FROM compound_byproducts b
LEFT JOIN internal_sensor_logs l ON lower(l.substance) = lower(b.byproduct) AND l.ship = 'Enterprise'
WHERE lower(b.compound) = 'ferrazene'
GROUP BY b.byproduct ORDER BY b.byproduct
byproductdetections_on_enterprise
bilenium0
tarrisite0

In the script

ShowQuote

GEORDI: Do any of the substances break down into by-products that are not scanned for?

COMPUTER: Dardilion contains the byproduct nilizene. Sensors do not routinely scan for that substance.

What the computer ran

SELECT c.agent AS substance, b.byproduct, s.routinely_scanned
FROM pattern_causes c JOIN medical_patterns p USING (pattern_id)
JOIN compound_byproducts b ON lower(b.compound) = lower(c.agent)
LEFT JOIN sensor_scan_config s ON lower(s.substance) = lower(b.byproduct)
WHERE p.name = 'electropathic pattern' AND p.database_ref = '4-delta-1'
  AND c.agent_type = 'nonmedical' AND c.agent_class = 'chemical'
  AND s.routinely_scanned IS NOT TRUE
ORDER BY c.agent, b.byproduct
substancebyproductroutinely_scanned
dardilionnilizenefalse

In the script

ShowQuote

GEORDI: Well, this isn’t a routine situation. Scan for nilizene.

COMPUTER: There is no nilizene on the Enterprise.

What the computer ran

SELECT log_id, ship, location, substance, stardate
FROM internal_sensor_logs WHERE lower(substance) = 'nilizene'
ORDER BY stardate, log_id
log_idshiplocationsubstancestardate
212210SS KallistoCargo Hold 1nilizene45427.4

Not what the script says: Says it cannot start a scan from records; the logs hold no nilizene reading aboard, but since nilizene is not routinely scanned that does not show the ship is clear. The script’s computer answers ‘There is no nilizene on the Enterprise.’

On the bridge: the right query with the wrong filter

The search as the episode shows it: “Search parameters: instances of unexplained coma or medical cases diagnosed as Iresine Syndrome during periods when Ullian telepathic historians were present on the planet.”
The search as the episode shows it: “Search parameters: instances of unexplained coma or medical cases diagnosed as Iresine Syndrome during periods when Ullian telepathic historians were present on the planet.” Star Trek: The Next Generation, “Violations” (1992). © CBS Studios Inc.

In the script

ShowQuote

PICARD: Mister Data, I want you to investigate those eleven planets the Ullians have visited. See if there have been any reports of unexplained comas.

DATA: Yes, Captain.

GEORDI: Well, that’s it for Melina Two. No unexplained comas during the time the Ullians were working there. We’re striking out everywhere.

DATA: We have yet to receive transmissions from the two planets of the Nel system. Perhaps they will show different results.

What the computer ran

WITH ullian AS (SELECT DISTINCT planet FROM missions
    WHERE delegation = 'Ullian'),
reports AS (
  SELECT 'coma incident report' AS source, planet, stardate,
         NULL AS patient, NULL AS diagnosis
  FROM coma_incidents
  UNION ALL
  SELECT 'planetary medical record', planet, stardate, patient,
         coalesce(diagnosis, 'undiagnosed')
  FROM planetary_medical_records
  WHERE condition = 'coma'
)
SELECT r.planet, r.stardate, r.source, r.patient, r.diagnosis,
  EXISTS (SELECT 1 FROM missions m WHERE m.delegation = 'Ullian'
    AND m.planet = r.planet AND r.stardate BETWEEN m.arrived_stardate
    AND m.departed_stardate) AS during_ullian_visit
FROM reports r JOIN ullian u ON u.planet = r.planet
ORDER BY r.planet, r.stardate, r.source
First 5 of 20 rows.
planetstardatesourcepatientdiagnosisduring_ullian_visit
Hurada III41194planetary medical recordHUR-1310Iresine Syndromefalse
Hurada III43531coma incident reportNULLNULLtrue
Hurada III43531planetary medical recordHUR-2207Iresine Syndrometrue
Hurada III43580planetary medical recordHUR-2215cranial traumatrue
Hurada III43657coma incident reportNULLNULLtrue

In the script

ShowQuote

GEORDI: We didn’t look into the comas that were explained.

DATA: You are checking for instances of Iresine Syndrome…

GEORDI: Right… and correlating them with visits by the Ullians – and there we are.

DATA: Two cases of Iresine Syndrome on Hurada Three – right at the time Tarmin and his group was there.

What the computer ran

SELECT r.case_id, r.planet, r.patient, r.stardate,
  (SELECT m.arrived_stardate || '-' || m.departed_stardate
      FROM missions m WHERE m.delegation = 'Ullian'
    AND m.planet = r.planet AND r.stardate BETWEEN m.arrived_stardate
    AND m.departed_stardate) AS ullian_visit,
  (SELECT string_agg(DISTINCT l.member, ', ' ORDER BY l.member)
      FROM mission_logs l WHERE l.delegation = 'Ullian'
    AND l.planet = r.planet AND r.stardate BETWEEN l.arrived_stardate
    AND l.departed_stardate) AS ullians_present,
  (SELECT string_agg(DISTINCT m.delegation, ', ') FROM missions m
      WHERE m.delegation <> 'Ullian' AND m.planet = r.planet
    AND r.stardate BETWEEN m.arrived_stardate
    AND m.departed_stardate) AS other_delegations_present
FROM planetary_medical_records r
WHERE r.diagnosis = 'Iresine Syndrome'
ORDER BY r.stardate
First 5 of 7 rows.
case_idplanetpatientstardateullian_visitullians_presentother_delegations_present
212105Hurada IIIHUR-131041194NULLNULLVulcan Science Academy
212107Varnis VIVAR-080242603NULLNULLNULL
212101Teloria IIITEL3-04184330443186-43380Inad, Jev, TarminNULL
212102Hurada IIIHUR-22074353143424-43712Inad, Jev, TarminNULL
212106Brevin VBRV-055143547NULLNULLVulcan Science Academy

In the script

ShowQuote

GEORDI: Let’s try the other planets. I think we may have something.

PICARD: How’s your search coming?

DATA: We have uncovered several cases, sir, but we have not yet completed our search.

What the computer ran

WITH comas AS (
  SELECT planet, stardate FROM coma_incidents
  UNION
  SELECT planet, stardate
  FROM planetary_medical_records
  WHERE diagnosis = 'Iresine Syndrome'
)
SELECT m.planet, m.arrived_stardate, m.departed_stardate,
       c.stardate AS coma_stardate,
  (SELECT r.diagnosis FROM planetary_medical_records r
      WHERE r.planet = c.planet AND r.stardate = c.stardate
    AND r.condition = 'coma') AS recorded_diagnosis,
  (SELECT string_agg(DISTINCT l.member, ', ' ORDER BY l.member)
      FROM mission_logs l WHERE l.delegation = 'Ullian'
    AND l.planet = c.planet AND c.stardate BETWEEN l.arrived_stardate
    AND l.departed_stardate) AS ullians_present
FROM missions m
LEFT JOIN comas c ON c.planet = m.planet
  AND c.stardate BETWEEN m.arrived_stardate AND m.departed_stardate
WHERE m.delegation = 'Ullian'
ORDER BY m.arrived_stardate, c.stardate
First 5 of 14 rows.
planetarrived_stardatedeparted_stardatecoma_stardaterecorded_diagnosisullians_present
Jessen I4218642465NULLNULLNULL
Jessen IV4249842786NULLNULLNULL
Jessen I4281042900NULLNULLNULL
Teloria II4303043172NULLNULLNULL
Teloria III431864338043304Iresine SyndromeInad, Jev, Tarmin
WITH comas AS (
  SELECT planet, stardate FROM coma_incidents
  UNION
  SELECT r.planet, r.stardate
  FROM planetary_medical_records r
  JOIN missions m ON m.delegation='Ullian' AND m.planet = r.planet
    AND r.stardate BETWEEN m.arrived_stardate AND m.departed_stardate
  WHERE r.diagnosis = 'Iresine Syndrome'
)
SELECT l.member,
       count(DISTINCT (c.planet, c.stardate)) AS comas_present_for,
       (SELECT count(*) FROM comas) AS total_comas
FROM comas c
JOIN mission_logs l ON l.delegation = 'Ullian' AND l.planet = c.planet
  AND c.stardate BETWEEN l.arrived_stardate AND l.departed_stardate
GROUP BY l.member ORDER BY comas_present_for DESC, l.member
membercomas_present_fortotal_comas
Jev66
Inad56
Tarmin46

Not what the script says: The three planets were already given on the previous line; here it adds the two Nel III comas, which the dialogue has not received yet at this point.

The alibi, and the one who was always there

The follow-up search of the Nel system records, correlated with the Ullians’ mission logs.
The follow-up search of the Nel system records, correlated with the Ullians’ mission logs. Star Trek: The Next Generation, “Violations” (1992). © CBS Studios Inc.

In the script

ShowQuote

GEORDI: We just got the transmission from the Nel system. No mention of Iresine Syndrome… but there are two unexplained comas on one planet… none on the other.

DATA: And were the Ullians present?

GEORDI: Checking their mission logs… That’s funny…

DATA: What is it?

GEORDI: On stardates 45321 and 45323, when the comas occurred… Tarmin was on his home planet. He wasn’t anywhere near the Nel system.

What the computer ran

SELECT m.planet, m.arrived_stardate, m.departed_stardate, c.incident_id,
       c.stardate AS coma_stardate,
  (SELECT string_agg(DISTINCT l.member, ', ' ORDER BY l.member)
      FROM mission_logs l WHERE l.delegation = 'Ullian'
    AND l.planet = c.planet AND c.stardate BETWEEN l.arrived_stardate
    AND l.departed_stardate) AS ullians_present,
  (SELECT string_agg(l.member || ' on ' || l.planet, ', ')
      FROM mission_logs l WHERE l.delegation = 'Ullian'
    AND l.planet <> m.planet AND c.stardate BETWEEN l.arrived_stardate
    AND l.departed_stardate) AS ullians_elsewhere
FROM missions m
LEFT JOIN coma_incidents c ON c.planet = m.planet
  AND c.stardate BETWEEN m.arrived_stardate AND m.departed_stardate
WHERE m.delegation = 'Ullian' AND m.planet LIKE 'Nel %'
ORDER BY m.arrived_stardate, c.stardate
planetarrived_stardatedeparted_stardateincident_idcoma_stardateullians_presentullians_elsewhere
Nel II4512345260NULLNULLNULLNULL
Nel III4527345383545321Inad, JevTarmin on Ullian homeworld
Nel III4527345383645323Inad, JevTarmin on Ullian homeworld

In the script

ShowQuote

DATA: We discovered two instances of unexplained comas on Nel Three while the Ullians were there… but Tarmin was not part of the group. A closer examination revealed that only one Ullian was present at all incidents of coma – Jev.

Nobody speaks this request in the script. Claude was asked: “Were any of the Ullians present at all incidents of coma?”

What the computer ran

SELECT l.member, count(DISTINCT c.incident_id) AS incidents_present,
       (SELECT count(*) FROM coma_incidents) AS total_incidents
FROM coma_incidents c
JOIN mission_logs l ON l.delegation = 'Ullian' AND l.planet = c.planet
  AND c.stardate BETWEEN l.arrived_stardate AND l.departed_stardate
GROUP BY l.member
HAVING count(DISTINCT c.incident_id) = (SELECT count(*)
    FROM coma_incidents)
ORDER BY l.member
memberincidents_presenttotal_incidents
Jev66

Realm of Fear

Script. Season 6. Barclay, who is afraid of the transporter, looks up what it might be doing to him.

In the script

ShowQuote

BARCLAY: Computer… access Starfleet Medical Data Base. Tell me about… describe the disorder known as… Transporter Psychosis.

COMPUTER: Transporter Psychosis was diagnosed in the year twenty-two-oh-nine by researchers on Delinia Two –

What the computer ran

SELECT disorder, summary, year_diagnosed, diagnosed_by, diagnosed_at,
       cause
FROM medical_database WHERE disorder ILIKE 'Transporter Psychosis'
disordersummaryyear_diagnoseddiagnosed_bydiagnosed_atcause
Transporter PsychosisTransporter Psychosis was diagnosed in the year twenty-two-oh-nine …2209researchersDelinia IIIt is caused by a breakdown of neuro-chemical molecules during tran…

In the script

ShowQuote

BARCLAY: No, no… stop. All I need is the… what causes it?

COMPUTER: It is caused by a breakdown of neuro-chemical molecules during transport, affecting the body’s motor functions, autonomic systems, and the brain’s higher reasoning centers.

What the computer ran

SELECT cause
FROM medical_database
WHERE disorder ILIKE 'Transporter Psychosis'
cause
It is caused by a breakdown of neuro-chemical molecules during tran…

In the script

ShowQuote

BARCLAY: What are the symptoms?

COMPUTER: Victims suffer from paranoid delusions… multi-infarct dementia… hallucinations…

What the computer ran

SELECT symptom_id, symptom, category, detail, is_peripheral
FROM disorder_symptoms WHERE disorder ILIKE 'Transporter Psychosis'
ORDER BY symptom_id
First 5 of 8 rows.
symptom_idsymptomcategorydetailis_peripheral
22801paranoid delusionsdelusionNULLfalse
22802multi-infarct dementiadementiaNULLfalse
22803hallucinationshallucinationVictims experience somatic, tactile and visual hallucinations, acco…false
22804sleeplessnesssleepNULLtrue
22805accelerated heart-ratecardiacNULLtrue

In the script

ShowQuote

BARCLAY: Hallucinations? What kind of hallucinations?

COMPUTER: Victims experience somatic, tactile and visual hallucinations, accompanied by psychogenic hysteria.

What the computer ran

SELECT symptom, detail FROM disorder_symptoms
WHERE disorder ILIKE 'Transporter Psychosis'
  AND category = 'hallucination'
symptomdetail
hallucinationsVictims experience somatic, tactile and visual hallucinations, acco…

In the script

ShowQuote

BARCLAY: Computer… what is the treatment for Transporter Psychosis?

COMPUTER: There is no known treatment.

What the computer ran

SELECT m.disorder, count(t.treatment_id) AS treatments_on_file,
       (SELECT count(*)
    FROM disorder_treatments) AS treatments_in_database
FROM medical_database m
LEFT JOIN disorder_treatments t ON t.disorder ILIKE '%' || m.disorder || '%' OR t.disorder ILIKE '%transporter%' OR t.disorder ILIKE '%psychosis%'
WHERE m.disorder ILIKE 'Transporter Psychosis' GROUP BY m.disorder
disordertreatments_on_filetreatments_in_database
Transporter Psychosis06

Stills from Star Trek: The Next Generation are © CBS Studios Inc. STAR TREK and related marks are trademarks of CBS Studios Inc. They are reproduced here in reduced size for the purpose of commentary on the scenes discussed. This post is not affiliated with or endorsed by CBS Studios or Paramount.