54 questions from the last 30 days
0
votes
0
answers
7
views
SQL Query for Unpivot compatible with SQLGLOT parser
I have imported the data from the attached Excel file. The dataset currently has the following structure:
ISO, Name, 1993, 1994, 1995, …, 2023
Each year is represented as a separate column, and new ...
0
votes
1
answer
102
views
Why is the current date being changed on the result set of cursor inside procedure?
I need help with an issue regarding date returns in a CURSOR in DB2 for LUW.
The Dt_Noformat field returns an incorrect date, while the Dt_Format field returns the date correctly.
This problem occurs ...
0
votes
0
answers
91
views
AS400 Obtaining different results from CREATE VIEW and CREATE TABLE [closed]
I created a View with this statement:
CREATE OR REPLACE VIEW MyLib.WHERE_IS_SOURCE
FOR SYSTEM NAME "SRCMSRCH"
(LIBRARY,FILE,...
Best practices
0
votes
2
replies
52
views
New Data Analyst looking to improve SQL skills
What are the most important SQL skills or concepts I should focus to become job-ready as an aspiring data analyst? I want to understand which techniques are most used in real-world projects and ...
-2
votes
0
answers
39
views
SQL Server 2016 Patch has broken SQL Server - need traceflag 902 to access server [migrated]
Our platforms team has changed the way in which we install SQL Server patches.
This weekend, a number of patches have been applied on SQL Server 2016 and appear to have broken the servers.
Database '...
2
votes
3
answers
134
views
Find the column given a data-value in SQL
I want to simplify (or more accurately, generalize) this query:
SELECT * FROM MRE_TABLE
WHERE col1 = 'my-data-val' OR col2 = 'my-data-val' -- OR ... there are 68 columns
I really do not want to ...
2
votes
1
answer
75
views
Confusing Behavior of ALL Subquery in Apache IoTDB
I'm using the ALL syntax in Apache IoTDB 2.0.6 table model for a query, but the returned result is inconsistent with expectations.
Minimal Reproducible Data
CREATE TABLE main_data (
`time` ...
Advice
1
vote
10
replies
167
views
Image upload to SQL PHP
After many hours of research I finally cracked the code to uploading images through POST and inserting them into SQL.
index.php:
Connect DB file to your index
require "db.php";
(prevents ...
0
votes
1
answer
124
views
Get SQL to create the table equivalent of an existing view
I have an application that connects to an existing shared database that has some of the data it uses are pass-through views to tables in another schema. The application doesn't care that these are ...
Advice
0
votes
2
replies
67
views
Using a date parameter to control data volume across DEV/UAT/PROD — is this a recognised pattern?
I've read about environment strategies for data pipelines. The common answers are UAT gets a prod backup restored periodically and DEV gets synthetic data or a manual subset. But nobody addresses how ...
Best practices
0
votes
6
replies
179
views
The multiple choices in a database
I'm building a web application that has ~34 independent dropdown lists (e.g. currency codes, country names, user types, example statuses, etc.). Each list has no relation to the others — they're ...
Advice
0
votes
12
replies
107
views
Update start/stop time of state table and insert if state changes
I have a table that looks something like:
| Device id | Starttime | Stoptime | State |
|-----------|-----------|----------|-------|
Is it possible to make a MySQL request where, if the latest "...
Advice
1
vote
9
replies
168
views
Get Start date of a current partnership
I need to get the start dates of a partnership in different disciplines where the partnership previously existed but the individuals participated with other partners then resumed their partnership. I ...
0
votes
0
answers
51
views
Transpose a table and concatenate value into single var [duplicate]
NAME
Instance
Date
val
John
1
2019
12Y
John
2
2019
32dd
John
3
2019
23F
John
1
2020
43s
John
1
2022
23G
Mary
...
...
...
How do I convert the table into below?
Basically transpose by NAME and DATE and ...
-3
votes
0
answers
122
views
N-Queens query for N=17 works, but the same pattern becomes impractical at N=20. How to reduce TEMP usage? [closed]
I am trying to count solutions to the N-Queens problem in Oracle using exactly one SQL statement.
By N-Queens, I mean: count the number of ways to place N queens on an N×N chessboard so that no two ...