Questions tagged [virtual-columns]
The virtual-columns tag has no usage guidance.
19
questions
0
votes
1
answer
26
views
how to add a query to postgres and have it show up as a table [closed]
I'm not sure what technology I need because I'm not a DBA, but I'm sure there's a good way to do this.
I have a postgres database with this schema (top two tables exist):
So I'm trying to add the 3rd ...
0
votes
1
answer
340
views
Intended use case for virtual columns with function-based index?
What is the intended use case for virtual columns with a function-based index?
The reason I ask (novice):
I've been exploring options for pre-computing columns in a table. For example, in a roads ...
0
votes
1
answer
535
views
Adding Virtual Column after column x is very slow
In our environment, we usually add and drop generated columns every now and then. There is a very large table in the database with more than 3 million rows and adding/removing column was extremely ...
2
votes
1
answer
2k
views
Can not drop virtual column | ERROR 1054 (42S22): Unknown column in 'GENERATED ALWAYS'
I'm just running a command:
optimize table some_table_name_here;
But it results with:
Table | Op | Msg_type | Msg_text
db.some_table_name_here | optimize | note | Table does not support optimize, ...
0
votes
1
answer
61
views
Convert rows into columns MySQL DataBase
I have two tables and I would like to generate a query relating the tables.
Until now I have this query:
SELECT Table1.*, table2.* FROM Table1 INNER JOIN table2 ON table2.FK_ID = Table1.ID
but I ...
1
vote
0
answers
525
views
Is it possible to alter normal column to virtual column in Oracle?
ALTER TABLE TAB_NAME ADD TEST_COL VARCHAR2(255);
ALTER TABLE TAB_NAME MODIFY TEST_COL GENERATED ALWAYS as ('some_exp') VIRTUAL;
Second script gives an error:
Error report -
ORA-54026: Real column ...
0
votes
1
answer
298
views
Column with Default value as Sum of TIMESTAMP
I have a table which has 2 columns ( JobDate , RecordTime)
--------------------------------------
JobDate | RecordTime | SumCol
--------------------------------------
2019-07-20 | 2019-07-...
3
votes
3
answers
18k
views
How to use column alias to calculate other column value
My query is
SELECT
(`house_rent`+`conveyance`+`medical`+`dearness`+`others_allowances`) AS earnings
,(`income_tax`+`pro_tax`+`emp_state_insu`+`absence_fine`+`others_deductions`) AS ...
0
votes
1
answer
153
views
Obtain virtual column formula with SQL
We want to update the condition of a virtual column and to minimize error posibilites we want to extract the exact function working today to add new parameters to take into account.
I've firstly test ...
1
vote
0
answers
240
views
Does MySQL update indexes on virtual columns on tables that are being replicated from a master?
We use statement based bin log master-slave replication with MySQL 5.7.
We use the slave for analytics and so add additional indexes and things not required on the master.
I recently tried to add a ...
0
votes
1
answer
700
views
"ORA-12899: value too large for column "V_UUID" (actual: 36, maximum: 4000)" when used to generate a Virtual column
I have the following function:
CREATE FUNCTION UUID_AS_HEX(bytes IN RAW)
RETURN CHAR DETERMINISTIC
IS uuid CHAR(36);
BEGIN
RETURN REGEXP_REPLACE(bytes, '([0-9A-F]{8})?([0-9A-F]{4})?([0-9A-F]...
2
votes
2
answers
26k
views
Concatenate multiple columns into one column (,) separated [duplicate]
In SQL database that stores Images in a parcelImages table.Since each parcel can take part in multiple Images and each images can involve multiple parcels.
I want to get each parcel having Image ...
4
votes
1
answer
2k
views
Oracle random number as default column value
I'm trying to create a table in OracleDB and assign random number to one of the columns as a default. I have this setup working in postgresql
create table table_name (
column integer NOT NULL ...
4
votes
1
answer
1k
views
How do MySQL 5.7 virtual columns differ from views?
Starting reading point: https://www.percona.com/blog/2015/04/29/generated-virtual-columns-in-mysql-5-7-labs/
Running some tests with the most recent percona 5.7 they seem to work well. Explain plans ...
6
votes
1
answer
6k
views
Find columns referenced by virtual column expression
Does anyone know of any Oracle dictionary views that hold references of 'real' columns to virtual columns?
For example lets say I have a table like this:
create table t (
c1 varchar2(5)
,c2 as (c1 ...
0
votes
1
answer
53
views
Database engine that share a row among multiple tables
I'm wondering whether exists any database engine that can share cells or rows amongst many tables. For example:
TABLE Customer (
CID: int
Fullname: nvarchar(50)
Age: int
)
TABLE Group (
...
1
vote
2
answers
3k
views
Constant values in columns
I have a SQL Server 2000 database used by our ERP system.
There are many columns that always have the same value. A table row is really huge, potentially exceeding the maximum row size in SQL Server ...
1
vote
1
answer
2k
views
Creat Temporary Id in SQL Statement
I have a table
id name
1 Alpha
2 Alpha
3 Beta
4 Charlie
5 Charlie
I want to assign a temporary id at the run time in the SQL statement, So the desired result should be like
myid name
1 ...
4
votes
4
answers
11k
views
Is (and if how) it possible in Oracle to "insert into <table> values <rowtype-variable>" if <table> has virtual columns
Here's a table
create table tq84_virtual_test_without (
col_1 number,
col_2 number,
col_3 number,
col_4 number,
col_5 number
);
with the rule that col_5's value is the sum of the other ...