Defining good and better ways of extracting information from an SQL base is a field of investigation in itself, however there are some peculiarities in the structure of Unidatab, that make it unexpected to people used to classical SQL databases. What kinds of output can we then expect from Unidatab? In this post we are going to explore few ways of getting information from a database with the help of unidSql functions.
SQL is a powerful language which Unidatab extends by more than fifty functions for its specific purpose. Thus describing the better ways to retrieve information in this context would come to analyze the limitations and advantages brought to SQL in Unidatab. The help of expert programmers or analysts is surely needed here if Unidatab is worth reaching one day a standard in code production. Information retrieval requires alike professional expertise. We’re only going to mention here some elementary features and queries, aware that Unidatab changes common SQL cross-queries into multisteps queries, harder to define and slower to execute, and aware that often, cleaner and faster solutions could be found with more science and cleverness.
Besides, the set of information retrieval queries proposed by Unidatab is basic and each database should perhaps develop its own set of unidSql queries, depending on the needed information – this is where scripted interfaces like Unidatab.cgi become attractive.
SQL objects live in tables, while Unidatab objects live in views. As table ‘node’ was a mess to the human eye, Unidatab provided views to extract its objects. ‘subdbs’, ‘records’, ‘titles’, ‘types, ‘properties’, ‘formats’, ‘symbols’, ‘flyers’ and ‘junks’ are views, i.e. recorded SQL queries. We’ll restrict ourselves here to show some other, less obvious queries.
Here are some symbols who contain the id of a record as property and pure data as type :
? select * from symreprodatyp limit 2 i typ a pro n d t u: -201 #Unid note subdb record 62 -192 -192 0 1473431570 admin -199 #Unid default set 55 -171 -171 0 1473431570 admin
To get all the records which contain a certain type of property, say ‘description’:
? select lnk, find_record(lnk) from unid_links where a in (select i from unid_symbols where typ like 'description') limit 2 lnk find_record(lnk) : -194 -192 -189 -187
In this query, the ‘lnk’ value is the id of a link ; as each link pertains only to one record, it was easy to define a function find_record() to recover the record id.
Information retrieval mechanisms go on like this in Unidatab and require expertise in SQL as well as with Unidatab itself.