1. Show full structure of column in mysql
SHOW FULL COLUMNS FROM math;
mysql> SHOW FULL COLUMNS FROM math;
+--------+---------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+--------+---------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| id | int(10) | NULL | NO | PRI | NULL | | select,insert,update,references | |
| symbol | text | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
+--------+---------+-----------------+------+-----+---------+-------+---------------------------------+---------+
2 rows in set (0.00 sec)
2. Change Collation of table in mysql
ALTER TABLE math CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
3. Reset Auto Increment Id by using following mysql query
ALTER TABLE table_name AUTO_INCREMENT = 1
4. list of all databases .
SHOW databases;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| list_databases |
+--------------------+
2 rows in set (0.00 sec)
5. list of all tables .
SHOW tables;
6. Describe the tables column
DESC table_name;
mysql> DESC math;
+--------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------+------+-----+---------+-------+
| id | int(10) | NO | PRI | NULL | |
| symbol | text | YES | | NULL | |
+--------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)
7. Delete coulumn from table in mysql
ALTER TABLE table_name DROP COLUMN column_name;
No comments:
Post a Comment