Category "sql"

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.

What is the best way to use for large numbers in phpmyadmin, as the number I need it not show in the correct way

I am trying to use phpmyadmin to add numbers to sql my column is at the moment double, but it does not give me the correct info. Did try decimal and binary als

how many rows will the query return?

table t has a field X which is the primary key. the table has 5 rows. how many rows will the query returnenter image description here

How do I use fetchAll in php?

I am using this statement to fetch the elements in a column in my db $result = $stmt->fetchAll(PDO::FETCH_COLUMN, 0); but I get this error when trying to

Combining cte with dates and table with dates between two dates

I have a few pieces of code that give me things that I need, but I need some help for put them together. I have: create table #test ( job int, dateL date) inser

SQL - Returning all transactions based on one value

Using a large table of retail transactions I am trying to review customer purchases where they bought a specific product category. Table example below, customer

Get specific rows only after comparing with previously added rows on different date

There is a table which has multiple fields including a Date column at which the current record gets updated. Col1 Col2 Col3 Date A X1 Y1 Today B X2 Y2 Today C

IBM SPSS How to import a Custom SQL Database Query

I am looking to see if the capability is there to have a custom SSMS sql query imported in SPSS (Statistical Package for the Social Sciences). I would want to b

How to select most frequent value with condition for multiple columns in netezza?

I want to get the most frequent value for each column. If it has the same frequent it will return 'equal'. I have data like below table and I use netezza. numbe

How do I get a data from one table to another but with calculations?

I have two tables: "Customer" and "Order". The "Customer" table has an attribute called noOfPurchases, and the "Order" table has an attribute called quantity. H

Why does this Sql query shows the possible changes but does not implement it?

So, I want to change the prefix of my tables and the following command shows the possible changes that will take place which seems alright but does not seem to