Skip to main content

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.

0 votes
0 answers
7 views

MS SQL - Detecting users with consecutive weeks

I need to detect consecutive weeks that a user appears within a table, with obviously no gaps in between weeks, I have the below solution which is based upon an answer here... https://stackoverflow....
Matthew Stott's user avatar
1 vote
1 answer
31 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. ...
Giannis Tsakas's user avatar
2 votes
1 answer
54 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 &...
TomG's user avatar
  • 762
1 vote
0 answers
35 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 ...
Jason's user avatar
  • 11
0 votes
1 answer
73 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. ...
Renato Magalhães's user avatar
2 votes
1 answer
79 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 ...
CrSb0001's user avatar
  • 279
3 votes
1 answer
54 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 ...
Bob's user avatar
  • 63
1 vote
1 answer
24 views

Filter filtered bike prices twice without repeating yourself

dbfiddle Goal Without repetition in the code, I want to filter BikeValuationList to only give the BikePriceId of the latest ...
J. Mini's user avatar
  • 127
0 votes
0 answers
18 views

Calendar Table in Power BI

I've been reusing calendar tables in various formats for a few years now. I'd like to know best practices and if there are ways to improve them. Any suggestions for style, code, etc. are all welcome. ...
aduguid's user avatar
  • 490
1 vote
0 answers
78 views

To-do app with TypeScript backend (violations of TS best practices or unidiomatic code)

The working code in full is here. It's a To-Do App with a TypeScript backend, written as practice for an upcoming 4-hour interview for a TypeScript backend role. My colleague and I would like to know, ...
Andrew Cheong's user avatar
2 votes
1 answer
113 views

Need assistance in Optimizing the Recursive Query in Pyspark

I am trying to convert a SQL Server stored procedure to Pyspark code. This is my SQL Server query: ...
Data writer's user avatar
3 votes
1 answer
97 views

Creating an array (temporary table) in SQL and iterating through each row within this table to preform a check on the data in each row

The SQL Server version I am using is SQL Server 2008. I've got an SQL query/script I've written which is to help simplify some things while our API is being rebuilt. Essentially, this script allows ...
level42's user avatar
  • 131
3 votes
2 answers
103 views

Calculate the count of top performers in SQL

I have a transaction table let's call it Offers Table. Please don't read too much into the business but let's say a customer wants to buy a car and the customer searches variety of websites but at the ...
Cody's user avatar
  • 31
6 votes
1 answer
901 views

Show how close a user is to being unsung

So this morning, I decided to create a SEDE query that answers the age-old question "How close am I to being Unsung?" because I recently polished up my first SEDE query and I realized that I ...
CrSb0001's user avatar
  • 279
2 votes
1 answer
39 views

Understanding how to properly create a stored procedure that only does INSERT from sourcetable to targettable with dynamic sql

Background and use-case I need to create a stored procedure where the input parameters will be: @sourceTable, @targetTable, @compositeKey. I'm using available fields for the composite key, since I ...
William's user avatar
  • 21

15 30 50 per page
1
2 3 4 5
98