I Don’t Want a Lesson in Computer Science!
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.

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_type | entries | checksum_valid | checksum_mismatch | mismatched_ids |
|---|---|---|---|---|
| captain's personal log | 5 | 2 | 3 | [9, 10, 11] |
| main computer log | 7 | 7 | 0 | NULL |
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.

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
| entry_id | term | description | planet | sector | database_name |
|---|---|---|---|---|---|
| 202010 | Darmok | river | Beludan II | El-Adrel | Federation Linguistic Survey |
| 202127 | Darmok | clan title | Belugath V | El-Adrel | Federation Linguistic Survey |
| 202091 | Darmok | harvest festival | Corarin IX | El-Adrel | Federation Linguistic Survey |
| 202055 | Darmok | spice | Drensel V | El-Adrel | Federation Linguistic Survey |
| 202019 | Darmok | unit of weight | Ethamar IX | El-Adrel | Federation 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
| entry_id | term | description | planet | sector | database_name | category |
|---|---|---|---|---|---|---|
| 202205 | Tanagra | wedding dance | Ethadan V | El-Adrel | Federation Cultural Survey | cultural |
| 202209 | Tanagra | winter solstice feast | Ivomar IV | Ostrel | Federation Cultural Survey | cultural |
| 202202 | Tanagra | ceremonial drink | Lerishi IV | El-Adrel | Federation Cultural Survey | cultural |
| 202201 | Tanagra | ruling family | Gallos II | El-Adrel | Federation Historical Archive | historical |
| 202208 | Tanagra | guild of weavers | Halithos VII | Mendar | Federation Linguistic Survey | linguistic |
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'
| planet | sector | darmok_term | darmok_meaning | darmok_database | tanagra_term | tanagra_meaning | tanagra_database |
|---|---|---|---|---|---|---|---|
| Shantil III | El-Adrel | Darmok | mytho-historical hunter | Starfleet Xenolinguistics Archive | Tanagra | island-continent | Stellar 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.

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
| name | stable_in_oxygen | alters_materials | half_life_s | toxicity | last_used_year |
|---|---|---|---|---|---|
| Bryakbenate | false | [polymer] | 309.0 | high | NULL |
| Bryakbenide | false | [duranium, polymer] | inf | low | 2187 |
| Bryakbenon | false | [] | 263026.8 | low | 2343 |
| Bryakboride | false | [tritanium, ceramic] | 186208.7 | moderate | 2239 |
| Bryakborite | false | [] | inf | moderate | 2222 |
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
| name | alters_materials | half_life_s | toxicity | last_used_year | molecular_structure |
|---|---|---|---|---|---|
| Invidium | [glass] | inf | low | 2259 | MSG-16900005 |
| Jakmanite | [glass] | 15.0 | moderate | NULL | MSG-16900001 |
| Lucrovexitrin | [glass] | inf | extreme | NULL | MSG-16900003 |
| Saltzgadum | [glass] | inf | low | 2331 | MSG-16900004 |
| Selgninaem | [glass] | inf | extreme | NULL | MSG-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
| name | half_life_s | toxicity | last_used_year | status |
|---|---|---|---|---|
| Invidium | inf | low | 2259 | remaining |
| Saltzgadum | inf | low | 2331 | remaining |
| Jakmanite | 15.0 | moderate | NULL | eliminated: half-life too short |
| Lucrovexitrin | inf | extreme | NULL | eliminated: extremely toxic |
| Selgninaem | inf | extreme | NULL | eliminated: 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.

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
| id | issued_at | issued_by | recipient_type | recipient | order_type | personnel_id | new_post | division |
|---|---|---|---|---|---|---|---|---|
| 185 | 2368-04-11 | Starfleet Command, Personnel | starbase | Starbase 69 | survey directive | NULL | NULL | medical |
| 549 | 2368-04-11 | Starfleet Command, Security | starbase | Starbase 162 | maintenance schedule | NULL | NULL | engineering |
| 913 | 2368-04-11 | Starfleet Command, Operations | colony | Sandoval Prime colony | training exercise | NULL | NULL | sciences |
| 1277 | 2368-04-11 | Starfleet Command, Logistics | colony | Corlan VII outpost | escort duty | NULL | NULL | operations |
| 1641 | 2368-04-11 | Starfleet Command, Tactical | starship | USS Castellan | patrol assignment | NULL | NULL | command |
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
| recipient | recipient_type | irregular_reassignments | command_posts | security_posts | operations_posts | issuing_offices | first_issued | last_issued |
|---|---|---|---|---|---|---|---|---|
| Starbase 93 | starbase | 11 | 9 | 1 | 1 | 5 | 2368-06-05 | 2368-08-25 |
| Tyrus Minor outpost | colony | 10 | 8 | 1 | 1 | 5 | 2368-06-10 | 2368-08-21 |
| Starbase 175 | starbase | 9 | 7 | 1 | 1 | 5 | 2368-06-15 | 2368-08-27 |
| Starbase 31 | starbase | 8 | 6 | 1 | 1 | 5 | 2368-06-20 | 2368-09-09 |
| Lyris Beta outpost | colony | 7 | 5 | 1 | 1 | 5 | 2368-07-04 | 2368-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_office | past_six_months | n | recipients | min(issued_at) | max(issued_at) |
|---|---|---|---|---|---|
| false | false | 271 | 76 | 2367-08-20 | 2368-04-10 |
| false | true | 238 | 76 | 2368-04-11 | 2368-10-02 |
| true | true | 45 | 5 | 2368-06-05 | 2368-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_type | division | orders | officers_moved | destinations | issuing_offices | first_issued | last_issued |
|---|---|---|---|---|---|---|---|
| personnel reassignment | command | 35 | 35 | 5 | 5 | 2368-06-05 | 2368-08-25 |
| personnel reassignment | security | 5 | 5 | 5 | 1 | 2368-07-01 | 2368-08-22 |
| personnel reassignment | operations | 5 | 5 | 5 | 1 | 2368-08-01 | 2368-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!

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_name | birth_date | birth_place | occupation | residence | living | source | record_date | record_type | details |
|---|---|---|---|---|---|---|---|---|---|
| Thomas Raymond | 1986-02-17 | Secaucus, New Jersey | NULL | NULL | false | NULL | NULL | NULL | NULL |
| Edward Raymond | NULL | Secaucus, New Jersey | NULL | NULL | false | NULL | NULL | NULL | NULL |
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
| id | full_name | birth_date | birth_place | parent | occupation | living |
|---|---|---|---|---|---|---|
| 2 | Thomas Raymond | 1986-02-17 | Secaucus, New Jersey | Clare Raymond | NULL | false |
| 22 | Thomas Ramirez | 1986-02-17 | Secaucus, New Jersey | NULL | NULL | false |
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
| generation | full_name | birth_date | birth_place | occupation | residence | living | parent | children | civil_records |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Thomas Raymond | 1986-02-17 | Secaucus, New Jersey | NULL | NULL | false | Clare Raymond | 2 | NULL |
| 1 | Edward Raymond | NULL | Secaucus, New Jersey | NULL | NULL | false | Clare Raymond | 0 | NULL |
| 2 | Helen Raymond | 2041-09-30 | Newark, New Jersey | teacher | NULL | false | Thomas Raymond | 1 | NULL |
| 2 | Paul Raymond | 2046-06-02 | Newark, New Jersey | musician | NULL | false | Thomas Raymond | 0 | NULL |
| 3 | Marcus Raymond | 2099-04-12 | Chicago, Illinois | engineer | NULL | false | Helen Raymond | 2 | NULL |
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
| id | full_name | birth_date | birth_place | parent | residence | living | portrait |
|---|---|---|---|---|---|---|---|
| 9 | Thomas Raymond | 2338-05-14 | Indianapolis, Indiana | Catherine Raymond | outside Indianapolis, Indiana, Earth | true | semi-line drawing of a man around thirty |
| 2 | Thomas Raymond | 1986-02-17 | Secaucus, New Jersey | Clare Raymond | NULL | false | NULL |
| 19 | Thomas Raymond | 1971-02-17 | Dayton, Ohio | NULL | NULL | false | NULL |
| 20 | Thomas Raymond | 1952-08-17 | Secaucus, New Jersey | NULL | NULL | false | NULL |
| 21 | Thomas Raymond | 1947-02-07 | Secaucus, New Jersey | NULL | NULL | false | NULL |
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.

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%'
| name | affiliation | clan | born | died | age_at_death | images | clan_feuds |
|---|---|---|---|---|---|---|---|
| Volnoth | Gatherer | Lornack | 2264-03-14 | 2366-07-24 | 102 | 0 | Tralesta 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
| id | name | affiliation | clan | born | died | record_date | cause_of_death | pathogen | facility |
|---|---|---|---|---|---|---|---|---|---|
| 157201 | Penthor-Mul | Gatherer | Lornack | NULL | 2313-05-02 | 2313-05-02 | heart attack | Acamarian microvirus | Acamar III medical database |
| 157202 | Volnoth | Gatherer | Lornack | 2264-03-14 | 2366-07-24 | 2366-07-24 | cardiac arrest | Acamarian microvirus | USS 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
| src | id | item | date1 | date2 | detail |
|---|---|---|---|---|---|
| civil | 157103 | arrest | 2313-03-11 | NULL | Acamar III: Captured while leading a Gatherer raid on an Acamarian … |
| civil | 157104 | trial | 2313-04-20 | NULL | Acamar III: Trial opened |
| civil | 157105 | death | 2313-05-02 | NULL | Acamar III: Died of a heart attack before his trial ended |
| image | 157402 | Gatherer raid leader Penthor-Mul in custody at the outpost | 2313-03-11 | NULL | Acamar III; tagged: Penthor-Mul |
| image | 157401 | Penthor-Mul being led from his trial | 2313-04-27 | NULL | Acamar 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'
| name | affiliation | clan | born | record_type | record_date | planet | details |
|---|---|---|---|---|---|---|---|
| Volnoth | Gatherer | Lornack | 2264-03-14 | birth | 2264-03-14 | Acamar III | Born 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
| id | name | affiliation | clan | born | died |
|---|---|---|---|---|---|
| 157003 | Chorgan | Gatherer | Lornack | NULL | NULL |
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
| id | planet | clan_a | clan_b | started | ended | years | outcome | survivors | enemy_clan | enemy_persons_on_file | enemy_persons |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 157301 | Acamar III | Tralesta | Lornack | 2086 | 2286 | 200 | Tralesta clan massacred by the Lornacks | 0 | Tralesta | 3 | Hesra (Acamarian, born 2231-07-19, died 2286-10-05); Dovan (Acamari… |
| 157302 | Acamar III | Lornack | Dovrak | 2170 | 2231 | 61 | truce | NULL | Dovrak | 2 | Nessa (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%'
| entry_id | term | category | database_name | description |
|---|
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
| name | role | person_records | tralesta_records | clans_on_file |
|---|---|---|---|---|
| Marouk | Sovereign of Acamar III | 1 | 0 | NULL |
| Yuta | servant: cook and food taster | 0 | 0 | NULL |
| NULL | bodyguard | 0 | 0 | NULL |
| NULL | servant | 0 | 0 | NULL |
| NULL | servant | 0 | 0 | NULL |
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
| id | planet | taken | caption | people_tagged | delegation_members_present | clan_members_present |
|---|---|---|---|---|---|---|
| 157402 | Acamar III | 2313-03-11 | Gatherer raid leader Penthor-Mul in custody at the outpost | [Penthor-Mul] | NULL | Penthor-Mul [Lornack, died 2313-05-02] |
| 157404 | Acamar III | 2313-04-20 | Crowd outside the courthouse as a Gatherer trial opens | [] | NULL | NULL |
| 157401 | Acamar III | 2313-04-27 | Penthor-Mul being led from his trial | [Penthor-Mul] | NULL | Penthor-Mul [Lornack, died 2313-05-02] |
| 157405 | Acamar III | 2344-06-01 | Clan elders of the Dovrak at the harvest assembly | [Orlen, Nessa] | NULL | Nessa [Dovrak, died -], Orlen [Dovrak, died 2344-09-12] |
| 157403 | Acamar III | 2349-03-02 | Opening day of the trial of the Gatherer Tavik-Dar | [Tavik-Dar] | NULL | Tavik-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.

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
| signal_no | intrepid_seq | intrepid_ts | romulan_seq | romulan_ts | romulan_offset |
|---|---|---|---|---|---|
| 1 | 1 | 2346-08-19 03:12:04 | 3 | 2346-08-19 03:12:04 | 00:00:00 |
| 2 | 2 | 2346-08-19 03:12:19 | 4 | 2346-08-19 03:12:19 | 00:00:00 |
| 3 | 3 | 2346-08-19 03:12:31 | 5 | 2346-08-19 03:12:31 | 00:00:00 |
| 4 | 4 | 2346-08-19 03:12:47 | 6 | 2346-08-19 03:12:47 | 00:00:00 |
| 5 | 5 | 2346-08-19 03:13:02 | 7 | 2346-08-19 03:13:02 | 00: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
| seq | ts | signal_type | source | security_code | code_holder | post |
|---|---|---|---|---|---|---|
| 1 | 2346-08-19 02:40:00 | transmission | Khitomer outpost | KDF-1-0012-QOR | NULL | Khitomer outpost commander |
| 2 | 2346-08-19 03:11:52 | transmission | Romulan patrol ship | NULL | NULL | NULL |
| 11 | 2346-08-19 03:14:03 | sensor sweep | Khitomer outpost | NULL | NULL | NULL |
| 12 | 2346-08-19 03:14:11 | sensor sweep | Khitomer outpost | NULL | NULL | NULL |
| 13 | 2346-08-19 03:14:19 | subspace handshake | Khitomer outpost | KDF-7-2291-TAJ | Mogh | Khitomer 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
| seq | ts | signal_type | source | security_code | code_holder | species | post | seen_by_starfleet_sensors |
|---|---|---|---|---|---|---|---|---|
| 13 | 2346-08-19 03:14:19 | subspace handshake | Khitomer outpost | KDF-7-2291-TAJ | Mogh | Klingon | Khitomer outpost | false |
| 14 | 2346-08-19 03:14:20 | transmission | Khitomer outpost | KDF-7-2291-TAJ | Mogh | Klingon | Khitomer outpost | false |
| 15 | 2346-08-19 03:14:24 | transmission | Romulan patrol ship | KDF-7-2291-TAJ | Mogh | Klingon | Khitomer outpost | false |
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_seconds | distress_signals | first_signal | last_signal | intrepid_from | intrepid_to | romulan_seq_from | romulan_seq_to | coded_entries_between_segments |
|---|---|---|---|---|---|---|---|---|
| 0.0 | 8 | 1 | 8 | 2346-08-19 03:12:04 | 2346-08-19 03:13:49 | 3 | 10 | 3 |
| 2.5 | 6 | 9 | 14 | 2346-08-19 03:14:41 | 2346-08-19 03:15:51 | 19 | 24 | 3 |
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
| n | intrepid_seq | intrepid_ts | intrepid_signal | intrepid_source | romulan_seq | romulan_ts | romulan_signal | romulan_offset_s | intrepid_interval_s | romulan_interval_s |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 9 | 2346-08-19 03:14:41 | distress signal | Khitomer outpost | 19 | 2346-08-19 03:14:43.5 | distress signal | 2.5 | NULL | NULL |
| 2 | 10 | 2346-08-19 03:14:55 | distress signal | Khitomer outpost | 20 | 2346-08-19 03:14:57.5 | distress signal | 2.5 | 14.0 | 14.0 |
| 3 | 11 | 2346-08-19 03:15:09 | distress signal | Khitomer outpost | 21 | 2346-08-19 03:15:11.5 | distress signal | 2.5 | 14.0 | 14.0 |
| 4 | 12 | 2346-08-19 03:15:22 | distress signal | Khitomer outpost | 22 | 2346-08-19 03:15:24.5 | distress signal | 2.5 | 13.0 | 13.0 |
| 5 | 13 | 2346-08-19 03:15:38 | distress signal | Khitomer outpost | 23 | 2346-08-19 03:15:40.5 | distress signal | 2.5 | 16.0 | 16.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_id | name | database_ref |
|---|---|---|
| 41 | electropathic pattern | 4-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_id | agent | agent_type | agent_class |
|---|---|---|---|
| 1 | Iresine Syndrome | medical | condition |
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
| agent | agent_class | detected_on_enterprise | routinely_scanned |
|---|---|---|---|
| chrysimite | chemical | false | true |
| dardilion | chemical | false | true |
| ferrazene | chemical | false | true |
| hylanatine | chemical | false | true |
| manzene | chemical | false | true |
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_agents | routinely_scanned | not_scanned | agents_not_scanned |
|---|---|---|---|
| 22 | 22 | 0 | NULL |
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
| compound | byproduct | routinely_scanned | detected_on_enterprise |
|---|---|---|---|
| ferrazene | bilenium | true | false |
| ferrazene | tarrisite | true | false |
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
| byproduct | detections_on_enterprise |
|---|---|
| bilenium | 0 |
| tarrisite | 0 |
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
| substance | byproduct | routinely_scanned |
|---|---|---|
| dardilion | nilizene | false |
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_id | ship | location | substance | stardate |
|---|---|---|---|---|
| 212210 | SS Kallisto | Cargo Hold 1 | nilizene | 45427.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

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
| planet | stardate | source | patient | diagnosis | during_ullian_visit |
|---|---|---|---|---|---|
| Hurada III | 41194 | planetary medical record | HUR-1310 | Iresine Syndrome | false |
| Hurada III | 43531 | coma incident report | NULL | NULL | true |
| Hurada III | 43531 | planetary medical record | HUR-2207 | Iresine Syndrome | true |
| Hurada III | 43580 | planetary medical record | HUR-2215 | cranial trauma | true |
| Hurada III | 43657 | coma incident report | NULL | NULL | true |
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
| case_id | planet | patient | stardate | ullian_visit | ullians_present | other_delegations_present |
|---|---|---|---|---|---|---|
| 212105 | Hurada III | HUR-1310 | 41194 | NULL | NULL | Vulcan Science Academy |
| 212107 | Varnis VI | VAR-0802 | 42603 | NULL | NULL | NULL |
| 212101 | Teloria III | TEL3-0418 | 43304 | 43186-43380 | Inad, Jev, Tarmin | NULL |
| 212102 | Hurada III | HUR-2207 | 43531 | 43424-43712 | Inad, Jev, Tarmin | NULL |
| 212106 | Brevin V | BRV-0551 | 43547 | NULL | NULL | Vulcan 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
| planet | arrived_stardate | departed_stardate | coma_stardate | recorded_diagnosis | ullians_present |
|---|---|---|---|---|---|
| Jessen I | 42186 | 42465 | NULL | NULL | NULL |
| Jessen IV | 42498 | 42786 | NULL | NULL | NULL |
| Jessen I | 42810 | 42900 | NULL | NULL | NULL |
| Teloria II | 43030 | 43172 | NULL | NULL | NULL |
| Teloria III | 43186 | 43380 | 43304 | Iresine Syndrome | Inad, 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
| member | comas_present_for | total_comas |
|---|---|---|
| Jev | 6 | 6 |
| Inad | 5 | 6 |
| Tarmin | 4 | 6 |
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

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
| planet | arrived_stardate | departed_stardate | incident_id | coma_stardate | ullians_present | ullians_elsewhere |
|---|---|---|---|---|---|---|
| Nel II | 45123 | 45260 | NULL | NULL | NULL | NULL |
| Nel III | 45273 | 45383 | 5 | 45321 | Inad, Jev | Tarmin on Ullian homeworld |
| Nel III | 45273 | 45383 | 6 | 45323 | Inad, Jev | Tarmin 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
| member | incidents_present | total_incidents |
|---|---|---|
| Jev | 6 | 6 |
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'
| disorder | summary | year_diagnosed | diagnosed_by | diagnosed_at | cause |
|---|---|---|---|---|---|
| Transporter Psychosis | Transporter Psychosis was diagnosed in the year twenty-two-oh-nine … | 2209 | researchers | Delinia II | It 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
| symptom_id | symptom | category | detail | is_peripheral |
|---|---|---|---|---|
| 22801 | paranoid delusions | delusion | NULL | false |
| 22802 | multi-infarct dementia | dementia | NULL | false |
| 22803 | hallucinations | hallucination | Victims experience somatic, tactile and visual hallucinations, acco… | false |
| 22804 | sleeplessness | sleep | NULL | true |
| 22805 | accelerated heart-rate | cardiac | NULL | true |
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'
| symptom | detail |
|---|---|
| hallucinations | Victims 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
| disorder | treatments_on_file | treatments_in_database |
|---|---|---|
| Transporter Psychosis | 0 | 6 |
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.