673,799 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Advice
0
votes
1
replies
38
views
Replicate SAS Merge happening in loop into Pyspark
I have an use case where I need to replicate a sas behaviour into pyspark. In Sas, the Merge between two datasets are happening and its not 1*1 key merge. Its a m*n key merge involving multiple keys. ...
- reputation score 331
Score of 0
1 answer
77 views
Query that shows if a member meets defined metrics from the metrics table
I am trying to figure out how to write a query that can show me if a member meets defined metrics from our metrics table. There is a table that holds member survey answers and we have business ...
- reputation score 107
Advice
0
votes
6
replies
80
views
Best way to start learning SQL for database design and analysis?
I am new to SQL and I'm currently studying database design and analysis. I understand the basic concepts of databases, but I would like to build a strong foundation in SQL before moving on to more ...
- reputation score 1
Score of -3
0 answers
40 views
Problem facing while migration Data NAV16 to NAV16 in the Database [closed]
I’m currently working on a Microsoft Dynamics NAV 2016 to NAV 2016 data migration project, and I’m facing a challenge where I’d really appreciate some guidance from people who have handled similar ...
- reputation score 1
Advice
0
votes
5
replies
58
views
Clarification on JOIN statements SQL
So, I am taking the Google Data Analytics class and I'm learning about using SQL and BigQuery. Some of these examples got me questioning how they work though. Take this for instance, so I know the ...
- reputation score 1
Score of 1
1 answer
106 views
Why doesn't LIMIT return N rows per device after ALIGN BY DEVICE?
I wanted the latest two load_amp rows for each device in Apache IoTDB 2.0.8 tree model, so I queried wildcard devices with ALIGN BY DEVICE and added ORDER BY TIME DESC LIMIT 2. The result contains ...
- reputation score 29
Score of 4
1 answer
115 views
Why does CASE with a DOUBLE branch and ELSE NULL fail with unknown vs DOUBLE?
I'm cleaning string readings in Apache IoTDB 2.0.8 table model. When txt is not bad, I cast it to DOUBLE; otherwise I return NULL. ELSE null fails with a result-type mismatch, but ELSE CAST(null AS ...
- reputation score 67
Score of -3
0 answers
131 views
Dividing 2 numeric values in SQL e.g. Price / Quantity returns a number in scientific notation [closed]
I am dividing 2 numeric values in SQL, example Price/Quantity, and I get a number in scientific notation. I need to use the result to perform more calculations in Excel, how can I format it?
- reputation score 1
Score of 1
0 answers
102 views
Db2 for i: SQL procedure with SET OPTION COMMIT=*CHG leaves row locked after CALL
I am trying to understand the unit of work and locking behavior of a Db2 for i (ver 7.4) SQL procedure created with SET OPTION COMMIT=*CHG.
Minimal reproducible example:
CREATE TABLE T_TEST_COMMIT (
...
Advice
0
votes
6
replies
144
views
Concat multiple row values into for a single empId
Like I have user Data 50 emp inside each user has different skills 3 rows same user but skill column value is different
I want to concat the skill and display in single row for each user don't want ...
- reputation score 1
Score of -3
0 answers
73 views
Calc with Power not showing correct Value [duplicate]
I have a formula that I am trying to use in SQL and the value I get is different from when used in Excel. Can you see if the SQL needs to be tweaked to get the correct value?
Excel formula - for test ...
- reputation score 1
Advice
0
votes
5
replies
112
views
Group By Help - Msg 8120, Level 16, State 1, Line 1
I'm getting an error saying Service.Name does not exist but I can clearly see it in my table.
Query
SELECT TY.Name
,SER.Name
,PAK.[1_Year]
,PAK.[3_Year]
,PAK.[5_Year]
FROM [...
- reputation score 47
Score of -3
0 answers
66 views
Find the number that appears most often, considering 2 columns [duplicate]
Question from LeetCode SQL #602 using MySQL
https://leetcode.com/problems/friend-requests-ii-who-has-the-most-friends/?envType=problem-list-v2&envId=m8baczxh
My code:
# Write your MySQL query ...
- reputation score 77
Score of 1
3 answers
145 views
Index being ignored when filtering and ordering by different columns?
I have a MySQL table with about 5 million rows:
CREATE TABLE orders (
id BIGINT PRIMARY KEY,
customer_id BIGINT NOT NULL,
status VARCHAR(20) NOT NULL,
created_at DATETIME NOT NULL,
...
- reputation score 29
Best practices
1
vote
6
replies
175
views
Update column with default value set
Here is the example of a table:
DROP TABLE IF EXISTS members CASCADE;
CREATE TABLE members (
id SERIAL NOT NULL,
creation_date TIMESTAMPTZ DEFAULT NOW() NOT NULL,
update_date ...
- reputation score 121