MySQL(二)

字符集

一般创建数据库或者表时要指定其字符集。插入表的内容会采用就近原则(MySQL默认字符集、数据库字符集、表的字符集)。

MySQL数据类型

  • 整型 :十进制 十六进制 八进制
  • 浮点数
  • 字符串型 :“zoujidi”、“”由0个或多个字符串组成的数据
  • null:不确定的值

整型

  • tinyint 1字节 -128~127(有符号范围) 0~255(无符号范围) 小整数(用途)
  • smallint 2字节 -32768~32767
  • mediumint
  • int
  • bigint
  • unsigned 用于定义无符号类型,即非负整型

    浮点数类型

  • float 单精度 4字节

  • double双精度 8字节 (decimal(M,N)M表示显示长度N表示小数长度)
select if(sex,"男生","女生") as stusex,sname from student;
alert table student add birthday date;
update student set birthday="1995/10/08" where id=1;
select * from student order by id desc(asc) limit 2;
select distinct year(birthday) as "学生出生年份" from student;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值