I am using the following DB Schema and using something like this to add data/query it which returns How can I return recipes who’s ingredients are a subset of a list of ingredients provided? e.g I should not return Chocolate cake if list (egg, salt, sugar) is provided. However I should return Chocolate cake if (egg, salt, ham, cheese, sugar,
Tag: having-clause
How to make a start on this SQL query homework? [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question A movie streaming app is currently being developed by a start-up. A movie
Something wrong with this SQL query?
Is there something wrong with this query? SELECT id, ( 6371 * acos(cos(radians(?1)) * cos(radians(latitud)) * cos(radians(longitud) – radians(?2)) + sin(radians(?1)) * sin(radians(latitud)))) …
sql clauses using HAVING truncated value error for part of the string
I am getting an integer value error but don’t understand why. Warning: #1292 Truncated incorrect INTEGER value: ‘%accepted%’; Warning: #1292 Truncated incorrect INTEGER value: ‘%pending%’ . It does not have the error for processing. It doesnt matter what is in “1st position” doesnt have the error. Could someone please help? Answer
SQL Select from many-to-one
I have two tables containing a one-to-many relationship. How should I select the “one” side given information for the “many” side? I’m using SQLite. Let’s say our first table, T1, is about cars and the second table, T2, is about the imperfections in each car. Let’s say we can describe the imperfections with an integer. So we have: We have
Can this be done as a SQL VIEW
I have a SQL Server table of Customer’s Events: There can be many EventTypes for the same customer in one day. EventTypes are like 1 – CheckIn 2 – CheckOut 3 – ExamStart 4 – ExamEnd Now I want to select Customers that are currently (today) on premises. That’s Clients who had checked in, but hadn’t checked out, no matter
multi condition on different rows
age | name | course | score _________________________ 10 |James | Math | 10 10 |James | Lab | 15 12 |Oliver | Math | 15 13 |William | Lab | 13 I want select record where math >= 10 and lab >11 I write this query but this query does not return any record. I want this result age
SQL – Matching only the values in IN clause (not less or more)
I am having the following ManyToMany table TEAM_USERS with the below data: So, I want to get the TEAM_ID that is having only two user with the USER_ID IN (3, 4), in this case it’s team 11. But I am getting team 1, 11, and 12. And I want only team 11. I did the following code but I am
MySQL: Why are these two wrong? (Invalid use of group function, selected nothing after using having())
Credit:Leetcode_1076.Project Employees II Here is the sample table Project table: (project_id, employee_id) is the primary key of this table. I have tried several methods and managed to find the right one by using dense_rank(); however, I still don’t understand why these two syntaxes are wrong to select project_id with the largest number of employees: 1.Return null: {“headers”: [“project_id”, “n”], “values”:
SQL How to ask for a value multiply times in an Query [closed]
Good evening folks! Following Problem, I have three tables: Create TABLE Suppliers ( SID integer, sname varchar(50), adress varchar(50), PRIMARY KEY (SID) ) Create TABLE Parts ( PID integer, pname …