MySQL में विशिष्ट कॉलम छोड़कर बाकी कॉलम मेटाडेटा देखना
SHOW COLUMNS या DESC के साथ WHERE Field NOT IN (...) क्लॉज जोड़कर अवांछित कॉलम बाहर कर सकते हैं।
सिंटैक्स
SHOW COLUMNS FROM table_name WHERE Field NOT IN ('col1', 'col2', ...);
उदाहरण
CREATE TABLE student_Information (
StudentId INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
StudentName VARCHAR(50),
StudentAge INT,
StudentAddress VARCHAR(100),
StudentAllSubjectScore INT
);
सभी कॉलम देखना
DESC student_Information;
+------------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------------+--------------+------+-----+---------+----------------+ | StudentId | int(11) | NO | PRI | NULL | auto_increment | | StudentName | varchar(50) | YES | | NULL | | | StudentAge | int(11) | YES | | NULL | | | StudentAddress | varchar(100) | YES | | NULL | | | StudentAllSubjectScore | int(11) | YES | | NULL | | +------------------------+--------------+------+-----+---------+----------------+
कुछ कॉलम छुपाना
SHOW COLUMNS FROM student_Information
WHERE Field NOT IN ('StudentAddress', 'StudentAllSubjectScore');
आउटपुट
+-------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+----------------+ | StudentId | int(11) | NO | PRI | NULL | auto_increment | | StudentName | varchar(50) | YES | | NULL | | | StudentAge | int(11) | YES | | NULL | | +-------------+-------------+------+-----+---------+----------------+
वैकल्पिक: INFORMATION_SCHEMA.COLUMNS
SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_KEY, COLUMN_DEFAULT, EXTRA
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'your_db' AND TABLE_NAME = 'student_Information'
AND COLUMN_NAME NOT IN ('StudentAddress', 'StudentAllSubjectScore');
यह अधिक लचीला है (क्रम, फ़िल्टर, जॉइन संभव)।