Skip to content

Finding Duplicates in SQL

I’m trying to find duplicates in a non-traditional scenario: Sample Table: id1 | id2 —–+—– ABC | DEF DEF | ABC I only want to retain one of these rows, as these ids show a connection to …

MySQL Error – Cannot add foreign key constraint

I know this question has been asked several times but it seemed like the problem was due to different data types between parent and child rows. In my case, the data types are the same but I’m still getting the error. Here’s my code Where DORM_COSTS’ foreign key cannot be added. Thanks! Answe…

MySQL return total COUNT of each value in a column

I have a table of jobseekers with three columns Each jobseeker could have different hiring status for each employer depending on the interview. Now I want to return the COUNT of each total HIRING STATUS But it should only count the jobseeker’s highest hiring status. Say that John was ranked as QUALIFIED…

Select closest maximal numeric value in Firebird

Imagine there’re 2 tables, let’s call them “Master” and “Detail”: There’re 2 input parameters: list of Master IDs (master_id_list) and numeric value (num_value). For every ID in master_id_list I should get one Detail record: If num_value < MIN( f_value ), it should…

table in database rows

I have a table People, having people_id,people_name,people_lastname. I am facing difficulties creating a pl/sql function to display all the rows of that table. I have done this much so far Answer One option is to return refcursor: