Database tables (Notion): verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
 
(32 tussenliggende versies door dezelfde gebruiker niet weergegeven)
Regel 1: Regel 1:
One of the major functionalities of Notion, is ''database tables'', usually (and confusingly to me) just called ''databases'' (I use these two terms interchangeably). Thanks to this functionality, you can to a certain degree, create database-driven applications, including joins and filters and fields that in Notion are called ''properties'' - Quite exciting stuff!
+
One of the major functionalities of Notion, is ''database tables'', usually (and confusingly to me) just called ''databases'' (I use these two terms interchangeably). Thanks to this functionality, you can to a certain degree, create database-driven applications, including joins and filters - Quite exciting stuff!
  
''' Move this remarks to somewhere else, eventually '''
+
Within Notion, there is also such a thing as a 'regular' 'static' table, like in e.g., LibreOffice Writer - Hence ''database table'' might not be such a bad name.
 
 
* Within Notion, there is also such a thing as a 'regular' ''table'' like you also have in e.g., LibreOffice Writer - Hence ''database table'' might not be such a bad name.
 
* By default, a database table always seems to have the properties''title'', ''description'' and ''tags''. The description property is similar to the description field in Trello, with room for storing unlimited objects - Very handy!
 
  
 
== This is not just a database object ==
 
== This is not just a database object ==
Regel 19: Regel 16:
  
 
* ''Inline'' database tables are incorporated into existing pages
 
* ''Inline'' database tables are incorporated into existing pages
* ''full-page'' database tables acts like subpages with only the database table. I prefer to call these ''stand-alone database tables''.
+
* ''full-page'' database tables acts like subpages with only the database table. I prefer to call these ''standalone database tables''.
 
 
One remarkable difference between these to databases, is their [[Header difference (Notion) | difference in header]]
 
 
 
Perhaps more important than the differences between these types of database tables is their similarity: ''Database tables live are associated with pages''.
 
 
 
=== Example: Create a stand-alone database table ===
 
 
 
Let's do this slowly, so we understand everything that's happening:
 
 
 
{|
 
|[[file:20221209-1134.png|thumb|We start with an empty ''workspace''. I've used this one before and now removed all existing objects. That seems to trigger this ''Importing...'' prompt: Maybe Notion wants to import the objects again that you see on a new workspace. Anyhow, I think we're ready to go]]
 
|[[file:20221209-1139.png|thumb|I created a new page: ''Shiny New Page''. It didn't matter if I used the link ''+ Add a page'' on the left, or ''+ New page'' at the bottom left. Note the ''No pages inside'' note at the left under its name + the default document symbol for this page]]
 
|[[file:20221209-1615.png|thumb|Create a database - ''Full-page'']]
 
|}
 
{|
 
|[[file:20221209-1145.png|thumb|No ''view'' was specified, hence I got a database with ''table view'']]
 
|[[file:20221209-1105.png|thumb|I changed the name of the database table to ''DatabaseName'' and the name of the view from ''Table'' to ''TableView''. This may help to understand the hierarchy of objects in the sidebar]]
 
|[[file:20221209-1152.png|thumb|The start page contains this link ''DatabaseName''. If I remove it, I would actually delete the database]]
 
|}
 
  
Note:
+
See [[Inline & standalone database tables (Notion)]] for details.
  
* There are three objects rolled into one here: ''Database table'', ''view'' and ''page''
+
== Primary keys? ==
* There is hardly such a thing as a page. E.g., you cannot add other blocks
 
  
=== Example: Add an inline database ===
+
Notion doesn't use ''primary keys'' in the user interface - Not as a property, neither as an attribute of a property (or as an auto-increment field).
  
{|
+
I am quite sure that Notion uses primary keys internally:
|[[file:20221209-1154.png|thumb|In the same situation as before, let's add an inline database]]
 
|[[file:20221209-1157.png|thumb|Done! I find the object hierarchy on the left confusing: There is no difference between the situation with an ''inline database table'' and a ''full-page database table'']]
 
|}
 
  
=== Example: Create a subpage with an inline database ===
+
* An example that hints at internal pks: You can link database tables, and identical rows do not get mixed up
 +
* The function <code>id()</code> to retrieve a unique identifier for stuff (row?) - That's quite like a pk
 +
* You can't build anything beyond very trivial databases without pk - So simple.
  
 
{|
 
{|
|[[file:20221209-1212.png|thumb|In the same situation as before, let's add a subpage. I had to do this four times over, for Notion already added a database if I wasn't very deliberate. This is the result - The object hierarchy (on the left) seems to make more sense now]]
+
|[[file:20221209-1429.png|thumb|In this order line table, I can probably just delete the first property ''Orderline-ID'', for it probably has no purpose here]]
 
|}
 
|}
  
== Default properties ==
+
== Properties ==
  
As you can see in the example above, an empty database table contains these ''properties'':
+
→ [[Database properties (Notion)]]
 
 
{| class="wikitable" border="1"
 
|-
 
! Property Name
 
! Property Type
 
! Notes
 
|-
 
| Name
 
| Title
 
| Interesting: Notion has a specific property type called ''Title''
 
|-
 
| Tags
 
| Multi-select
 
| I really like these multi-select fields. That's much more work to code by yourself
 
|-
 
|}
 
  
 
== Views ==
 
== Views ==
Regel 86: Regel 46:
 
Can I see the 'raw database table definition'? Like ''Table view'' in Microsoft Access, or the ''table definition'' in MySQL?
 
Can I see the 'raw database table definition'? Like ''Table view'' in Microsoft Access, or the ''table definition'' in MySQL?
  
No, you can't. At least not in any ordinary way.
+
No, you can't.
  
There seem to be no regular way to just see the table definition without a view around it. But there are some ways to get close to this:
+
There seem to be no obvious or intended way to just see the table definition without a view around it. But there are some ways to get close to this:
  
 
=== Workspace export ===
 
=== Workspace export ===
  
 
{|
 
{|
|[[file:20221209-1259.png|thumb|Seems like ''overkill'' and I'm not even sure it contains an exhaustive definition of databaases: Make an export from a workspace and inspect it. The pane on the right is a subfolder of the stuff on the left]]
+
|[[file:20221209-1259.png|thumb| This surely qualifies as ''workaround'' and I'm not even sure it contains an exhaustive definition of database tables: Make an export from a workspace and inspect it. The pane on the right is a subfolder of the stuff on the left]]
 
|}
 
|}
  
 
=== Table view ===
 
=== Table view ===
  
The ''table view'' or ''table database view'' seems to be the most basic no-frills view:
+
The ''table view'' or ''table database view'' seems to be the most basic no-frills view and hence the closest to a barebone table definition:
  
 
* The specialist who created a system for me in Notion, seemed to regard these views as the closest thing to the raw table definition, and so do I
 
* The specialist who created a system for me in Notion, seemed to regard these views as the closest thing to the raw table definition, and so do I
Regel 144: Regel 104:
 
== Can I at least see all database tables with their name? ==
 
== Can I at least see all database tables with their name? ==
  
See the names of the database tables? What a nerdy question. Well, ''maybe'' you can. These illustrations use the examples above:
+
You want to see the names of the database tables? It seems that Notion really doesn't want you to do that. Especially the ''names'' of database tables seem to be shrouded in ambiguity:
  
=== Sidebar object hierarchy ===
+
=== Object browser ===
  
 
{|
 
{|
|[[file:20221209-1241.png|thumb|I found the ''sidebar object hierarchy'' the most obvious place to look for the database names. They are indeed mentioned here (I don't know if that's always the case), but they have the same symbol as pages and that makes it tricky]]
+
|[[file:20221209-1241.png|thumb|I found the sidebar ''object browser'' the most obvious place to look for the database names. They are indeed mentioned here (I don't know if that's always the case), but they have the same symbol as pages and that makes it tricky]]
 
|}
 
|}
  
Regel 158: Regel 118:
 
|}
 
|}
  
=== Add an existing database ===
+
=== Link to an existing database ===
  
 
{|
 
{|
Regel 164: Regel 124:
 
|[[file:20221209-1309.png|thumb|Get an overview of all ''data objects''. I don't know what the last item is. Maybe a leftover from earlier tests]]
 
|[[file:20221209-1309.png|thumb|Get an overview of all ''data objects''. I don't know what the last item is. Maybe a leftover from earlier tests]]
 
|}
 
|}
 +
 +
=== URL encoded? ===
 +
 +
I think I read somewhere, that a database-ID is included in relevant URLs. Of course, that's not a title, but at least an identifier.
  
 
== See also ==
 
== See also ==
  
 +
* [[Database properties (Notion)]]
 +
* [[Database views (Notion)]]
 
* [[Header difference (Notion)]]
 
* [[Header difference (Notion)]]
 
* [[Hoofdpagina#Notion]]
 
* [[Hoofdpagina#Notion]]
* [[Database views (Notion)]]
+
* [[Inline & standalone database tables (Notion)]]
 
* [[Lookup-tabellen (Notion)]]
 
* [[Lookup-tabellen (Notion)]]
 +
* [[Object browser (Notion)]]
  
 
== Sources ==
 
== Sources ==

Huidige versie van 13 dec 2022 om 08:29

One of the major functionalities of Notion, is database tables, usually (and confusingly to me) just called databases (I use these two terms interchangeably). Thanks to this functionality, you can to a certain degree, create database-driven applications, including joins and filters - Quite exciting stuff!

Within Notion, there is also such a thing as a 'regular' 'static' table, like in e.g., LibreOffice Writer - Hence database table might not be such a bad name.

This is not just a database object

It seems that in Notion, no 'traditional application development object' exists just on its own. Everything seems to have been lumped together with something else into something hybrid, like a transition from a world of clear black-and-white concepts, to one of endlessly gray amorphous blobs. Database tables are no exception: No aspect of database tables seem to just exist as they are. Sometimes you may think that you see the real thing, but just when you think you got it by the tail, it turns out to be only an illusion.

One of the consequences of this seems to be, that I can't really relate concepts in Notion to concepts that I know already from elsewhere - I found it really hard to understand things in Notion. Naturally, a solution would be that I just let go of my pre-existing concepts of what databases or web applications look like, but does that really work?

But there's hope: once you know this, life may become bearable again. Or at least you may understand why in this article, everything seems to be murky - At least, that's why I wrote this introduction: Last time I looked up this article before writing this paragraph, I got annoyed that it doesn't discuss database concept within Notion just as they are, but only in relation to other stuff. Now I know. And it's ok.

Database tables live around pages

Probably the easiest introduction to Notion database tables, is that they live around pages. They come in two flavors:

  • Inline database tables are incorporated into existing pages
  • full-page database tables acts like subpages with only the database table. I prefer to call these standalone database tables.

See Inline & standalone database tables (Notion) for details.

Primary keys?

Notion doesn't use primary keys in the user interface - Not as a property, neither as an attribute of a property (or as an auto-increment field).

I am quite sure that Notion uses primary keys internally:

  • An example that hints at internal pks: You can link database tables, and identical rows do not get mixed up
  • The function id() to retrieve a unique identifier for stuff (row?) - That's quite like a pk
  • You can't build anything beyond very trivial databases without pk - So simple.
In this order line table, I can probably just delete the first property Orderline-ID, for it probably has no purpose here

Properties

Database properties (Notion)

Views

Database tables are created in conjunction with a view: A way to view the data, a bit like table view plus form view in Microsoft Access at once. See Database views (Notion) for details.

Can I have the raw table definition, please?

Can I see the 'raw database table definition'? Like Table view in Microsoft Access, or the table definition in MySQL?

No, you can't.

There seem to be no obvious or intended way to just see the table definition without a view around it. But there are some ways to get close to this:

Workspace export

This surely qualifies as workaround and I'm not even sure it contains an exhaustive definition of database tables: Make an export from a workspace and inspect it. The pane on the right is a subfolder of the stuff on the left

Table view

The table view or table database view seems to be the most basic no-frills view and hence the closest to a barebone table definition:

  • The specialist who created a system for me in Notion, seemed to regard these views as the closest thing to the raw table definition, and so do I
  • This is why I usually start with a table view, eventhough I probably well never use it - I do like to have it as backup, in case of complications
  • When you create a new database without specifying a view, you get this view.

For more: Database views (Notion).

Peek view

With the creation of a database table and its view, an additional so-called peek view gets created. A bit like a custom Edit view on a WooCommerce product:

  • It always gets created in the same way, regardless of the view that is specified at database creation
  • But it's really a view and not just a raw table representation, because you can change its presentation.
  • But the original peek view is preserved, so you can always get back to it - And that looks again a bit like a table definition representation.

For more: Peek view (Notion).

Can I see the properties of a database table?

Ehm, yes, you may see those:

View » Properties

This is probably the most reliable approach:

Go to a view » Properties

Peek view

Go to a field (in a regular view) » Peek view

Table view

Probably the least reliable approach, but easily available:

Through table view. When you don't have this view anymore, you can recreate it

Can I at least see all database tables with their name?

You want to see the names of the database tables? It seems that Notion really doesn't want you to do that. Especially the names of database tables seem to be shrouded in ambiguity:

Object browser

I found the sidebar object browser the most obvious place to look for the database names. They are indeed mentioned here (I don't know if that's always the case), but they have the same symbol as pages and that makes it tricky

Hoover over the name of a view

When I hoover over the name of the view, the tool tip says Table view of MyInlineDatabaseName

Link to an existing database

Go to a page » new block: Link existing database
Get an overview of all data objects. I don't know what the last item is. Maybe a leftover from earlier tests

URL encoded?

I think I read somewhere, that a database-ID is included in relevant URLs. Of course, that's not a title, but at least an identifier.

See also

Sources

Name of the database table?