674,113 questions
0
votes
1
answer
95
views
INSERT … WITH … SELECT fails with different errors (invalid column, invalid date) depending on execution context
I am running a complex INSERT ... WITH ... SELECT statement on SAP HANA.
The statement works partially in some contexts, but fails with different errors depending on where it is executed (SQL editor ...
-1
votes
0
answers
179
views
Not able to delete records - foreign key constraint fails [closed]
Foreign Key Constraint Error While Deleting User (Laravel & MySQL)
I'm running into a foreign key constraint issue when trying to delete a record from the users table.
Error from Laravel
...
Tooling
0
votes
4
replies
150
views
How can I replace numerical values with NULL in SQL
What if a junior data analyst working for a local news station and your team is using BigQuery to analyze weather trends. The station’s meteorologist has tasked you with understanding the relationship ...
Advice
0
votes
2
replies
134
views
How to improve search time for attribute based database design
I am currently working on my mini project to practice(16 yo). I have this simple database structure consisting of products, categories and their attributes. I want to add search function. Structure ...
0
votes
2
answers
96
views
MySQL Grouping with Aggregate [duplicate]
I have a database of Magic the Gathering card prices. I am trying to do a query of lowest price by each seller and populate this to another table. However I get quite weird response from the query.
I ...
-1
votes
2
answers
240
views
Why does SQL Date value become NULL when using AddWithValue? [closed]
if (connection.State == ConnectionState.Closed)
{
connection.Open();
string signup = "INSERT INTO TABLE (ID,NAME,SURNAME,MAIL,PASSWORD) VALUES (@ID,@NAME,@SURNAME,@MAIL,@PASSWORD)";
...
-1
votes
0
answers
70
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 ...
Best practices
0
votes
9
replies
167
views
SQL-Test-123456789_question
What SQL function will display first 4 terms in a string? Strings are of 10-25 in total length. Strings can be number or letters. Results should be sorted in descending order. Data is for hockey ...
0
votes
1
answer
148
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
106
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
1
vote
4
replies
100
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 '...
3
votes
3
answers
158
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
85
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
207
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 ...