【create, drop database and alter/modify the traits of table column】
2023-12-21 23:37:49
create, drop database and alter/modify the traits of table column
mysql> create database Dec21th2023_a DEFAULT CHARACTER SET utf8;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| Dec21th2023_a |
| mysql |
| pbootcms |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.00 sec)
mysql> drop database Dec21th2023_a;
Query OK, 0 rows affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| pbootcms |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> create database Dec21th2023_a DEFAULT CHARACTER SET utf8;
Query OK, 1 row affected (0.00 sec)
mysql> describe subject;
+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| subject_id | int(11) | YES | | NULL | |
| subject_name | varchar(20) | YES | | NULL | |
| subject_hours | int(11) | YES | | NULL | |
+---------------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> ALTER TABLE subject COLUMN subject_id int PRIMARY KEY AUTO_INCREMENT;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLUMN subject_id int PRIMARY KEY AUTO_INCREMENT' at line 1
mysql> ALTER TABLE subject MODIFY COLUMN subject_id int PRIMARY KEY AUTO_INCREMENT;
文章来源:https://blog.csdn.net/DavidsonGong/article/details/135142273
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!