<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Advanced SQL Field Types]]></title><description><![CDATA[<p dir="auto">Hello Everyone,</p>
<p dir="auto">Can someone tell me where the definitions of the linked field/fields are?</p>
<p dir="auto">What is the difference of linking a field or multiple fields?<br />
What is the difference between linking by reference or by value?</p>
<p dir="auto">Thank you!</p>
<p dir="auto"><img src="/assets/uploads/files/1590770970167-screenshot-2020-05-29-17.47.42.png" alt="Screenshot 2020-05-29 17.47.42.png" class="img-responsive img-markdown" /></p>
]]></description><link>https://community.appdrag.com/topic/88/advanced-sql-field-types</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 12:39:26 GMT</lastBuildDate><atom:link href="https://community.appdrag.com/topic/88.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 29 May 2020 16:50:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Advanced SQL Field Types on Tue, 07 Jul 2020 08:39:40 GMT]]></title><description><![CDATA[<p dir="auto">You can run the in "New Query", this is returning the execution time in miliseconds of your query<br />
Another great thing you can do to improve query speed is to add indexes on your tables on the fields you are using in WHERE or JOIN conditions. You can get a 100x improvement with indexes <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
<p dir="auto"><img src="/assets/uploads/files/1594111164577-a1108917-d540-49f3-9d80-0e15cb45597f-image.png" alt="a1108917-d540-49f3-9d80-0e15cb45597f-image.png" class="img-responsive img-markdown" /></p>
<p dir="auto">It's accessible from the EDIT button when you are inside a table</p>
]]></description><link>https://community.appdrag.com/post/681</link><guid isPermaLink="true">https://community.appdrag.com/post/681</guid><dc:creator><![CDATA[Joseph Benguira]]></dc:creator><pubDate>Tue, 07 Jul 2020 08:39:40 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 16:35:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/16">@Joseph-Benguira</a> By the way, is there any way I can test the query performance?</p>
]]></description><link>https://community.appdrag.com/post/665</link><guid isPermaLink="true">https://community.appdrag.com/post/665</guid><dc:creator><![CDATA[ThomasD]]></dc:creator><pubDate>Mon, 06 Jul 2020 16:35:12 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 16:34:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/16">@Joseph-Benguira</a></p>
<p dir="auto">Ideas:</p>
<ol>
<li>
<p dir="auto">At first my idea was to use what you suggest, use node to make calls of each referenced table row, but I thought using joins would be faster. Plus, the automatic database GUI forms could not be used when using several separate tables.</p>
</li>
<li>
<p dir="auto">The dictionaries idea is interesting, we could gather all the ref unique ID's and combine that into an array of ID's that is needed for the request and fetch that only once. This should be faster than a join because we'd not be fetching the rows multiple times for every item.</p>
</li>
<li>
<p dir="auto">Seems like it's easy to choose a design that would be limiting though, a proper many-to-many relation would enable more features while persisting performance. But it would mean we'd have to make custom input forms/functions and write raw db queries.</p>
</li>
</ol>
<p dir="auto">I'll compile this into a how-to when I've tested it more.</p>
<p dir="auto">(I managed to get a join query working on the arrays btw)</p>
]]></description><link>https://community.appdrag.com/post/664</link><guid isPermaLink="true">https://community.appdrag.com/post/664</guid><dc:creator><![CDATA[ThomasD]]></dc:creator><pubDate>Mon, 06 Jul 2020 16:34:47 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 14:37:12 GMT]]></title><description><![CDATA[<p dir="auto">What you can do in the cloud function is to make 2 queries, one to get the main data, and another one to get the references from your ref table, then loop on the main results and enrich them based on what you have in the ref table. So this solution is few lines of node.js</p>
<p dir="auto">There is another way we also use quite often, the idea is to return the data with the refs in an array and in the same api call also return the dictionnaries</p>
<p dir="auto">E.g: in your node.js function</p>
<pre><code>var result = {
    rows: yourRowsHere,
    dic: rowsFromAnotherQueryToYourRefTable
};
callback(null, result);
</code></pre>
<p dir="auto">Then in the frontend code use the dictionnary when interpreting the rows.</p>
]]></description><link>https://community.appdrag.com/post/663</link><guid isPermaLink="true">https://community.appdrag.com/post/663</guid><dc:creator><![CDATA[Joseph Benguira]]></dc:creator><pubDate>Mon, 06 Jul 2020 14:37:12 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 12:56:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/16">@Joseph-Benguira</a></p>
<p dir="auto">I'm failing to produce what I need, the field doesn't seem to be a foreign key with a reference as it claims to be, but just a text field with the array ID's.</p>
<p dir="auto">I'm guessing you have custom logic behind that, but I fail to know how to use the ID's other than as only static values.</p>
]]></description><link>https://community.appdrag.com/post/661</link><guid isPermaLink="true">https://community.appdrag.com/post/661</guid><dc:creator><![CDATA[ThomasD]]></dc:creator><pubDate>Mon, 06 Jul 2020 12:56:31 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 10:59:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/16">@Joseph-Benguira</a></p>
<p dir="auto">Yeah, I'm trying with the reference ID and a query to use GROUP_CONCAT and join and group to do it and use an index to keep it fast, should work well enough..</p>
<p dir="auto">I've only every used NoSQL my whole life, so MySQL is a bit of a challenge <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--wink" title=";-)" alt="😉" /></p>
<p dir="auto">About time I learned it though</p>
]]></description><link>https://community.appdrag.com/post/660</link><guid isPermaLink="true">https://community.appdrag.com/post/660</guid><dc:creator><![CDATA[ThomasD]]></dc:creator><pubDate>Mon, 06 Jul 2020 10:59:01 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 10:54:14 GMT]]></title><description><![CDATA[<p dir="auto">Ah I see, you can handle that in business logic when you rename through your UI a data to do the corresponding UPDATE in SQL ... or handle this at runtime with a dictionnary ... We can't return directly the merged structure because it would be a major hit to perf.<br />
Database do that 100x faster with JOIN in SQL.<br />
That way you can do a SQL query with JOIN that will return exactly that in JSON (and still storing by reference)</p>
<p dir="auto">It's always a tradeoff and you have to choose the best solution for your use case</p>
<p dir="auto">You can do basic things easily, you can also do advanced things with SQL or code<br />
but you can't do Advanced things without Code and without SQL</p>
]]></description><link>https://community.appdrag.com/post/659</link><guid isPermaLink="true">https://community.appdrag.com/post/659</guid><dc:creator><![CDATA[Joseph Benguira]]></dc:creator><pubDate>Mon, 06 Jul 2020 10:54:14 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 10:49:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/16">@Joseph-Benguira</a> That's what I did at first, but that breaks the link entirely when the data changes in the source table.</p>
]]></description><link>https://community.appdrag.com/post/658</link><guid isPermaLink="true">https://community.appdrag.com/post/658</guid><dc:creator><![CDATA[ThomasD]]></dc:creator><pubDate>Mon, 06 Jul 2020 10:49:09 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 10:47:43 GMT]]></title><description><![CDATA[<p dir="auto">Hey Thomas, just use Linked Fields by Value instead of By Reference and that's exactly what you will get <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--wink" title=";)" alt="😉" /></p>
]]></description><link>https://community.appdrag.com/post/657</link><guid isPermaLink="true">https://community.appdrag.com/post/657</guid><dc:creator><![CDATA[Joseph Benguira]]></dc:creator><pubDate>Mon, 06 Jul 2020 10:47:43 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 06:59:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/2">@wassim</a> Maybe I'm just over-complicating things, but I'm getting JSON like this:</p>
<pre><code class="language-json">{ "Table": [{
      "Published": 1,
      "Person_relation": ["1","2","3"]
  }, {
      "Published": 1,
      "Person_relation": ["1"]
  }, {
      "Published": 1,
      "Person_relation": ["1"]
  }]
}
</code></pre>
<p dir="auto">So I wanted the ID to be replaced with the name value from that table relation column in one query, so it would return this instead.</p>
<pre><code class="language-json">{ "Table": [{
      "Published": 1,
      "Person_relation": ["Mike", "Steven", "August"]
  }, {
      "Published": 1,
      "Person_relation": ["Mike"]
  }, {
      "Published": 1,
      "Person_relation": ["Mike"]
  }]
}
</code></pre>
<p dir="auto">I could of course do this in code, but I wanted to make it with SQL only if possible.</p>
]]></description><link>https://community.appdrag.com/post/651</link><guid isPermaLink="true">https://community.appdrag.com/post/651</guid><dc:creator><![CDATA[ThomasD]]></dc:creator><pubDate>Mon, 06 Jul 2020 06:59:09 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 06 Jul 2020 06:13:41 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/208">@ThomasD</a> I'm not sure about what you want to achieve.<br />
Can you provide an example with two tables and what you tried with a query?</p>
<p dir="auto">Just to let you know what is store in reference is the ID of the element in the referenced table. The fact that it is related to a column is just to display a specific field in the UI (and we use join to fetch them based on the id)</p>
]]></description><link>https://community.appdrag.com/post/649</link><guid isPermaLink="true">https://community.appdrag.com/post/649</guid><dc:creator><![CDATA[Wassim]]></dc:creator><pubDate>Mon, 06 Jul 2020 06:13:41 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Sun, 05 Jul 2020 21:55:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/2">@wassim</a> said in <a href="/post/254">Advanced SQL Field Types</a>:</p>
<blockquote>
<ul>
<li>Linked fields by reference will store a JSON Array of ids =&gt; <strong>["1","2"]</strong></li>
</ul>
</blockquote>
<blockquote>
<p dir="auto">If you use by reference, you will need to do join operations to get the linked element but you will always have the updated value.</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/2">@wassim</a><br />
I'm trying to use this, but I'm unable to figure out how to retrieve the referenced column name for the ID's in one query.</p>
<p dir="auto">Tried searching for how to do it, but I find nothing on foreign keys and references related to how to query in-place.</p>
<p dir="auto">Any help with this would be greatly appreciated!</p>
]]></description><link>https://community.appdrag.com/post/648</link><guid isPermaLink="true">https://community.appdrag.com/post/648</guid><dc:creator><![CDATA[ThomasD]]></dc:creator><pubDate>Sun, 05 Jul 2020 21:55:17 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Mon, 01 Jun 2020 08:27:30 GMT]]></title><description><![CDATA[<p dir="auto">Hello Daniel,</p>
<ul>
<li>Linked field by reference will store the id of the element in the selected table =&gt; <strong>1</strong></li>
<li>Linked fields by reference will store a JSON Array of ids =&gt; <strong>["1","2"]</strong></li>
<li>Linked field by value will store the value of the element in the selected table =&gt; <strong>'Jean'</strong></li>
<li>Linked fields by value will store a JSON Array of values =&gt; <strong>["Frederico","Jessica"]</strong></li>
</ul>
<p dir="auto">The main criteria to decide whether you use by reference or by value is if you want it to be static or updated at each modification.</p>
<p dir="auto">If you use by reference, you will need to do join operations to get the linked element but you will always have the updated value.</p>
<p dir="auto">If you use by value, you will directly have access to the value but if it changed in the other table, it won't change here. Another concern is that you will only have access to this field from the other table. When you use by reference you can select other fields as well.</p>
]]></description><link>https://community.appdrag.com/post/254</link><guid isPermaLink="true">https://community.appdrag.com/post/254</guid><dc:creator><![CDATA[Wassim]]></dc:creator><pubDate>Mon, 01 Jun 2020 08:27:30 GMT</pubDate></item><item><title><![CDATA[Reply to Advanced SQL Field Types on Sun, 31 May 2020 15:18:48 GMT]]></title><description><![CDATA[<p dir="auto">Update:<br />
It seems the linking of multiple fields puts them in some sort of array, but I'm not sure if that's a SQL native method, or if that's just for recovering those id's, etc. in node.js or something later.</p>
<p dir="auto">Linking by Value links by value... duh.</p>
<p dir="auto">Linking by reference links using the Primary Key of the linked table.</p>
]]></description><link>https://community.appdrag.com/post/250</link><guid isPermaLink="true">https://community.appdrag.com/post/250</guid><dc:creator><![CDATA[Daniel Mulroy]]></dc:creator><pubDate>Sun, 31 May 2020 15:18:48 GMT</pubDate></item></channel></rss>