建表示例:
mysql个人使用以及细节

图片来源https://blog.csdn.net/weixin_37909391/article/details/81317723

1. NOT NULL DEFALUT 或者 DEFALUT
2. 类型括号内的长度是字符长度非字节长度
3. 自增:AUTO_INCREMENT
4. 注释
(1)字段注释:COMMENT ’ 注释’
(2)表名注释:COMMENT = '注释’

5. 数据库基本操作:
增:insert into 表名(字段1, 字段2,字段3,…) values(值1,值2,值3,…)
改:update 表名 set 字段1=值,字段2=值…
删:delete from 表名 [where] [order by] [limit]
查:select * 或者[字段名] from 表名
distinct去重:select distinct 字段名 from 表名
limit 指定结果行数: select 字段名 from 表名 limit [n]
order by 结果排序: select * from 表名 order by 字段名 desc [desc降序| asc升序]
ps: order by默认是升序

数据库索引不能太多:索引过多会增加开销,而插入,删除,更新也会增加开销,
所以,频繁进行数据库操作的表不要设置太多索引。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2021-04-09
  • 2021-09-06
  • 2021-12-23
  • 2021-06-11
猜你喜欢
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
相关资源
相似解决方案