Skip to content

Tag: sql

reference primary key from another table [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed las…

PostgreSQL get all records with most recent date

I have this query that will run on very large data sets and it is too slow. table A looks something like this pk columnA columnB columnC 1 5/6/2022 1234 1 2 5/6/2022 1234 2 3 5/5/2022 0000 3 4 5/3/2022 0000 4 There are about 1000 distinct entries in columnB and many orders of magnitude more in the table.

Sql / Finding Min Max values for each elements of another column

Learning sql, as per title trying to print min and max values of a given column (sal) for each values in another (nodept). Using this query so far: Which works but only returns absolute min max and not min max for every entry in nodept. Documentation says it should be a simple matter of adding GROUP BY to the…

SQL Query to return last week’s data

I am trying to run a sql query that will return last week’s data to the date. For example, today is Monday. I want to return last Monday’s data only. The prior week to the day. What I am doing is getting last week’s ARAging Snapshot for my company. (What the data was last Monday, compared to…

Create frequent number sqlite queries

Good evening. I created a database with 9 columns and 605 rows. On column 3, 4, 5, 6, 7 there are numbers ranging from 1 to 90 random. Now I would like to create a query that tells me on each line how many times a number is frequent. The table is divided into 11 lines: Bari, Cagliari etc. For

Remove schema name from DBeaver’s query

I am new to DBeaver and I am using it for the postgres client. I was using Navicat before and in navicat the query simply used to run without schema name as SELECT * FROM TABLE_NAME . However, I am having issues with the Navicat and I recently switched on DBeaver(22.0.4 mac). With DBeaver, I cannot execute qu…

Convert String containing commas to array

I am trying to convert a String to an array By doing so it gives me an error when trying to fetch data on MySQL However, if I manually set the array as $array = array(‘1’, ‘2’, ‘3’) it doesn’t give an error when fetching a data, is there a way to convert the string to…