Skip to main content

📝 Lesson 6.2: Dataview — Turn Your Notes into a Database

This is one of the marquee lessons of the whole course. Dataview is the plugin that makes people gasp: it treats your ordinary notes — plus the little bits of data you tuck inside them — as a living database you can query. Write a few lines, and Obsidian assembles a list of every book you've read, a table of your projects by status, or every unfinished task across your entire vault. It updates itself. Let's learn to think in queries.

📚 What You'll Learn

By the end of this lesson, you will be able to:

  • Explain how Dataview turns frontmatter and inline fields into queryable data
  • Write all four query types — LIST, TABLE, TASK, and know that CALENDAR exists — inside dataview code fences
  • Control results with FROM, WHERE, SORT, LIMIT, GROUP BY, and use implicit fields like file.name
  • Drop inline queries into prose and build a real dashboard note that powers MOCs
  • Meet Bases — Obsidian's built-in, no-plugin visual database — and choose between Bases and Dataview for a given job

⏱️ Estimated Time: 75 minutes

🎯 Project: Build a dashboard note containing two live Dataview queries over notes you've tagged.

In This Lesson

The Big Idea: Notes as a Database

Picture a spreadsheet of every book you've read: title, author, rating, date finished. Now imagine you never had to build that spreadsheet — it just assembled itself from the notes you already wrote, and stayed current forever. That's Dataview.

Here's the shift in thinking. A plain note is a page of text. But if you add a little structured data to your notes — "this note is about a book, rated 4 stars, finished last March" — then a collection of notes becomes a table of records. Dataview reads all your notes, gathers that structured data, and lets you query it: show me every book rated 4 stars or higher, sorted by date. The result appears right inside a note, live, and refreshes as you add more books.

📖 Definition

Dataview: a community plugin that indexes your entire vault and lets you write queries against it. Each note is treated as a row; the fields you add (in frontmatter or inline) are its columns; and its built-in properties (like creation date, file name, tags) are always available too. You write queries in a simple, SQL-flavored language inside special code blocks, and Dataview renders the answer.

Why does this matter so much? Because it flips note-taking from filing to querying. You stop maintaining lists by hand — reading lists, project trackers, meeting logs, "notes I need to revisit" — and instead let a query build them for you from the notes you're already writing. This is the engine behind dashboards and Maps of Content (MOCs), and it's why Dataview is the single most-loved plugin in the Obsidian world.

graph LR A["📝 Notes with
fields & tags"] --> B["🗂️ Dataview
indexes the vault"] B --> C["❓ You write
a query"] C --> D["📊 Live list, table,
or task view"] D --> E["Add a note
→ result updates itself"] E --> A

Installing Dataview & Adding Data

You already know the drill from Lesson 6.1. Open Settings > Community plugins > Browse, search for Dataview (by Michael Brenan / blacksmithgu), Install, then Enable. Dataview is enormously popular and actively maintained — it sails through the evaluation checklist. It only reads your notes to build its index, so it's low-risk.

Two ways to add data to a note

Dataview reads structured data from your notes in two forms. You'll use both.

1. YAML frontmatter (Properties)

You met this back in the Properties lesson: a block of key: value lines between --- fences at the very top of a note. Dataview treats every property as a field.

---
title: The Pragmatic Programmer
author: Hunt & Thomas
rating: 5
status: finished
finished: 2026-03-14
tags:
  - book
---

2. Inline fields

Sometimes you want a field in the body of a note, next to the text it describes. Dataview lets you write inline fields using a double colon: key:: value.

This book was recommended by a mentor.
rating:: 5
status:: finished
finished:: 2026-03-14

You can even put an inline field mid-sentence using bracket syntax so it reads naturally, e.g. [rating:: 5] or (rating:: 5) — square brackets keep the key visible, parentheses hide it and show only the value.

💡 Frontmatter vs. inline — which to use?

Use frontmatter for a note's core "metadata" — the fields that describe the whole note (status, rating, project, due date). It's clean, it's the standard Properties system, and it's visible in the Properties editor. Use inline fields when a data point belongs within the content — a value attached to a particular line or paragraph. Dataview reads both the same way, so it's about what reads best in that note. Beginners can happily start with frontmatter for almost everything.

⚠️ Watch Out

Field names are matched loosely but consistency saves you pain. Dataview lowercases and treats spaces/dashes flexibly, but if half your notes say status and half say Status: in prose, your queries will miss records. Pick a name for each field and stick to it. And remember: inline fields need the double colon (::) — a single colon in the body is just normal text to Dataview.

The Four Query Types

A Dataview query lives inside a fenced code block whose language is dataview. When you're in Reading view (or Live Preview), Obsidian replaces the block with the rendered result. Every query starts with one of four query types.

LIST — a simple bullet list of notes

The simplest output: one bullet per matching note, linked.

```dataview
LIST
FROM #book
```

That renders a bulleted, clickable list of every note tagged #book. You can also list a value beside each note: LIST rating FROM #book shows each book with its rating.

TABLE — columns of data

The workhorse. You name the columns you want, and (optionally) rename them with AS for a friendly header.

```dataview
TABLE author AS "Author", rating AS "★", status AS "Status"
FROM #book
SORT rating DESC
```

The first column is always the note's link — you don't have to ask for it. Each additional expression after TABLE becomes a column; AS "..." sets its header text.

TASK — checkboxes from across your vault

Dataview can gather Markdown tasks (lines starting with - [ ] or - [x]) from every note. The magic touch: checking a box in the query result checks it in the original note. It's a real, interactive task view.

```dataview
TASK
FROM "Projects"
WHERE !completed
```

That collects every unfinished task from notes in your "Projects" folder into one live checklist.

CALENDAR — a monthly heat-map (worth knowing)

The fourth type, CALENDAR, plots notes onto a month calendar based on a date field. It's less commonly used than the other three, but it's there when you want a visual, date-based view.

```dataview
CALENDAR finished
FROM #book
```

This drops a dot on each day a book was finished. For most everyday work you'll reach for LIST, TABLE, and TASK — master those three and you can build almost anything.

✅ Pro Tip

Build queries incrementally. Start with just LIST FROM #book and confirm you get the notes you expect. Then add columns, then a WHERE, then a SORT. If a query returns nothing, strip it back to the bare FROM and add clauses one at a time — the culprit reveals itself fast.

FROM, WHERE, SORT, LIMIT, GROUP BY

These clauses shape which notes appear and in what order. They read almost like English.

FROM — choose your source

FROM narrows the query to a set of notes. Sources can be combined with and / or:

SourceMeaning
FROM #bookNotes with the #book tag (includes nested like #book/fiction)
FROM "Reading"Notes in the Reading folder (quotes required)
FROM [[The Pragmatic Programmer]]Notes that link to that note
FROM #book and "Reading"Tagged #book and in the Reading folder
FROM #book or #articleTagged #book or #article
FROM #book and -#book/abandoned#book but excluding the abandoned sub-tag (the - negates)

Omit FROM entirely and Dataview searches your whole vault — useful, but usually you want to narrow it.

WHERE — filter by field values

WHERE keeps only rows matching a condition. Combine with and, or, and comparison operators:

WHERE rating >= 4
WHERE status = "finished"
WHERE rating >= 4 and status != "abandoned"
WHERE contains(tags, "favorite")
WHERE !completed          # for tasks: only unchecked ones

SORT — order the results

SORT field ASC or SORT field DESC. You can sort by any field or implicit field: SORT rating DESC, SORT file.name ASC, SORT file.mtime DESC (most recently modified first).

LIMIT — cap the number of rows

LIMIT 10 shows only the first ten results — perfect for a dashboard's "5 most recent notes" widget when paired with a SORT.

GROUP BY — cluster rows under headings

GROUP BY field collapses results into groups. For example, group your books by status so "reading," "finished," and "to-read" each get their own section:

```dataview
TABLE rows.file.link AS "Books"
FROM #book
GROUP BY status
```

FLATTEN — one row per value (brief)

Occasionally a field holds a list (e.g. a note with several author values, or you want one row per tag). FLATTEN expands a list so each item becomes its own row. It's an advanced move — just remember it exists for when you need "one row per item in a list rather than one row per note."

```dataview
TABLE author
FROM #book
FLATTEN author
```

Implicit Fields & Inline Queries

Implicit fields — data every note already has

You don't have to add fields to query useful things. Every note automatically carries a set of implicit fields under file. These are gold for dashboards:

FieldWhat it is
file.nameThe note's file name (without .md)
file.linkA clickable link to the note
file.folderThe folder the note lives in
file.ctimeCreation time
file.mtimeLast modified time
file.tagsAll tags in the note
file.sizeFile size in bytes

So "the 5 notes I touched most recently" needs no special fields at all:

```dataview
TABLE file.mtime AS "Last edited"
SORT file.mtime DESC
LIMIT 5
```

Inline queries — a value dropped into prose

Sometimes you don't want a whole block — just a single value woven into a sentence. An inline query uses a single equals sign inside backticks, and Dataview replaces it with the computed value in Reading view:

This note is called `= this.file.name` and was created on `= this.file.ctime`.

Here this refers to the current note. You can surface any field: `= this.rating` prints the current note's rating right in the text. Inline queries are wonderful for note headers and templates (which is exactly where you'll use them in the next lesson).

⚠️ Watch Out

Dataview results render in Reading view and Live Preview, but in raw Source mode you'll just see the query text — that's normal, not a bug. Also, a query block or inline query is generated content: it isn't saved as a list in your file, it's recomputed each time you view the note. That's the whole point — it always reflects your current vault.

Four Queries You Can Paste

Here are four correct, ready-to-use queries. Assuming you've tagged some notes, paste any of these into a note (in a dataview fence) and watch it come alive.

1. Every note tagged #book, as a list

```dataview
LIST
FROM #book
SORT file.name ASC
```

2. A table of projects with their status and due date

```dataview
TABLE status AS "Status", due AS "Due", file.mtime AS "Updated"
FROM #project
WHERE status != "done"
SORT due ASC
```

3. Every incomplete task across the vault

```dataview
TASK
WHERE !completed
GROUP BY file.link
```

Grouping by file.link tidies the tasks under the note each one came from. Check a box here and it updates the source note.

4. Your five most recently edited notes (a dashboard classic)

```dataview
TABLE file.folder AS "Folder", file.mtime AS "Last edited"
SORT file.mtime DESC
LIMIT 5
```

💡 These are the building blocks of MOCs and dashboards

A Map of Content (MOC) is a hub note that gathers everything about a topic. Instead of hand-linking every related note, you drop a Dataview query that pulls them in automatically — LIST FROM #python and your Python MOC is always complete. A dashboard is just a note stacking several of these queries: recent notes, open tasks, active projects. You're one project away from building one.

A Word on DataviewJS

Everything above uses the friendly Dataview Query Language (DQL) — plain, readable, and enough for the vast majority of needs. Dataview also ships a power-user mode called DataviewJS: a dataviewjs code block where you write actual JavaScript to build completely custom output — computed columns, charts, conditional formatting, anything code can do.

```dataviewjs
dv.list(dv.pages("#book").where(b => b.rating >= 4).file.link)
```

You do not need DataviewJS to be productive — many expert users never touch it. Just know it exists as a ceiling above you: if one day you hit something DQL can't express, JavaScript is waiting. For now, DQL is your happy home. (And a small safety note: because DataviewJS runs code, only paste DataviewJS you understand or trust — the same mindset from Lesson 6.1.)

🧠 Mindset

If SQL-flavored queries feel intimidating, breathe — you already read WHERE rating >= 4 and understood it. Dataview isn't "programming," it's describing what you want to see. You'll write your first query wrong, tweak one clause, and get it right. That loop — try, read the result, adjust — is the entire skill. Nobody memorizes this; everyone builds queries a clause at a time. You can too, starting today.

Bases — Obsidian's Native Database (No Plugin Needed)

Dataview is a community plugin. But Obsidian now ships a built-in way to turn notes into a database, too: Bases, a core feature you enable in one click — no plugin to install, and it works everywhere Obsidian does, including Sync and mobile. Where Dataview is a query language you write, Bases is a visual, spreadsheet-like interface you click: pick which note properties become columns, add filters from menus, and switch between a Table and a Card view — all without learning any syntax.

How it works

Turn it on under Settings → Core plugins → Bases. Then create a base — either a standalone .base file or one embedded inside a note. A base gathers notes (you set a filter, like "notes with the property type: book"), shows their properties as columns, and lets you sort, filter, and add formula columns from a point-and-click UI. Because it reads the same frontmatter properties you met in Lesson 2.3, any structure you've already added to your notes shows up instantly — no query to write.

 DataviewBases
Ships with Obsidian?No — community pluginYes — core feature
How you build itWrite queries in a code fence (DQL)Click a visual UI — no syntax
ViewsList, Table, Task, CalendarTable & Card (more over time)
Inline queries in proseYesNo — a base is its own block or file
Mobile & SyncNeeds the plugin installed there tooEverywhere, nothing to install
MaturityMature, huge feature setNewer, actively developed by Obsidian

✅ Which should you use?

Use Bases when you want a built-in, future-proof, no-syntax database — a spreadsheet-like view of your notes that just works on every device with nothing to install. Reach for Dataview when you need its deeper power: inline queries woven into prose, TASK queries across your vault, or the JavaScript ceiling of DataviewJS. They happily coexist — many people build quick property tables in Bases and keep Dataview for their richest dashboards.

⚠️ Honest note — Bases is young

Bases arrived recently and is still growing (view types and functions are being added over time), so a tutorial you find might show slightly different menus than your version. Dataview, by contrast, is years old with a vast community. Neither is "the winner": Bases wins on being native and effortless, Dataview wins on depth. Because Bases is built in and needs no plugin, it's the safest first stop for a simple notes-database — and you already have everything you need to try it right now.

🎯 Project: Build a Dashboard

Time to make Dataview real in your vault. You'll tag a few notes, then build a single dashboard note with two live queries that update themselves as your vault grows.

🏋️ Build a two-query dashboard

Objective: Produce a working dashboard note driven by Dataview over notes you've tagged.

Instructions (about 25 minutes):

  1. (3 min) Confirm Dataview is installed and enabled (Settings > Community plugins).
  2. (7 min) Pick a theme you have several notes about — say books, or a project. Tag at least 4 notes with the same tag (e.g. #book) and add one or two fields to each in frontmatter, such as status: and rating:.
  3. (2 min) Create a new note called Dashboard.
  4. (5 min) Query 1 — a table. Add a dataview block: TABLE status AS "Status", rating AS "★" FROM #book SORT rating DESC. Switch to Reading view and confirm your books appear.
  5. (5 min) Query 2 — recent activity. Add a second dataview block: TABLE file.mtime AS "Last edited" SORT file.mtime DESC LIMIT 5.
  6. (3 min) Add a heading above each query so the dashboard reads well, then edit one of your tagged notes and watch the "Last edited" table reorder itself.
💡 Hint — a complete dashboard note to copy
# 📊 Dashboard

## 📚 My Books
```dataview
TABLE status AS "Status", rating AS "★"
FROM #book
SORT rating DESC
```

## 🕒 Recently Edited
```dataview
TABLE file.folder AS "Folder", file.mtime AS "Last edited"
SORT file.mtime DESC
LIMIT 5
```

Make sure each tagged note actually has the #book tag (in the body or as a tags: property) and the status/rating fields, or the table will be empty or blank in those columns.

🛟 Solution — nothing is showing up?
  • Are you in Reading view or Live Preview? Source mode shows raw query text.
  • Is the code fence language exactly dataview (all lowercase)?
  • Do your notes really carry the tag? A tags: [book] property or a body #book both work; #Book vs #book case can matter.
  • Strip the query to just LIST FROM #book to confirm the source matches, then add columns back.

✅ Project Completion Checklist

  • At least 4 notes share a tag and carry one or two fields
  • You have a "Dashboard" note with two Dataview blocks
  • Query 1 is a TABLE with at least one named column via AS
  • Query 2 uses SORT + LIMIT (e.g. recent notes)
  • Editing a note visibly updates the dashboard

🎯 Quick Quiz

Question 1: How do you write an inline field that Dataview will read?

Question 2: Which query type gives you an interactive checklist gathered from many notes?

📓 Learning Journal

Open your learning journal note inside your vault. After each lesson, take a few minutes to write down:

  • Key concepts you learned
  • Techniques that clicked for you
  • Questions or confusion points to revisit
  • Ideas you want to try
  • Your progress and feelings about learning this

✍️ This lesson's prompt: What is one collection you currently maintain by hand — a reading list, a project tracker, a list of ideas — that a Dataview query could build for you automatically? Sketch the query in words: what would you put in FROM, and what in WHERE?

📝 Lesson Summary

🎓 Key Takeaways

  • Dataview treats your notes plus their frontmatter and inline fields (key:: value) as a queryable database.
  • Four query types live in dataview fences: LIST, TABLE (with columns + AS), TASK, and CALENDAR.
  • Shape results with FROM (#tag, "folder", [[link]], combined with and/or), WHERE, SORT, LIMIT, GROUP BY, and FLATTEN.
  • Implicit fields like file.name, file.link, file.mtime, and file.tags work with no setup; inline queries (= this.file.name) drop values into prose.
  • These queries power dashboards and MOCs; DataviewJS waits above DQL for power users.
  • Bases is Obsidian's built-in database — a no-syntax, visual (Table/Card) view over your note properties, working everywhere with nothing to install. Use it for simple, future-proof databases; keep Dataview for inline queries and deep power.

🎉 What You've Accomplished

You've learned to think about your vault as data — and you built a real, self-updating dashboard from notes you already had. That's a genuine superpower: the more you write, the more your queries surface for you, with zero extra maintenance. Most people never get here. You just did.

❓ Common Questions at This Stage

My query shows nothing — what's wrong?

Almost always one of three things: you're in Source mode (switch to Reading view or Live Preview); the code fence isn't exactly dataview; or your FROM doesn't actually match any notes (check the tag spelling/case and that the field names match). Reduce the query to LIST FROM #yourtag and rebuild from there.

Does Dataview change or save data into my notes?

No. Dataview reads your notes to build an index and renders results on the fly. The output isn't written into your file — it's recomputed every time you view the note. The one interactive exception is checking a TASK box, which updates the checkbox in the source note. Your plain-text files stay yours.

Should I use frontmatter or inline fields?

Use frontmatter (Properties) for whole-note metadata like status, rating, or due date — it's the standard and shows in the Properties editor. Use inline key:: value when the data belongs beside a specific line of content. Dataview reads both identically, so choose whatever reads best in that note.

🔭 Looking Ahead

You've been adding fields and tags to notes by hand. In the next lesson we automate the creation of well-structured notes with Templater and Templates — so every new book note, meeting note, or daily note starts life with exactly the frontmatter your Dataview queries expect. Dataview and Templater are a legendary duo.

✅ Before the Next Lesson

  • Keep your Dashboard note — you'll enrich it as your vault grows
  • Try one more query of your own invention (even a small one)
  • Notice which fields you keep typing by hand — those are template candidates
  • Write your Learning Journal entry for this lesson

📚 Additional Resources

🌟 Encouragement for the Journey

You just taught your notes to organize themselves. That shift — from filing things to querying them — is the moment a pile of notes becomes a genuine second brain. Add fields as you write, and your dashboards will keep getting richer while you do nothing at all. Next, we make new notes practically write their own opening lines. 🔮