I have a number of tables, and many of them have a timestamp column. I can get a list of every table with a timestamp column: I can get the hightest timestamp in the sharks table as follows I would like to get a table like I’m suspecting this requires dynamic SQL, so I’m trying something like But it seems
Tag: information-schema
Find schema name given table name in Redshift
Is it possible to retrieve the schema name given the table name in redshift and return an error if table is not found? SELECT * FROM PG_TABLE_DEF WHERE tablename = ‘tablename’; doesn’t seem to work. Answer pg_table_def lets you see only the tables that are visible to your curent user – which, presumably, is not the case of the
MySQL find column name where it’s value match the pattern
How to search the entire database for column name equal to my rule and specific value as well. Let’s say that i want to search for column name like voucher where it’s value contain that word value10 So far i can find the column name but i don’t know how to match with value as well. So the end goal
List of all table and column level privileges for a MySQL database
What is the easiest way to list all table-level and column-level privileges for a MySQL database? I need to know what level of customized access has been granted for a specific database and which users have fine-tuned access to certain tables and/or columns. Answer To list table level privileges, you can query the INFORMATION_SCHEMA.TABLE_PRIVILEGES table. The TABLE_PRIVILEGES table has these
Set empty strings (”) to NULL in the whole database
In my database are many text columns where values are empty strings (”). The empty strings need to be set to NULL. I do not know the exact schemas, tables and columns in this database or rather I want to write a general solution which can be reused. How would I write a query / function to find all text
Generate CREATE statements for all MySql Tables
I want All CREATE statements of MySql Tables in 1 query result. For example, INFORMATION_SCHEMA contains all table names,comments etc. but where are the CREATE statements are stored in MySql ? can it be retrieved in one query for all tables ? Currently i am retrieving TABLE ddl as below for 1 table. I have 100’s of tables so i