当前位置:   article > 正文

mysql 创建、修改、删除表_mysql create or replace table

mysql create or replace table

1.主键设置在中间,在末尾都可以,例如:

  1. mysql> CREATE TABLE example4 (
  2. stu_id integer,
  3. grade float,
  4. stu_name varchar(100),
  5. primary key(stu_id,stu_name),
  6. favourite text );
  7. Query OK, 0 rows affected (0.02 sec)

2.varchar 类型必须指明长度,否则会报错,例如:

  1. CREATE TABLE example3
  2. (
  3. stu_id int,
  4. grade float,
  5. stu_name varchar,
  6. favourite text,
  7. primary key(stu_id,stu_name)
  8. );
  9. 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 ', favourite text,primary key(stu_id,stu_name))' at line 1

3.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/775716
推荐阅读
相关标签
  

闽ICP备14008679号