Skip to content
Advertisement

Tag: sql

Can’t enable a foreign key in ORACLE SQL

So I have a disabled foreign key (Manager_ID in the table Employees) and I wanted to enable it, but I get this error: ORA-02298: cannot validate (my_username.EMP_MANAGER_FK) – parent keys not found And this is the code: Here’s how the table was created: Answer There are values in the column that are invalid from the foreign key’s perspective. Assuming that

How to force Postgres to calculate with numeric precision

I have a .net core application using dapper with Postgresql. Windows, PostgreSQL 12.0, compiled by Visual C++ build 1914, 64-bit When i do simple calculation in the select-statement, then i get different results if i do not provide fractions: 1258 1208 What’s the reason and what’s the best way to get correct numeric result? Answer Postgres, as many other databases

Order count per ID and calculate time between orders in BigQuery

I am working with customer purchase data and am trying to write a query in Google BigQuery that sorts all purchases by date and adds a purchase/order count per customer (order_count). Also, I would like to calculate a time-delay (in days) between the orders of one customer (purchase_latency). My query currently looks like this: The result including “order_count” and “purchase_latency”

mysql – Search for a key within inconsistent json structure

I know of the functions such as: JSON_SEARCH() and JSON_EXTRACT() etc. This issue is that I am searching for a key in a json string that is not standardized. for example: and the results could be something like this: so in this example I want to get john doe with the acctNum of 123. but, also, the location of the

Dynamic columns from two tables

i need some help. I would like to combine two tables in sql with dynamical columns. Here my thoughts: Table one: Example Table jrincidents Table two: Example Table jrusers reporting like i don’t know how to dynamically add the steplabels from table jrincidents as columns of jrusers if where processname = x Thanks for helping ADD: Let me try again

Advertisement