To count a number of columns or fields is very simple and you have to have an idea about your database and table.
Let’s see the MySQL query to count the number of columns in MySQL
SELECT COUNT(*) AS Columns FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = 'database name' AND table_name = 'table name'
If you want to count number of columns in a table then execute above query with your database name and table name.
That’s it. 🙂
I hope that all makes sense. It can be a very simple to grasp at first, but if you have any trouble at all just drop me a comment and I’ll try my best to help you, don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.