Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to get the number of columns in a table in sql

SELECT count(*)
FROM information_schema.columns
WHERE table_name = 'tbl_ifo'
Comment

get number of columns sql

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';
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql install with docker 
Sql :: postgresql create schema in specific database 
Sql :: mysql inner join 3 tables 
Sql :: date diff sql 
Sql :: delete dublicate rows sql 
Sql :: sql backup database statement 
Sql :: postgres add column integer 
Sql :: sql view where tables have same column name combine results 
Sql :: sql show all users 
Sql :: mysql trim 
Sql :: limit sqlserver 
Sql :: how to print mysql query of codeigniter query builder 
Sql :: import large .sql files into lampp 
Sql :: sql count distinct group by 
Sql :: update using case in mysql 
Sql :: snowflake datetrunc month 
Sql :: create table postgresql foreign key 
Sql :: how to delete user in mysql 
Sql :: datediff in sql server 
Sql :: like in mysql 
Sql :: create stored procedure 
Sql :: clear screen command on mysql 
Sql :: create database sql 
Sql :: show table postgres command 
Sql :: greater than in mongodb query 
Sql :: select milliseconds mysql 
Sql :: mysql show schema 
Sql :: mysql local password denied 
Sql :: sql list dates between two dates 
Sql :: How to add a Try/Catch to SQL Stored Procedure 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =