There is a procedure in the Oracle DB which takes a date range and generates XML file for each day and the return type is ref cursor. When the procedure is called from C# code, I am unable to extract the XML from the cursor. Any pointers will be helpful on how to extract the XML Below given is the
SQL- Get results based on four dependable tables with relations
I am trying to write sql query for a problem I am facing, but I can not get my head around it. I have team_member table with team_id and member_id. role table that stores roles with team_id (..name, slug) team_member_role table that is a many-to-many relationship between team_member and role (contains team_me…
Query records in one table that exists in either of two columns in another table
I have two tables. One with user info, one with payment info. I would like to find out users that are either the sender or the receiver of a payment. Eample data: user id other columns 1 2 3 payments: sender receiver other columns 1 4 1 3 5 3 4 5 ideal output id 1 3 what I tried:
How to select a column from the output of ‘SHOW COLUMNS’ sql
I am using the sql command SHOW COLUMNS in this way It outputs multiple columns, specifically one called ‘COLUMN_NAME’ that I would like to select. I tried doing which gives an error, is there another way I can just show one of the columns of the output? Is this because the output is not a table s…
How to create a trigger which will auto create sequence ID
I have been trying to implement the logic. But as only basic knowledge on SQL. I have a below following table I have following data in it I need to write some trigger as soon as the insert is performed depending upon createddate a sequence should be automatically inserted to sequence column for respective rec…
SQL – an alias was previously found when using over() in old mysql version
A sql query didn’t work in old version of mysql below 8: It gives this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘() AS FULLCOUNT FROM T’ at line 1 You can refer to this DBFiddle: https://dbfid…
Is there a way to calculate difference whthin a specific time range using clickhouse MV?
For example, this is my source table What I want to do is to create a MV which asynchronously calculate the price difference whthin 30 min. And then, I can get the difference from this MV using an id every time. Here is an SQL example. It works correctly while directly execute it, but does not work while crea…
How to fetch required data using single query in sql developer
I have a subject table that has subject_id column. In the table I have one row that has subject_id null other than that subject_id has a distinct value. I am looking for single query I can fetch the data on basis of subject_id. If there is no data found w.r.t x than it should return the row with subject_id =
Hive SQL – time interval in 5 minutes
My data is too large to analyze since it is collecting every second or so. To reduce the data, I will like to group into interval of 5 minutes. I tried converting into unix timestamp and reverting it back, but didn’t work. I tried something like this Original data or output Desired output Answer I don&#…
Select all ID’s that have overlapping timestamp values
Given this table, I’m trying to select all of ids that have an overlapping start_time and end_time grouped by ID. In this case, the table has multiple Ids that may or may not have multiple entries. (In this case, id’s 1 and 2 don’t have multiple rows, whereas 0 does.) Is there a way to retri…