Getting total number of rows

-- Getting total number of rows
SELECT COUNT(*) AS total_rows
FROM table_name;

Getting total number of columns

-- Getting total number of columns
-- PostgreSQL
SELECT COUNT(*) AS num_columns
FROM information_schema.columns
WHERE table_name = 'table_name';

-- MySQL
SELECT COUNT(*) AS num_columns
FROM information_schema.columns
WHERE table_schema = 'database_name'
  AND table_name = 'table_name';

Getting total number of rows and columns

-- getting total number of rows and columns

-- PostgreSQL
SELECT 
    (SELECT COUNT(*) FROM table_name) AS total_rows,
    (SELECT COUNT(*) 
     FROM information_schema.columns 
     WHERE table_name = 'table_name') AS total_columns;

-- MySQL
SELECT 
    (SELECT COUNT(*) FROM table_name) AS total_rows,
    (SELECT COUNT(*) 
     FROM information_schema.columns 
     WHERE table_schema = 'task' -- your database name
       AND table_name = 'table_name') AS total_columns;

-- sqlserver
SELECT 
    (SELECT COUNT(*) FROM table_name) AS total_rows,
    (SELECT COUNT(*) 
     FROM INFORMATION_SCHEMA.COLUMNS 
     WHERE TABLE_NAME = 'table_name') AS total_columns;

Getting column details

-- Getting column details: number, name and data_types
SELECT 
    ordinal_position AS column_number,
    column_name,
    data_type
FROM information_schema.columns
WHERE table_name = 'table_name'
ORDER BY ordinal_position;

Null Values

SELECT (COUNT() - COUNT(column1)) + (COUNT() - COUNT(column2)) + (COUNT(*) - COUNT(column3)) AS total_nulls FROM consumer_complaints;