I’m using mysql 8.0 and the table I have has a lot of rows so the solutions from this link take too long to run. Table example: ID Name Value Category 1 a 5 alpha 2 b 7 beta 3 c 8 alpha 4 d 10 beta I would like to group it by category and then select the max
Tag: sql
How do I get the data extracted from API to my database
I am currently working on a project to build a database on professor’s research paper database. This is my first time building a database(never had experience with MYSQL) and I am learning as I am doing it. I was able to use an api to get the data, for example: {“authorId”: “1773022…
force query to return duplicate values sql oracle
i have a simple query so when this query runs and returns output it only shows 3 rows but i want the output to be repeated like below is there a way i can achieve this Answer Pass in a collection rather than using an IN filter: Which, for the sample data: Outputs: NO SURNAME GENDER 123 m m 456
Difference between count(*) and count(true) in sql?
what is the difference between the select count(*) and select count(true)? so is there any different between the count(*) and count(true) which one should I use? can you give me situation example for each one that is better option to choose? Answer The result of both is the same, but count(*) is slightly fast…
SQL or function
In SQl its common to take the SUM of all values from a column Can the same thing be done but instead of summing each value in an attribute, each value is “OR’d” together? This would only work if the attribute was boolean of course Answer MAX(booleancolumn) will return OR’d together. (S…
VBA SQL Intersect replacement for datasets from the same table. (MS Access)
I believe ‘Intersect’ is the solution to my problem, but implementing it in VBA is throwing me.. I have two tables: Items, for our purposes a single column of [ItemNumber] ItemProperties, 2 columns [ItemNumber],[ItemProperty] Each item as at least (no less then) 2 properties [ItemProperty] and as …
SQL for finding multiple column matches (dups)
I’m trying to write a query to find all rows that have three columns in common with other rows. Imagine a person can only send one letter to another per day and I need to identify “dups” even though all of the columns may not be the same. I want to see all rows that have the same Sender_ID A…
Convert week number and year to a date in Access-SQL?
In Microsoft Access, I have a table where number of hours worked per weekday are associated to a project number, ISO-week number and year. Simplified, it looks like this: ProjectID WeekNumber YearNumber Monday Tuesday 1 1 2022 5 6 1 2 2022 7 8 I am trying to set up a query where all weekday columns (monday to…
Three-table join with NO EXISTS
I have three tables and would like to answer the following question in SQL: “Who has only certifications that do NOT have scores?” For instance, in the setup below, the query would return “John” only. Joana has the “AWS Certification”, which is in SCORE table (id 57). Marry…
T-SQL : Alter Database statement inside IF is failing
We have a scenario where we have to change database compatibility based on SQL Server version and we have written below condition for the same. In one of our customer’s server this code is failing with below error and the server has SQL Server 2014 Msg 15048, Level 16, State 1, Line 4 Valid values of th…