How to calculate percentage of students with higher mark than average for each course? Assume I have a table (avg_marks) with average marks for each course and number of students in the course: I also have a table (enrolments) with all courses, students enrolled in those courses and their mark for the course:…
Laravel 7 Select a record if the id dosen’t exist in another table
Using laravel 7 i am trying to select an item record as long as that records id dosen’t appear in another table but only as long as the id in the other table is accompanied by the users id Item table …
Unwanted Cross Join in JPA CriteriaQuery select in subquery
I’m getting what I think are needless CROSS JOINs when I’m doing a select IN SUBQUERY, which is hurting performance. I’m using Postgres if that makes a difference. I’m aiming to generate the …
Access Compile error: Type mismatch on SQL Recordset Query
I’ve been chasing my tail on this SQL query for a record set. If I comment the query out, I do not receive the type mismatch error, so I’m relatively confident it is in this query. The query also …
Inner Joining 3 Tables to get a Result
I am new to SQL, but I am trying to find all the jobs that Monica (applicant A2) has ALL the skills for (which would be Job ID jo3 and j05.) This is the script I am using in Oracle: drop table …
Getting rows with count > 1 without executing two different queries
I have a table that looks like this: ITE_ITEM_ID SIT_SITE_ID INVENTORY_ID ITE_VARIATION_ID STOCK_EAN STOCK_FULFILLMENT_ACTIVE 16302514 B WAE6496 62101793519 79098642 1 6210113 M GKVU072 [object …
How to exclude results in a query using a subquery as blacklist
I’m trying to query a database for text, use a (sub)query as a “blacklist”. The twist: if any of the results from the main query have an identical beginning as any of the results from the …
SQL SELECT cannot reference “INDEX” column
Using Advantage SQL, I have the following query: SELECT TOP 10 mytable.* FROM “mytable.ADT” mytable ORDER BY date DESC This returns this data set: INDEX NR NAME Date —…
Oracle SQL Inserting multiple rows into a table while referencing 2 FK
I’m trying to insert values id_team_FK and id_location_FK which both come from the same table. For example id_team_FK = 4 and id_location_FK = 150. The problem is, id_team_FK must be a randomly chosen …
SQL result from table a but name from table b
My request is quiet simple however I can’t find it (maybe I can’t goolge correctly). I have Table A and Table B Table A: ID length 1 50 2 45 2 20 and Table B ID name 1 apple 2 orange I want …