In mysql, I am trying to copy the data from one column to other column of different table. I have used the below command to achieve this. data in old column is data:test data in new column should be {“payload”:”data:test”} As of now when I used the above insert command, it just copies the data as is from old column,
Tag: sql
Can a CLOB column containing objects be sorted?
I have a column type CLOB that stores an array of objects containing the following structure: {“id”: number, “name”: string} Then suppose we have the following column of CLOB records: [{“id”: 21, “nombre”: “fisica”}, {“id”: 16, “nombre”: “auditiva”}] [{“id”: 16, “nombre”: “auditiva”}] [{“id”: 4, “nombre”: “intelectual”}, {“id”: 21, “nombre”: “fisica”}] and so several records that its array in the CLOB
Gap-and-island for more than time threshold
I have these tables: I want to investigate sessions of a user having time time difference between successive rows greater than 5 minutes, reporting: session and session mode number of sessions with the gap-and-island problem. My attempt: Error: Expected results: Note: dbfiddle. Answer The problem is we have two user_id and they’re not defined so you need to specifically choose
How to escape single quotes in Firebird 2.5 in where clause of select statement
How do I get this to work? Answer To escape an apostrophe you need to double it see manual
Query: generated start_date and end_date where it isn’t exist in the table
i want to ask something, so i have a table A that have start_date and end_date column to store the data when there is a failure happened, it look like this rows start_date end_date 1 “2021-08-01 00:04:00” “2021-08-01 02:54:00” 2 “2021-08-01 04:52:00” “2021-08-01 05:32:00” And what i want to do is to have a query so that the response will
Distinct performance in Redshift
I am trying to populate a multiple dimension tables from single Base table. Sample Base Table: Required Dimension tables : emp_name_dim with values – AAA,BBB,CCC emp_surname_dim with values – ZZZ,XXX country_dim with values – USA,IND,CAN dept_dim with values – CE,IT,MECH university_dim with values – U_01,U_02 Now to populate above dimension tables from base table, I am thinking of 2 approaches
Parsing out inconsistent data to grab specific year
I have a TableA with a column Years. Each row value in this column is formatted as a mix of: and The number of years listed in each row varies (could be 1, could be 10). I have a task to pull the latest year for each row. I am not even sure where to start on this, so I
Postgres SQL to convert first letter after Mc to upper case
I have data in Postgres SQL, something like this I am trying to convert first letter after Mc to uppercase , something as below I am using initcap function as below, but its not working as expected Appreciate any help! Answer Use above query it will give desired results.
How to SUM values from 2 separate tables that share the same column name in SQL
I have 2 tables that have the exact same columns but different data. The columns are ‘name’, ‘gender’ and ‘count’. The first table is called names_2014 and the second names_2015. My goal is simply to find the top 5 most popular names amongst both these tables. I know that to get the most popular names for one table is: However,
Is it possible to have a nested where and and clause in oracle sql?
I’ve tried search for this and I’m not sure I’m using the correct terminology, but is it possible to have a nested WHERE AND clause?: So the nested AND would “and (age != 18 and hair_colour != black)” so you could have: first_name = ‘Jay’ evaluate to true last_name = ‘McDonald’ evaluate to true (age = 18 and hair_colour =