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 …
SQL: Find out the expense that each customer has made through card and cash
I have three tables: transactions customers credit card Here, If you look at the transaction table entries, entries with the same tran_id are for transactions done by the same customer. …
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…
Is there a way to split text from cell into multiple records in SQL using line break delimiter?
I have a system generated report that exports all expense reports for a given period. All employees attached to the report are exported in one field “Attendees”, separating multiple employees with line breaks. I would like to break the cell into multiple records, still including the expense report…
Pivot table without crosstab/tablefunc
I have a table like this INPUT I want to be able to pivot this table in the following manner OUTPUT All the articles that I can find online pivot tables based on a second column. My ultimate goal is to get one records per ID. FINAL OUTPUT Here the values of the size, python, cpp, non-code columns are aggregat…
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…
Translate date ranges to date sequences in BigQuery
I have table 1 that looks like the following: +———–+————+————+ | campaign | start_date | end_date | +———–+————+————+ | campaign1 | 2020-01-01 | 2020-…
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:
Count number of days from a date then convert that count to a date-time?
I want to count the number of days from a date from a date-time column, let’s say one of the value is ’10/31/2018′ and I want to count up to 30 days. So in perspective it would look like ’11/30/2018′ …