Answers for "how we get column and count from two tables in mysql"

SQL
4

how to count number of columns in a table in mysql

-- Oracle
SELECT count(*) FROM ALL_TAB_COLUMNS WHERE OWNER='owner_name' 
	AND TABLE_NAME = 'table_name';
-- SQL Server / MySQL
SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'schema_name' 
	AND TABLE_NAME = 'table_name';
Posted by: Guest on July-04-2021
1

mysql count multiple columns in one query

mysql count multiple columns in one query:
 SELECT 
        count(*)             as count_rows,
        count(col1)          as count_1,
        count(col2)          as count_2,
        count(distinct col1) as count_distinct_1,
        count(distinct col2) as count_distinct_2,
        count(distinct col1, col2) as count_distinct_1_2
    FROM `table` ;
Posted by: Guest on May-31-2020

Code answers related to "how we get column and count from two tables in mysql"

Code answers related to "SQL"

Browse Popular Code Answers by Language