Skip to content
Advertisement

Tag: sql

Returning multiple XML from ref cursor oracle

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_member_id and role_id). role_ability table, which stores role_id. (..action,

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 record. Expected output : The sequence

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://dbfiddle.uk/?rdbms=mysql_5.7&fiddle=7dd651e5b2c988a7a85c76a2c83df066 to test the query

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’t know Hive, but make

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 retrieve all Ids that have

Advertisement