Monday, April 12, 2021

Useful SQL queries to query the DB

---------------------------------------------------------------------------
Command to get collation for each columns of a table
---------------------------------------------------------------------------- 
SELECT TABLE_SCHEMA 
    , TABLE_NAME 
    , COLUMN_NAME 
    , COLLATION_NAME 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 't_name';
-------------------------------------------------------------------------
 Display table with a particular column name
--------------------------------------------------------------------------
SELECT
*
FROM
information_schema.columns
WHERE
column_name = 'column_name';
OR
SELECT
*
FROM
information_schema.columns
WHERE
column_name LIKE '%column_name%';


No comments:

Post a Comment