All Questions
Tagged with sql postgresql
92 questions
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 ...
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 &...
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 ...
0
votes
1
answer
45
views
Find and conditionally sort all venues matching a filter provided by an API client in PostgreSQL
I have an API where users can retrieve a list of "venues".
Every venue is a profile, but not every profile is a venue
Venues can be "parents" of other venues (think hotel - floor -...
1
vote
2
answers
34
views
Creating single table vs creating multiple table
I have lots of services which I am integrating. (also I am new to sql)
For each service integration I get different response,
For example, for zoom, I would just need to store the access_Token, for ...
2
votes
1
answer
63
views
Update table with data from another table under certain criteria
I need to update a lot of data from one table based on criteria from another table.
My tables and records in those tables look like this:
This is Users table where i can have many records for single ...
2
votes
1
answer
149
views
Extracting authors and books from XML and inserting them into PostgreSQL
There is a tree of start folder, it's subfolders, their subfolders, etc. In each folder, subfolder, etc. there are the same structured XML files stored.
books.xml
...
1
vote
1
answer
44
views
PostgreSQL query which return metrics joining different tables
I have a query that can be seen on this fiddle and I'm relatively new to PSQL, having a few months of experience.
DB Fiddle
As mentioned in the comment I should put the query here and the code is ...
2
votes
0
answers
27
views
Plpgsql function that redacts substrings wrapped with double pipes `||`
I'm using Postgres 14 and I've written a function (for use with Hasura GraphQL Computed Fields) that transforms a TEXT field, replacing all instances of spoiler-annotated text (e.g. ...
0
votes
1
answer
33
views
Comparing two columns across tables for a remaining subset
How can I find the unique phone numbers (and collapse them into a single column) from table_1 (while keeping the IDs and date fields), and remove phone numbers that appear in table_2?
table_1
id
...
2
votes
1
answer
48
views
Find coherent datetime ranges in postgresql
My Data consists of rows containing a Length/Duration in Minutes, a Begin & EndTime. The precision is 1min (or larger).
the table looks something like that:
...
5
votes
1
answer
134
views
PostgreSQL: Grouping and Aggregating on multiple columns
Problem Statement:
I am working on this simple dataset from Kaggle. I have provided a snippet of data with only required columns in below table. Dataset is quite simple, it has all IPL (cricket) ...
1
vote
1
answer
69
views
Simple website sql database
I'm getting into backend with postgresql and I would like to know how much of my example would fit for a real website database, just for storing and then displaying it on website.
...
1
vote
2
answers
2k
views
A discord.py bot that logs every messages sent in a discord server
Hello Code Review community !
I'm making a bot with discord.py that listens to every message sent in a server and stores it in a database that could be retrieved by admin/mod later.
Here's the ...
2
votes
1
answer
151
views
Getting new vs. returning customers in Postgres
I have this work task, to write a SQL query that would show how many of the active customers are new (= do not have prior transactions) as opposed to returning per a given period.
There is nothing ...