Category "sql"

Get generated keys from single insert statement with multiple values

i'm inserting multiple rows into a table using a single insert statement. The table has an auto increment field as the primary key. Like so: INSERT INTO MyTabl

Bigquery: Match IP address to IP CIDR in another table

I am referring to this article in order to lookup IP addresses to country: https://cloud.google.com/blog/products/data-analytics/geolocation-with-bigquery-de-id

Fill nulls with lag, but ignore nulls isn't supported

I have a table which looks like this: ID money_earned days_since_start 1 1000 1 1 2000 2 1 null 3 1 3000 4 1 2000 5 2 1000 1 2 null 2 2 100 3 I want that rows

SSIS When viewing query preview some characters are replaced

I have huge amount of data in Sybase DB and I made OLE DB connector in SSIS where I succesfully connected it. We are using charset = cp1250, because we have dat

How do I update a BigQuery table with multiple auto incrementing values?

I have managed to generate a single column based on multiple counts with different prefixes, as detailed here. But now I want to update an existing BigQuery col

Order by calculated column with alias inside case expression

I've got a problem with my order by clause when using a calculated column with an alias as below: This order by works without any problem declare @Mode int = 1

Table relationship problem for an competition program (tennis/Padel)

I am trying to make a my first relationally table structure for a tennis/Padel competition program that registers the scores (sets.)of dubbel matches(4players).

How do I delete images that are not used in the database?

I have written scripts that check images in a directory and in a database. I need to delete images in a directory that are not in the database. How can I do thi

How do I make SQL injection is this vulnerable query

I have this query that receives a parameter from user input and I think that I am vulnerable to SQL injection. $query = "SELECT pcode,price,description FROM pro

Prefered results

I am trying to list all DEPARTMENT_IDs with PRODUCT_IDs, first where PRODUCT_COST_STATUS = 1 but there are also data with where PRODUCT_COST_STATUS = 0. I prefe

TSQL Insert into with CTE, how to do it?

I'm struggling with the problem below. I have written CTE where I calculate quantity of headcount in year,mth and cumulatively. My code: with HRdataCTE as

Building a select query using Spring Data Specification

I'm trying to build a select query with Spring Data Specification. The query in question is the following: SELECT * FROM product WHERE id IN (SELECT product_id

Recursive query to produce edges of a path?

I have a table paths: CREATE TABLE paths ( id_travel INT, point INT, visited INT ); Sample rows: id_travel | point | visited -----------+-------+

MS access replace null or zero values with nearest non-zero row

I have a sample dataset like this Group Age Value A 1 A 2 0 A 3 20 B 1 0 B 2 0 B 3 25 B 4 0 B 5

Way to group rows in a table based on multiple columns

I am trying to find out if there is a way to group rows in a table within a database based on the values from multiple columns. My specific problem is that I am

ER diagram to Postgres SQL

n real, ProductID integer , PRIMARY KEY () )

Week date range

There is a table objects, which stores data on real estate objects. Me need to use a query to calculate a new field that will display the date range from Monday

calculating the average of marks from the beginning to this record

i have a table named test with the below structure like this id mark join_id 1 5 1 2 4 1 3 9 1 4 5 2 5 7 2 6 12 2 i want to write a que

SQL GROUP BY and COUNT and conditional SUM with column value

Here is an example of my table. ┌────────┬────────&#

SQL: how to convert timestamp to datetime? [closed]

I need to convert "2022-04-29T07:20:32.727Z" to "2022-04-29 07:20:32". I am quite new to SQL and haven't found the solution.