I’d like to split the result from a query and display the values in separate columns. As an example I get the following result I want to split the values by ‘_’ and add them to separate columns. The query result should look something like this So far I can split the result. But for each value, I have a
Tag: string
Eliminate double quotes from a json field in a selective manner in PostgreSQL
I’m a new user of a PostgreSQL database with a json field which causes me some trouble. In fact, string values have been inserted into this json filed with double quote when they are supposed to be numerical values. I have a field named “test_json” which is composed of for example these 2 rows: I would like the 2 lines
When selecting data with DATE_FORMAT() is not getting proper values MySQL
I’m having a table structure as below. insert statements : when i select with below query I’m not getting the proper out. Output : I need a data where dt values are less than 90 Days. Can anyone suggest where to make changes. Answer You are overcomplicating things here I think. Basically you are turning the dates to strings in
SQL Data cleaning
I have a data set where I am trying to clean data. I want to remove the ** from email-address and phone_number and have just numbers in the phone_number column. how can i do it. Answer Here is one option using string functions: This removes ‘**’ from email, and all non-digit characters from phone_number.
If ID has both values A and B it should return AB
INPUT: ID VALUES 1 A 1 B 2 A 3 B OUTPUT: ID VALUES 1 AB 1 AB 2 A 3 B If ID has both values A and B it should return AB.
Complex SQL query aggregation and grouping on athena
I have a table like this: I would like to retrieve the number of chat performed by users for each database (db) and the last part where I fail, retrieve also a list of all mentors by users. The final output should be like this for example (notice there is only one time max for greg in the admin column)
Group by portion of field
I have a field in a PostgreSQL table, name, with this format: JOHN^DOE BILLY^SMITH FIRL^GREGOIRE NOEL^JOHN and so on. The format is LASTNAME^FIRSTNAME. The table has ID, name, birthdate and sex …
Sql pattern in like condition
Simple issue : I have fields (path) like : I want to be able to get the path containing 43/XX Meanings here the only valid one would be This seems not to be working Answer Only SQL Server supports using (a small subset of) regular expressions with LIKE. In MySQL, you would use RLIKE, or REGEXP (both are synonyms). Your
How to check json format in SQL?
I have a table with a column of type Nvarchar where json is stored. But the format of some of its columns is wrong. So I get an error when I parse them all. I want my query to ignore lines that have errors. It gives this error when I run on all lines: JSON text is not properly formatted.
Using like or ilike to create SQL/ PLpgSQL function
I am trying to create function Animals (for convenience purpose) that takes first letter of an animal name and returns the whole name of the animal from the list e.g. C=> Cow, Cat… The problem I am facing is that the string after the like function is being treated as a string (I want it to be input). The following