Postgresql – Query optimization for this table
ID Amount Brand 1 10 NULL 1 20 NULL 2 30 Mazada 2 NULL BMW 3 40 NULL 3 40 KIA 4 NULL Honda 4 NULL Honda Above is the original table, and my goal is to find out any…
ID Amount Brand 1 10 NULL 1 20 NULL 2 30 Mazada 2 NULL BMW 3 40 NULL 3 40 KIA 4 NULL Honda 4 NULL Honda Above is the original table, and my goal is to find out any…
I'm trying to get a record from a table, but only want to retrieve that record if there isn't another corresponding record with another status. Schema: ID: PK RID: Collection ID IID: Item ID Each ItemID correlates to a record…
Using PostgreSQL, how can I replace all forward slashes by a hyphen after 5 occurrences of a forward slash like so: https://this/is/a/very/long/url to this : https://this/is/a/very-long-url
I have a table that looks like the following descript timestamp START 1/1/2024 08:00:00 ACTIVITY1 1/1/2024 09:34:00 ACTIVITY2 1/1/2024 11:12:00 STOP 1/1/2024 13:00:00 I need a query that will return the description, timestamp, and the duration between the start and…
I'm hoping to get some help on how to speed up an SQL query. To give you some context, here's an outline of the related db structure: table instruments - instruments have isin, trading_venue, start_trading_date, end_trading_date; one and the same…
I want to make a full search query on a spĂ©cific value of my jsonb like the format of the json is : { "highlights": { "concise": null, "complete": null }, "gist": { "concise": [ { "text": "", "isHighlighted": false,…
I am working with an Excel spreadsheet that contains dates in the German format DD.MM.YYYY, and I'm trying to craft a formula that automatically generates an SQL insert statement for each row. I'm running into issues converting the German date…
I handle articles on a multi-language site, with the possibility for the users to update the content. I use a MySQL database. Table articles: id Table article_contents: id article_id (FK) content lang version If the new content is still a…
Why I get so many more records with a condition in sql? I try to build a sql table based on another sql table. The original commands are: cursor.execute('DELETE FROM Dataplace.Queue') cursor.execute(f"INSERT INTO Dataplace.Queue SELECT DISTINCT COSTCENTER, 'Pending', Null, Null…
I have a parent table and a child table. A parent row stores the foreign key to the child row. If I set the constraint on the foreign key to ON DELETE CASCADE then that will throw an error when…