Relative Content

Tag Archive for sqloracle-database

Combine this two-table data in a single result from two different tables

trusted_device_details
|DEVICE_TYPE|DEVICE_NAME| DEVICE_ID | Created Date Time | Last Accessed Date Time | IP_ADDRESS | USER_ID | CLIENT_CODE | RANK_NUMBER
|———–|———–| ———- | —————– | ———————– | ———– | ——–| ————| ————
|MOBIL APP |IPHONE 6S | 4455555 | 8-Dec-24 | 12/8/2024 16:01 | 10.1.1.1 | XXX1 | 55111444 | 1
|MOBIL APP |IPHONE 15 | 52344444 | 8-Dec-24 | 12/8/2024 16:01 | 10.1.1.6 | XXX1 | 55111444 | 1
|MOBIL APP |Ipad | 788995544 | 9-Nov-24 | 12/6/2025 16:01 | 10.1.1.1 | XXX1 | 55111444 | 1

One-to-many relationship check in Oracle

Is there a beautiful simple solution how to check if two tables have one-to-many relationship between each other using only their names as parameters? I’ve seen solutions with joining tables on specific fields but can I do it without knowing what foreign keys my tables have? (Or possibly get it from system tables like user_tab_columns etc.)

One-to-many relationship check in Oracle

Is there a beautiful simple solution how to check if two tables have one-to-many relationship between each other using only their names as parameters? I’ve seen solutions with joining tables on specific fields but can I do it without knowing what foreign keys my tables have? (Or possibly get it from system tables like user_tab_columns etc.)

Query to Count Records in a 1-Hour Sliding Window

I have a table where each record represents a transaction by a user. I need to find out if any user has inserted 1000 or more records within a 1 hour time window on a specific date. For example, if a user inserts more than 1000 records between 12:15 PM to 01:15 PM, I want to capture that information.

Query to Count Records in a 1-Hour Sliding Window

I have a table where each record represents a transaction by a user. I need to find out if any user has inserted 1000 or more records within a 1 hour time window on a specific date. For example, if a user inserts more than 1000 records between 12:15 PM to 01:15 PM, I want to capture that information.

Get duty time and accumulated working hours using SQL query

Need to get duty time and accumulated working hours.
Have two tables employee and working hours.
calculate duty time as work_end_date_time – work_start_date_time and
calculate accumulated hours by adding duty_hour based on input date passed