Let’s use Opus 4.1 on my NETFLIX data

Generating application code is cool and all. However, there are more people out there trying to answer business questions than building apps. So having an LLM that can produce good SQL, and having a pathway to running it (MCP) will be an invaluable asset to any organization!

I don’t recommend or endorse this particular LLM (Opus 4.1), but I mentioned the name so you have a point of reference. I find most LLMs are quite good at generating SQL, or even better, generating Oracle’s SQL dialect. But you WILL find measurable differences between the various LLM offerings, so be alert and picky!

I toured my NETFLIX streaming data a few years ago. I’m wondering what my Agent could extract from that data if I let IT decide to run the SQL. So let’s see –

the order

I need a report for each family member, highlighting their viewing habits. Items of interest include titles that have been viewed repeatedly, total time spent watching content, and any patterns you might be able to determine.

How do I make it happen

I’ve exported my personal NETFLIX data and put it into the 19c Always Free Autonomous Database. I have access to this database via my SQLcl MCP Server, and I have configured this MCP Server for my Agent. The agent doesn’t matter, but it rhymes with Todd.

Note: I have used a limited database user to store and query this data, I have definitely NOT used ADMIN for this task.

What’s the plan? Sorry, what’s wrong Todd’s plan?

  1. get NETFLIX table structure
  2. take a sample of the data
  3. get a list of different family members and their viewing statistics
  4. get total viewing time per family member
  5. find the top recurring titles for each family member
  6. Analyze viewing patterns by day of the week and time of day
  7. analyze content type preferences
  8. Binge-watch episode ID

I’ll dive into the SQL it produces (because it’s interesting!) later in this post, but let’s get straight to the findings. Note I have anonymized the names of my family members. I’m Jefferson, miss Jeff/el Jefe.

The result

Number of Views

14.4K

Joint Session

Unique Title

7.6K

Shows & Movies

Watch Time

4,891

Number of Hours

Family members

5

Active Profile

πŸ”₯ Most Rewatched

GO! Unforgettable Party
42 times

Grey’s Anatomy (97 binge sessions!)
16 eps/day

My Little Pony: Rainbow Rock
29 times

Peak Times

23.00 – 00.00

πŸŽ₯ Top Rewatches

Total Withdrawal
10 times

West Wing
29 parties

Avengers: Infinity War
9 times

🌟 Diverse Interests

The Great British Baking Show
25+ views

formula 1
13 parties

Selling Twilight
13 parties

Favorite Day

Mon, Thu, Fri

πŸ’• Favorite Series

Inland areas
31 parties

Virgin River
14 parties

Hart of Dixie
11 parties

Favorite Day

Saturday, Tuesday, Wednesday

🎯 Favorite Content

LEGO Jurassic World
18 times

We’re Naked Bears
19 parties

Minecraft: Story Mode
24+ views

πŸ” Family Key Insights

πŸ† Family Superlatives

  • Most Active: That Girl (5,630 sessions)
  • Most Diverse: Mamacita (2,276 titles)
  • Longest Session: Jefferson (30.7 minutes)
  • Party Champion: That girl (30 eps/day!)
  • Night Owl: Mamacita (peak at 02.00)

πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦ Shared Interests

  • Grey’s Anatomy: Girl & Mamacita
  • My Babysitter Is a Vampire: Girl & Boy
  • Good Place: Mother-in-Law & Mamacita
  • Peak family viewing: 23.00 – 02.00
  • Weekend afternoons: The Boy’s domain

πŸ“ˆ Recommendations

  • Jefferson opts for family movie night
  • Monitor late night streaming quality
  • Download the featurette for a short session of The Boy
  • Set a β€œContinue Watching” list.
  • Consider a group viewing schedule

Let’s be the judge

Anthropic released Opus 4.1 4 months ago. I am relatively satisfied with the work he did for my assignment.

If I want to review the SQL it is executing, I can do so easily by looking at my MCP log table, DBTOOLS$MCP_LOG.

It’s nice that Todd annotates the SQL he produces with comments showing what he’s doing with the code.

Let’s look at one of the more interesting questions, ‘ID binge watching session…’

The query uses a three (3) level CTE (Common Table Expression) structure with a WITH clause to progressively aggregate and filter data.

NETFLIX Table (raw data)
↓
daily_show_views (profile + date + event aggregation)
↓
binge_stats (profile + event summary)
↓
Final results (top 5 rankings per profile)

There was no problem navigating the INTERVAL column in my table and using the EXTRACT function to get the desired time measurement.

Regular expressions are less fun for me, but there’s no problem using them to handle quotes in show/movie titles, and all the calculations look ‘correct’.

SQL

Could this question be better?

For readability perhaps we could move the regex so it’s not called more than once, but I don’t think that would affect the execution plan. I think that’s OK, or at least I think the findings are accurate.

LLM is pretty good at generating SQL! Especially when they have the information they need to do so. The MCP server gives it access to the database and the ability to interrogate the dictionary to obtain table definitions and can sample data. That definitely helps.

CTEs are very popular, especially in the SQL Server world. I wouldn’t be surprised to see an LLM producing SQL that employs them. I also find it easier to read and understand, so I’m fine with that.

As always, supervise your Agent. Review and approve/deny their requests as needed. See how they answer your questions. I do see them make bad assumptions, but often enough that it’s still dangerous. But for this session, the fight was pretty much 1,000.

Berita Terkini

Berita Terbaru

Daftar Terbaru

News

Berita Terbaru

Flash News

RuangJP

Pemilu

Berita Terkini

Prediksi Bola

Togel Deposit Pulsa

Technology

Otomotif

Berita Terbaru

Daftar Judi Slot Online Terpercaya

Slot yang lagi gacor

Teknologi

Berita terkini

Berita Pemilu

Berita Teknologi

Hiburan

master Slote

Berita Terkini

Pendidikan

Resep

Jasa Backlink

One Piece Terbaru