I'm a biginner using Sequelize.
I spend hours trying to get the following code runs but I can't
I quit some columns from the table for better understanding.
Finance table
I want to get this result:
[
{
'month': 11,
'year': 2021,
…
I have an sqlite table with the following schema and data:
CREATE TABLE Feeds (
id INTEGER PRIMARY KEY AUTOINCREMENT,
groups JSON NOT NULL
DEFAULT ('[]')
);
INSERT INTO Feeds(groups) VALUES ('["fav1",…
I am trying to create a mysql query that looks at a table that stores search queries. The query is trying to get all rows that:
>= to a date
Only returning rows where the search query has 3 or more occurrences
Also only returning rows where 2 or…
Yes, this is an assignment. So the task was to output two columns of 'first name' and 'last name' with conditions:
-A u (B ∩ -C ∩ -(A ∩ -( B u D)))
A: All consumers that didn't shop on Monday and Friday
(time_by_day.the_day)
B: All consumers who…
I have a query in which I have the time of light switches turned on in a flat, with switch on (start) time and switch off (end) time.
I would to know how many light switches are on, does anyone know how can I do?
Example query:
Select Flat,…
This is my first question (and sorry for my English)
I have this table in SQL Server:
id_patient | date | id_drug
----------------------------------------------------
1 20200101 A
1 20200102 …
I came across a query that had a condition in the HAVING section of the query that I would have typically placed in the WHERE section. I preceded to move the condition to the WHERE section and to my surprise the code runs about 200%+ longer using…
I'd like to find an efficient way to filter my RANK() OVER function in SQL.
I have the following query:
SELECT
base.ITEM_SKU_NBR,
RANK() OVER (ORDER BY SUM(base.NET_SLS_AMT) DESC) AS SLS_rank,
RANK() OVER (ORDER BY COUNT(DISTINCT…
Here's my Query that does not work because it apparently violates the rules of the HAVING clause:
SELECT
COALESCE(Publisher.name, Affiliate.name) AS Publisher
,dbo.SumKeys(Item.id) AS ItemIDs
FROM
Item
INNER JOIN…
This query:
SELECT 1, 2, count(*)
FROM t
GROUP BY ROLLUP (1, 2)
ORDER BY 1, 2
Shows:
1, 2
A Null 3
A Blue 2
A Neon 1
B NULL 2
B Navy 2
C NULL 4
C Neon 2
C Blue 2
You see the sums A = 3, B = 2, and C = 4?
I want to filter to only show if the SUM…
I tried many times by many ways but I cannot resolve this...
I'm performing an Oracle SQL query:
SELECT
TRUNC(months_between(sysdate, DateofBirth) / 12) AS "age"
FROM players
group by age
HAVING COUNT
(TRUNC(months_between(sysdate,…
I need help with this exercise where I have to translate properties from English into sql.
Questions:
length has at least one 0
Answer: MIN(ABS(length)) = 0
length has more that one value
Answer: MIN(length) < MAX(length)
there are…
The problem I am trying to solve is as follows
For each continent show the continent and number of countries with populations of at least 10 million
The world table looks like this:
World (name, continent, area, population, gdp)
My query (which…