I am trying the select attribute columns with same name from Dynamodb table.
aws dynamodb execute-statement --statement \
"SELECT id, xyz.id FROM "table_example"."indexTest" WHERE column1 IN ['A','B','C']"
I am getting below error
An error occurred (ValidationException) when calling the
ExecuteStatement operation: Duplicate identifiers in select clause
I also tried using aliases, but PartiQL does not support aliases as well. Does PartiQL allow to select columns with same name?
Related
I am trying to automate some performance check on query in Teradata.
So as part of that I want to check if columns used in joining condition are primary index of respective table or not and similarly for columns used in where condition are partition column in respective table or not. Is there any direct Teradata query which can directly give this without parsing whole query.
Yes there are two dbc objects where you can query :
dbc.columnsv
dbc.indicesv.
Primary index information will be stored in the 2nd view just search with your tablename and database name.
Partitioned information is stored in columnsv , there is a column with a flag value 'Y' for partitioned columns.
Example :
SELECT DATABASENAME,TABLENAME,COLUMNNAME FROM DBC.COLUMNSV WHERE PARTITIONINGCOLUMN='Y' where tablename=<> and databasename=<>;
Select * from dbc.indicesv where tablename=<> and databasename=<>;
Reading the documentation I can see that key filter expression should look like:
partitionKeyName = :partitionkeyval
however, the values of my GSI contain : in themselves. So using this:
aws dynamodb query --table-name my_table --index-name mark_id_index --select ALL_ATTRIBUTES --key-condition-expression mark_id=:bit:BT-EU:dev
causes the following error:
An error occurred (ValidationException) when calling the Query operation: Invalid KeyConditionExpression: Syntax error; token: ":BT", near: ":bit:BT-"
They also mention using # if the word is reserved, but I think in my case it is the character that is reserved. I have tried to google around # variables but cannot find anything.
I have a problem when try extract ddl for sequence using this function in this query:
select dbms_metadata.get_dependent_ddl('SEQUENCE', base_object_name) from dual;
base_object_name - name of trigger, that use sequences.
Result: ora-31604 invalid name parameter NAME "BASE_OBJECT_NAME" for OBJECT_TYPE 'SEQUENCE'
For example when I execute this query:
select dbms_metadata.get_dependent_ddl('INDEX', base_table_name) from dual;
in result I have indexes for specified table.
Please, help, how to extract sequence ddl using get_dependent_ddl() function?
Sequences are not dependent on tables, therefore you need to use select dbms_metadata.get_ddl('SEQUENCE', 'SEQ_NAME') from dual; to retrieve its ddl.
A sequence is not dependent on a trigger. It is a separate object that requires no other object in order to exist. Use the GET_DDL subprogram on DBMS_METADATA instead:
select dbms_meta_data.get_ddl('SEQUENCE',sequence_name) from dual
My SQL query is giving error while trying to execute query:
Error:
Query input must contain at least one table or query
INSERT into Posts (PostText,TimePosted, TID)
VALUES ('My Post','2013-04-11 13:50:18',
(SELECT MAX(TID) FROM Threads AS TID))
Combine the literal fields with the select & move the alias;
INSERT into Posts (PostText,TimePosted, TID)
SELECT 'My Post','2013-04-11 13:50:18', MAX(TID) AS TID FROM Threads
You have not specified table name in your query.
There are 3 fields in your table and you are sending 3 values (Last value by select query).
But you have not written table name for main query in which data to insert.
Can any one tell me that how to get names of all tables of a database using asp.net
A newer method on SQL Server is to use the INFORMATION_SCHEMA Views to get the information:
SELECT table_name FROM INFORMATION_SCHEMA.Tables WHERE table_type='BASE TABLE'
This particular view also includes Views in its list of tables, which is why you need the where clause.
You didn't mention which database engine you are using. On SQL Server, you can query the sysobjects table and filter for objects with type U:
SELECT name FROM sysobjects WHERE type = 'U'
In case you are interested in the MySQL way to achieve this, you can use
DESCRIBE tableName;