#With SQL
SELECT count(*)
FROM information_schema.columns
WHERE table_name = 'Your_table_name';
SELECT count(*)
FROM information_schema.columns
WHERE table_name = 'tbl_ifo'
//With JAVA
String quer="SELECT * FROM sample2 where 1=2";
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(quer);
ResultSetMetaData rsmd = rs.getMetaData();
int NumOfCol=0;
NumOfCol=rsmd.getColumnCount();
System.out.println("Query Executed!! No of Colm="+NumOfCol);
SELECT TABLE_NAME , count(COLUMN_NAME)
FROM information_schema.columns
GROUP BY TABLE_NAME;
-- Oracle (depending on schema grants):
SELECT count(*) FROM USER_TAB_COLS WHERE TABLE_NAME = 'my_table';
SELECT count(*) FROM ALL_TAB_COLS WHERE TABLE_NAME = 'my_table';
SELECT count(*) FROM DBA_TAB_COLS WHERE TABLE_NAME = 'my_table';
Code Example |
---|
Sql :: mysql remove records |
Sql :: how to change column name in mysql |
Sql :: if column value is null then in mysql |
Sql :: sql replace single quote |
Sql :: mssql datetime to date |
Sql :: installing mysql on centos 7 |
Sql :: bigquery add days to date |
Sql :: display all node label neo4j |
Sql :: mysql date format |
Sql :: mysql repeated values |
Sql :: sql select lowest value row |
Sql :: sql find table by name |
Sql :: pgsql is not permitted to log in |
Sql :: mysql count characters in string |
Sql :: sql rtrim |
Sql :: between keyword in sql |
Sql :: athena create table |
Sql :: get initials name in sql |
Sql :: mysql auto increment column |
Sql :: all tables and views oracle |
Sql :: sql delete duplicate |
Sql :: run function in sql |
Sql :: psql select * from table |
Sql :: sql server default port |
Sql :: sql drop table |
Sql :: mysql run script |
Sql :: create function postgresql |
Sql :: remove last characters in mysql |
Sql :: postgresql could not start server mac |
Sql :: create table postgresql |