We're creating GeoPackage to use in QField. In the Attributes Form we have a Category-field where you can choose a value from a look-up table (layer). And a separate field for Sub-Category, which is conditional on the chosen Category-field. So that you can only choose Sub-Category-values that are allowed and belonging to the given Category. This is achieved using the 'Filter expression'-field stating that:
"Category" = current_value('Category').
All of this has previously been built manually. We are now looking into creating the tables and their relationships using SQL-script. But how can we obtain similar functionality as above with an SQL-script?