I have a question that a little bit similar with question#66044663 but more complicated. Here’s my dummy data. I want to get 3 adjacent actions(no duplicate) from the flag by each user. Here’s the …
How do I create an automated calculated column?
Help me create a column, that shows the company’s budget. Let’s say we have three tables: Budget, Purchase, and Sale. When we selling products, the budget increases, when buying raw materials, it decreases. That is, automatically when you add a value to these tables, the budget value immediately c…
Difference between where and like in CLEARDB
I’m trying a simple nodejs login system and want to use the following query: “SELECT * FROM admin_cred WHERE username = ‘?’ AND password = ‘?’”, [username], [password] But it simply doesn’t …
Calculate percentage of SQL Group BY
The following SQL statement: SELECT FTR, COUNT(FTR) FROM football_data WHERE Matchday >= ‘2019-01-18’ GROUP BY FTR Returns the following result: Now I’m trying to get a percentage for each of …
SQL how to keep multiple entries satisfying a certain condition
I have the following dataset: ID Amount 1 50 2 6 3 7 3 50 4 60 4 30 5 40 5 20 I only want to keep IDs with multiple entries that have at least one amount greater than, or equal to, …
MariaDB does not accept specific date as ‘default on update’ value
Using MariaDB 10.5.8. The following commands work : CREATE TABLE t1 ( dt DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); CREATE TABLE t1 ( dt DATETIME DEFAULT ‘2100-01-01 00:00:…
SQL group by function to categorize only the most recent data
So I have this table called title where it stores all of the title held by each employee which will look like this emp_no title start_date 101 Engineer 2019-01-01 101 Senior Engineer 2020-02-01 …
oracle: format a number with slash
I have a column like this: Productnr 1 25 260 3700 51126 and I should write a query to display the column like this: productnr 0/01 0/25 2/60 37/00 511/26
Reset sequence to a specific value for test purposes
I’d like to reset sequence to specific value for test purposes. First decrement sequence with 100. After test execution I’ll increment sequence with 100. ALTER SEQUENCE seq_a RESTART WITH (SELECT MAX(…
weekly max count record in oracle
table test has column id,created_date,sal and data like below: ID create_date sal 1 20-JAN-2021 5000 2 20-JAN-2021 6000 3 19 -JAN- 2021 4000 we have data like this for each date. I pick the each day record count using below query: I want output for max record count for a weekly basis: count(*) create_date 500…