Questions tagged [sql]
Structured Query Language is a language for interacting with relational databases. Read the tag wiki's guidelines for requesting SQL reviews: 1) Provide context, 2) Include the schema, 3) If asking about performance, include indexes and the output of EXPLAIN SELECT.
1,442 questions
5
votes
3
answers
792
views
Slow SQL query with nested subquery
I have written the below query in order to identify how many events (occur over a week) in each hour.
...
4
votes
2
answers
71
views
better-SQLite3 and JS/Next.js - updating data using "transaction"- shorter / better code?
I am pretty new to SQL databases and in particular to the better-SQLite3 database. I have managed to insert, update, and delete data in a way I desire. All of it running in the background of a self-...
8
votes
2
answers
934
views
JavaFX app with User Authentication and SQL Persistence
This JavaFX program is just supposed to allow a user to register a username and password and then have it stored in an SQL database.
There's been some criticism that it's not clean, readable or ...
2
votes
1
answer
176
views
Getting all column vs. table regardless of alias using JSqlParser
I have been trying to get all column vs. table regardless of alias used, for example, assume this query
...
4
votes
1
answer
61
views
Better Microsoft SQL update
I've got the following SQL that I need to update by adding a new parameter:
...
-1
votes
2
answers
51
views
Enhancing my query for select information implement in oracle(plus/sql) [closed]
I'm working on my query for select information relate to the order table in oracle. I've written the following code. But I'm looking for suggest on how to improve it.
...
5
votes
2
answers
680
views
A schema for awallet system that allows transfers between users
I am currently working on a wallet system that allows transfers of money between users. I tried creating this as a Stack Overflow question, but it was rejected. I'm not sure if this is the right ...
3
votes
2
answers
164
views
Clean up verbose code for Oracle SQL
I have the following Oracle SQL code that works, but I would like to try and find a way to clean it up so it's not so repetitive. It is looking at orders for a part ordered each FY in an Oracle ...
3
votes
1
answer
136
views
Faster Query to Track State changes in a Large Table
I have a table that tracks state changes of an entity with timestamps. The schema of the table is as follows:
entityid
userid
originalvalue
newvalue
changetime
255
101
Draft
Submitted
2023-11-28 12:10:...
2
votes
1
answer
69
views
Delete duplicates from SQL database with Python and reset ID's
I tried to create a peice of code that helps me remove duplicates from my sql database and reset the ID's as well.
I am not sure that it's error proof.
...
2
votes
1
answer
62
views
Postgresql generated column from Finnish personal identity code
The Finnish personal identity code is defined as:
Day, month, and year of birth, in ddmmyy form (six digits, zero padded if necessary)
A separator
For those born &...
2
votes
0
answers
54
views
Case Study: Database design help for a small app used to coach tennis players
I have a small SQL server database and VBA program that is used to automate tasks related to tennis students, programs, practices, performances, and student testing.
I'm trying to learn db design and ...
2
votes
1
answer
85
views
Feedback for my first project - sqlserver-json-tools
could you review my first project on github please. The JSON_MODIFY function in SQL Server 2016 and 2019 does not allow creating paths dynamically, making it necessary to chain JSON_MODIFY executions. ...
2
votes
1
answer
93
views
Determining the least dangerous tags with over 1K answers to answer
So I thought I'd take another shot at making a SEDE query after being somewhat inactive after a while.
Essentially what this does is that it takes the tags that have at least 1000 answers for that tag ...
3
votes
1
answer
60
views
PostgreSQL Search Feature
The Problem
I am developing a search feature in PostgreSQL that involves a collection of JSONB documents stored in a table, which have been standardised. The goal is to enable clients to perform ...