I am a Business Analyst and have prepared tables/erd for a system we are implementing. The context is essentially an employee management system, an employee can join the company, change positions, get promoted, demoted, terminated etc. All of this is required to be tracked for filtering and reporting purposes…
Executing a SQL query with C#
I would like to add some information to my database. I searched for some tutorials, but none of them work. NonQuery can do what he needs to do, because the messagebox returns “Success” (1). But it does not update my database. If I put the same query to “Add New Query”, directly to my d…
Find name of manager with max number of subordinates
I need to write SQL query (for Oracle) which displays name of manager with max number of subordinates. Table’s structure: MGR_ID employees’ attribute is an EMPNO(primary key) of manager. What I’ve tried so far: Answer Another version suggested by a_horse_with_no_name PS : Query Not Tested
After update Trigger firing, when there’s an EXISTS clause to prevent the update
My app is throwing an exception on an “after update” trigger in the database when the following query is run against a record that contains an email address that already exists on another user. In other words, the record hasn’t been updated, but should have been ignored because of the EXISTS…
Symfony doctrine orderby and group by (distinct)
I am trying to get the latest booked courses (unique). I have tried the following with the Doctrine querybuilder: Without the orderby it works but it will traverse the bookings ascending. I need the latest booked courses. With this query I am getting this error: SQLSTATE[42000]: Syntax error or access violati…
How can I refactor the below code to make it faster?
This code is developed by my colleague, and it is really slow. I don’t want to create any temp table. How can I make this query faster? Answer
Limit SQL Primary Key to certain ranges
I want to make the autoincrementing Primary Key of my table to only be in the ranges 1-12, 101-112, 201-212, etc. This is because I have a series of repeating items that are 12 in a set and then you get another set, having them indexed in this way by the Primary Kay would be most easy, I think. Is
Register temp table in dataframe not working
Below is my script to use sql in dataframe with python: df.show(5) shows result below: then I register the dataframe to a temp table: and tried to run some sql query like below: It doesn’t produce expected result, instead: I also tried: and it gives me: So it seems the registerTempTable method only crea…
JPA: @OneToMany(fetch = FetchType.EAGER), pagination and duplicates
I use eclipselink as a JPA provider. I have an entity Article which has many Authors (this field is marked @OneToMany(fetch = FetchType.EAGER)). Article and authors are loaded together using only one …
Count on case Oracle
WE have below data in oracle database – I want count on column two in such a way that – Ouput – Best Regards Answer Thanks Guys. But I could do this way – Thanks for your replies