I am trying to get the last number from a Oracle SQL column called Description and store it in another column called Thickness. As you see, the length of the description varies as well as the length of the number at the very end. It is sometimes a double such as 1.5, sometimes an integer like 3. I have tried
Writing a sub-query using a date clause
So basically I’m trying to write something that prints the customer’s name and area code if they have made a booking within the last 6 months of the current date. My code looks like this (it has to be a subquery, not using join) Yet it doesn’t work, but I can get it to work using a join func…
How to copy CSV into table with missing column?
I want to import data from a csv file into redshift. CSV format: Here is my import command: The problem I have is that sometimes, my file has only col1, col2 and col3. Is it possible to execute the COPY and add null for the missing values? Answer Yes, but must be explicit about it: The missing col2 will be
Conceptual explanation: why COUNT() syntax doesn’t work on SQLZoo JOIN Lesson Challenge 13?
I’ve got solutions here in stack overflow for SQLZoo Join Lesson Challenge 13 problem link: https://sqlzoo.net/wiki/The_JOIN_operation solution link: SQLzoo JOIN tutorial #13 But, before to use the solution that I found here, I was trying: But the answer is always wrong. I have a spreadsheet where I put…
Using left join to query and match JSON field in MySQL
Table A,field : pay_type_fk,type:json, Examples Data: [1,2,4] Table B,field : id type : bigint Examples Data: primary key SQL I use: Only pay can be found_ For the first record in the type table, I think we can query all of them with group_ CONCAT Answer If I follow you correctly, you can join on JSON_CONTAIN…
How to calculate total time from date column in Oracle
I have a table where i have some log like this. and output is like below But I want to have one more column which will give me total time like below I have tried to minus both time but not getting proper result. The output i am getting is below Answer Don’t convert the dates to strings. That makes
MySQL query to update players weekly ranking positions with large dataset [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I’m trying to update weekly ranking scores for players, but any query I have tried jus…
Feature from workbench maybe?
I’m trying to create a table in workbench, and I don’t know why theses names can be set up. It ask me to change it. Maybe it concern features that I would like to disable. release , user appear in blue like a special command. Answer A column name is an identifier, and those can’t include unl…
Set two decimal places after AVG function inside PIVOT
The output keeps being 95.000000 I tried using AVG( CAST(Grades AS Decimal(10,2) ) ) inside the pivot, and it keeps returning a syntax error about (. Tried using CAST AS DECIMAL inside the FROM subquery, but it just keeps putting the same 00000 output. CAST AS FLOAT works but I need two decimal places and it …
IS NULL check not working on list in JPA SQL Query
I have following JPA Query with a where clause: @Query(“SELECT P FROM ParentEntity P n” + “INNER JOIN P.childEntities C n” + “WHERE C.childId IN (:childIds)”) List<…