Skip to content
Advertisement

Tag: string

how to use wildcard for a column jsonb type

I have a table (named profile) in my Postgres database, which has 3 columns: ID, Day, Ftfm_profile of type jsonb, I tried to extract the row where the profile name (ftfm_profile->’name’) begins with ‘LFBB’ ( sql: LFBB%) using the wildcard as following: the expected result: I can’t seem to find the solution, thanks for your help Answer One option unnests

Get rows which contain exactly one special character

I have a SQL query which returns some rows having the below format: How can i filter to get rows which only have the format of ‘DB_host’ (place a condition to return values with only one occurrence of ‘_’) i tried using [0-9a-zA-Z_0-9a-zA-Z], but seems like its not right. Please suggest. Answer One option would be using REGEXP_COUNT and at

SQLite Incomplete Time String

I have a table with incomplete time strings, such as ‘0:09.735’ (minutes:seconds.milliseconds). As the function strftime expects certain formats, such as ‘%H:%M:%f’, I have “to complete” the incomplete timestring first. The first strftime function with the complete timestring shows the correct result, the second, third, and fourth one with the incomplete timestring do not. Is there a flexible way that

SQL Merge the row into new column

I have a table named Addresses. The columns are: There is no data in Property as of yet as I will update it manually later. The rest of the columns does hold data though. However I need to merge Road, Town, Borough, District and Postcode into a new column named Full Address. So for example If you can see the

SQL new table with conditions

I have a table and I want through sql to parse it into another table. The problem is that there is a condition: There are 3 columns in old version And I want to store them into new table’s column like : Thanks in advance. Answer You can use case expressions and string concatenation, like so: This uses standard string

Advertisement