How to pass pre-defined set of comma separated values in a query parameter in raml? - mule

There are four values: a,b,c,d and the query parameter "X" can be a combination of the four values. Eg - "X": a,b,c,d or "X": a,b,c etc.

RAML doesn't has a way to validate that. You could use a regular expression in the type definition of the pattern.

RAML query parameters with array type must allow multiple values like so: ?x=a&x=b&x=c. You can provide a string type that validates the comma delimited expression, and it will be tough to make sure you have a list of unique enumerated values.

Related

PostgreSQL is it possible to parameterize the table name used in a query?

In PostgreSQL, is it possible to parameterize the table name used in a query?
Think of parameters as a replacement for scalar values only. Use one parameter in the place where you could use one string literal or numeric literal.
You cannot use parameters for other parts of an SQL query:
Identifiers like table names, column names, etc.
SQL keywords
Expressions
Lists of values, such as in an IN (...) predicate. Each value in the list would need an individual parameter.
All those parts of the SQL query must be fixed by the time the query is parsed during prepare(). If a client library supports "parameters" for identifiers, it's really doing string-interpolation into the SQL query before the query is parsed.

How to extract a value from JSON column with MariaDB, being this not an exact value in the JSON field?

I need to extract a field from a JSON string with MariaDB and search for specific patterns in that field.
This field is just a property of all the properties the JSON object has. I had read the documentation and I saw the JSON_EXTRACT function. I am still a newbie with databases so I would like some help in this matter.
{"user_id":"1","status_id":"1","text":"Hello, world"}
Lets say I want to get all the "text" values that have the "world" in the database table. I can extract with JSON_EXTRACT. But I want patterns, not absolute values.
How can I do that?
You can extract the value with json_extract(), and then do pattern matching with like:
select t.*
from mytable t
where json_extract(my_json_col, '$.text') like '%world%'

Convert a comma separated string into differents rows in a single query in InfluxDB

I have a table in InfluxDB which, for optimization, contains a field that can either come only as it would be for example "FR204" or it can come in a string concatenated by commas as would be the case with "FR204, FR301".
The fact is that I would like to be able to do exactly what is reflected in this case: https://rstopup.com/convertir-una-cadena-separada-por-comas-en-cada-una-de-las-filas.html
Is it possible to do this in InfluxDB? Thanks.

I don't understand how the Like operator works on non-string data types in Access?

I am reading conflicting explanations of the Like operator.
I understand that this is a String operator that compares two string expressions. By that definition, should it not only work on fields with text data types, and not on numeric or date/time fields?
However, when I test the Like operator in a query (in Query Design view), it is able to compare non-string data types. This is confusing.
Can someone please explain if this is a string operator or not?
This is OT here. However, the answer is very simple:
When applying Like to a field or variable that is not text, its value will first be casted to localised text - like what you would see if you from CStr(SomeValue).
Thus, here where the decimal separator is comma, this will filter out all values for a decimal field:
Like "*.*"
and this will filter out all integer values:
Like "*,*"

Determine if substring corresponds to specific code (character types) in SQL

I have a collection of strings and want to filter out those where the last four characters are: (alpha)(alpha)(number)(number).
I know I can make a substring of each of these and separately, but what is the method to determine the types of the characters in the sequence?
This is for SQL in Hive.
You can use regular expressions. Something like:
where col regexp '[a-zA-Z]{2}[0-9]{2}$'