I am a CS student that is taking his first course in databases so here I am using Postgresql to create a database with the following tables: employee, project, and worksOn. So if you run the program you can see that both the employee and project table are created. However, worksOn is not because it gives me t…
How to fill irregularly missing values with linear interepolation in BigQuery?
I have data which has missing values irregulaly, and I’d like to convert it with a certain interval with liner interpolation using BigQuery Standard SQL. Specifically, I have data like this: # data is …
SQL syntax query order by
SELECT TCID, START_TIME, RESULT, cast(START_TIME as date) as m_date, max(cast(START_TIME as time)) as max_time FROM jenkins_result.JENKINS_RESULT WHERE TCID = ‘A330506’ GROUP BY TCID, …
Model hierarchy in Django [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question Sorry for the long text Models are given: User Hierarchy class Hierarchy (…
SQL Server find rows approaching a service day and month
I have a table which lists equipment with an installation date. These items need to be serviced annually or every five years. So the rows have a service interval of 1 or 5. Something like: What I need to do is return a list of equipment two months before they are due for service For simplicity Let’s ass…
Capture values from a table and declare as a local variable in SQL Function
I’m learning how to write functions in SQL and this might be simple but can’t seem to find what I’m looking for. I have a function as follows: CREATE OR REPLACE FUNCTION A.aggregate(r_id text) …
How to join two tables to get combined result
I am trying to write a query, where I am retrieving employee data, fname, salary and unit no., where fname is ‘Khalid’ and his department name should be either ‘IT’ or ‘Development’. I am writing the …
How to return a key value ONLY if ALL the foreign keys in another table have a certain status (ORACLE)
How do I return the key (not a primary key): bwb_procesinstantie_id of the table wachtbox ONLY if ALL ‘foreign key’ values in the related table status have the status = “B” Functionality: A process contains several rel_code. But the process can only be further processed if all the rel_…
Hierarchical SQL query to Athena
I’m trying to create a query in Athena that solves this problem: I have records that look like this which create a hierarchical structure, like a tree but with indeterminate children. I have more than one root, that is, more than one element that is not children of anyone. I want to get the complete str…
How can I echo the position number of SQL row in PHP?
Before you misread the title… I’m not asking how to echo the number of rows, I’m simply looking to find the position that the row is in. Let’s say we have five total rows: Now I’d like to get the position of the row that contains the post ID of 718. From looking at the data, we c…