Skip to content
Advertisement

Tag: sql

Convert List Of XML Tags in varchar column to comma separated list

I have a table that contains a list of xml tags/values that I need to use to join to another table to retrieve their actual value and display the result as a csv list. Example varchar data: However, these values actually translate to other values: red, white, blue respectively. I need to convert that list to the following list: As

Data cleaning in BigQuery: When session_id has both null and valid find_term, only keeping the records that have valid find_terms

I need some help cleaning my data. I have a table like below: session_id find_term 11111 null 11111 candy 11111 chocolate 22811 null 11145 null 333222 dark chocolate When session_id has both null and valid find_term, I want to keep the records that only have valid find_terms (eg: for session_id 11111, I want to exclude the first record when find_term

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 last month. Improve this question I

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 query

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 this Monday) Here

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 query without schema

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 the array so the

Advertisement