Solved

SQL count used columns

Posted on 2009-07-09
5
260 Views
Last Modified: 2012-05-07
hi there
I want a SQL statement with which i get all views with more than 230 columns AND which shows me which of these columns are explicit used.

any help would be appreciated!
0
Comment
Question by:ALSO_DB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24811575
This would help you fetch table names with more than 230 columns.

SELECT table_name
FROM information_schema.columns
GROUP BY table_name
HAVING count(*) > 230

Kindly explain me what you meant by explicit used..
0
 

Author Comment

by:ALSO_DB
ID: 24811592
I would like to see which columns are used and which are unused.....
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 24811639
>> I would like to see which columns are used and which are unused.....

Kindly tell me what's the criteria to identify whether they are used or unused so that I can try to help you out.
0
 

Author Comment

by:ALSO_DB
ID: 24811691
If the column is filled with data --> the colum is used
if the column is empty --> the column is unused
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24811731
Then you have to use a procedure to loop through all tables and find what are all the list of columns that are used and unused depending upon whether data is present in that table or not.

Can you kindly elaborate on your requirement so that I can think of some other possibilities.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question