Skip to content
Advertisement

How to create generated columns in DB2/400

I wanna create a virtual column which concatenates two columns to 1. My attempt was: This should work according to the docs. ( https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/db2/rbafzpdf.pdf?view=kc ) (page 851). Has anyone an idea how to get this done? Thanks in advance. edit: I doublechecked it. This doesn’t work either. Answer Always give your Db2 version (or in this case , the version

Why ROW_NUMBER is defined as window function?

I would like to understand better the meaning of window function. The definition says: A window function performs a calculation across a set of table rows (the window) that are somehow related to the current row Let’s consider ROW_NUMBER() (the same could be applied for RANK() or DENSE_RANK()). The function simply assign a number to an ordered set of rows.

MySQL use JSON_CONTAINS with a subquery

I’m trying to make a subquery inside JSON_CONTAINS to have a results like this This is what I have tried But since the subery query returns Client instead of “Client” JSON_CONTAINS doesn’t accept the value. ERROR 3141 (22032): Invalid JSON text in argument 1 to function json_contains: “Invalid value.” at position 0. Answer You could just concat the double quotes

Sum two column values on the basis of two name column

I am new to Postgres database. I am given 4 columns homeTeamName, homeTeamGoals, awayTeamGoals, awayTeamName. I want to find out the total goal(homeTeamGoals + awayTeamGoals) scored by each team. the database is as follows I think my solution is wrong. So looking for a better way Answer You can separate the table content as below, and then apply SUM function

Advertisement