I’ve been practicing with Oracle SQL Developer for some time using school assignments and encountered some kind of dilemma while doing the Entity Relationship Diagram for one of those, here’s my issue: On the assignment they mention that there’s a CLIENT entity with certain attributes, and i…
Why does “Enter parameter value” appears using INSERT INTO VALUES?
I’m always getting the “enter parameter value error” when I try to run this code. The error refers to idPat, idSP, idPar and measure_value. I have checked with the debug idPar, idPat, idSP and measure_value and they assume the correct value; the errors comes out when I run sql. Answer Your V…
Postgresql query to filter latest data based on 2 columns
Table Structure First users table id 1 2 3 sites table id 1 2 site_memberships table site_id user_id created_on 1 1 1 1 1 2 1 1 3 2 1 1 2 1 2 1 2 2 1 2 3 Assuming higher the created_on number, latest the record Expected Output site_id user_id created_on 1 1 3 2 1 2 1
Query with group by with CustID and amounts daily and MTD
I have the following data: ID username Cost time 1 test1 1 2021-05-22 11:48:36.000 2 test2 2 2021-05-20 12:55:22.000 3 test3 5 2021-05-21 00:00:0-0.000 I would like to count the costs for the username with a daily figure and a month to date figure in once table I have got the following This will return the mo…
Highest Mark in each course with student name
I want to get the highest mark in each course with the title of that course and student name who toke that course exam. and i have these tables , first one students id name 1 Jhon Doe 2 Sarah Doe and Courses table id title 1 Math 2 history and i made a table for connecting students with courses
“IS NOT NULL” not producing the required results in mySQL
I am trying to build a report based of my table. Here is my table: Following is the SQL query to get desired results. I am looking to exclude entries which have all null values and following is my syntax but it is not working and produces the same results. Kindly help here or share a post that can help.
Updating SQL Variable
I’m attempting to create a variable that will hold a value, which I will then later use to select from a table using the variable value. This works perfectly the first time around, but any time I try and change the parameters to update the variable it returns blank. Am I able to use the same variable wi…
How to combine data from different variables together in SQL?
Let’s say I have data like this: All I want to do is collect the most recent non-null value from each column and condense them into a table with each row being an entry. Final result: Here’s what I have but it’s not complete: Answer Related: Equivalent for Keep in Snowflake: It could be achi…
Cumulative sum of a column
I have a table that has the below data. I wrote a query that will calculate the sum of cumulative rows and got the below output . Now I want to to filter the data and take only where the POOL <=300, if the POOL field does not have the value 300 then I should take the first value after
insert value from join with If/Case from two tables, into a third table
So I have the following issue in creating a sql query. A linked server so am using an open query. (edit update: SQL Server) Two tables as per picture below: I need to insert value into a third table, the value to insert to the third table comes from the two tables above which I join via KEY ID. However,