Category "sql"

SQL Switch/Case in 'where' clause with and

I currently have this query DECLARE @user uniqueidentifier , @day_to_find int , @date DATETIME = getdate() SELECT @user = CAST(Value AS uniqueidentifier) F

Oracle NVL invalid number

I have two Oracle 12c (12.1.0.2.0) databases, one of which returns 'ok' for the following query (using SQL Developer 3.2.20.10), whereas the other results in OR

expression not in aggregate or GROUP BY columns

I have a table that contains the following columns: ProductID, ProductName, Price, CategoryID. The goal is to print all the details (ProductID, ProductName, Pri

BigQuery SQL JSON Returning additional rows when current row contains multiple values

I have a table that looks like this keyA | data:{"value":false}} keyB | data:{"value":3}} keyC | data:{"value":{"paid":10,"unpaid"

SQL Select everything after character

I'd like to select everything AFTER a certain character (-) that is placed on the most right side. Eg. abcd-efgh-XXXX And I'd like to select the XXXX part

Find first record of multiple values in single query

Table timestamp | tracker_id | position ----------------------------------+------------+---------- 2020-02-01 21:53:45.571429+05:30 |

write a query to this..?

Students and Grades. Students contains three columns ID, Name and Marks, Grades-(grade,min_mark,max_mark) Ketty gives Eve a task to generate a report containin

Alphabetic ranking a list with set of 'WITH TIES - ORDER BY (multiple fields)

A regular usage of "WITH TIES" & the result of the query : Demand: The best of 10 movies as Oscar Wins SELECT TOP 10 WITH TIES F.FilmName AS TITLE,

Column showing revenue increasing cumulatively, then only repeats the max value after a certain date

I'm creating a dashboard that, among other things, shows how much revenue a rep generated in their first month of joining the company. This is going to be base

SQL:How use analytic function on multiple columns in Oracle?

I need to statistics multiple columns,the following is my writing: with t_suml1 as(select id, date, sum(list1) result from table group by id,date), t_avgl

SQLITE PIVOT TABLE WITH COUNT

Can you help me plase ? I want a result like the table below with Sqlite . task_name status_code department 1 A START PUR 2 B START ENG 3 C FINISH ENG 4 D NOT

Trouble with formatting date prompt in Cognos Report Studio Version 10.2.1

I'm having trouble with an error that says: UDA-SQL-0144 An arithmetic exception was detected.[IBM][CLI Driver][DB2/NT64] SQL20448N "1993" cannot be interprete

Impala - Check if a string is a number

Is there any way to check if a string is a number in Impala? like is_numeric is SQL?

Group by age ranges in MySQL

We have a date of birth field(type date) and user_id in the table and we want to get count of users group by age based on the date of birth field For e.g. afte

want to get country area code from phone number present in mysql db

I'm having phone number 1212010089 and want to know from which country I'm getting this number.I do have a table_1 which is having column1 area_codewhere lots o

ORA-01410 - Invalid ROWID while trying to UPDATE/DELETE in Oracle APEX

I'm currently creating an app in Oracle APEX and for some unknown to me reason while trying perform UPDATE/DELETE action by clicking on 'edit' button in the rep

Group by age ranges in MySQL

We have a date of birth field(type date) and user_id in the table and we want to get count of users group by age based on the date of birth field For e.g. afte

Relacing a word in an db2 sql file causes DSNC105I : End of file reached while reading the command error

I have a dynamic sql file in which name of TBCREATOR changes as given in a parameter. I use a simple python script to change the TBCREATOR=<variable here>

union all in SQL (Postgres) mess the order

I have a query which is order by date , there is the query I have simplified it a bit but basically is : select * from (select start_date, to_char(end_date,

Get day number when all I have is day of the week

I was interested in MT0's answer on this question using intervals and dates. I was working through trying to find a different way to answer the question and I s