MySQL

在windows下表和数据库的大小写不相关,在unix下相关

1.Limit 关键字
limit 1 和limit 0,1 是一样的,表示返回一条记录,即第一条记录
limit 1,1 表示偏移量为1,返回记录谁为1,即返回第二条记录。

例如:select * from sales order by comission desc limit 2,3


增删改查
insert into person values('张三','男',22) 或者insert into person(name,sex,age) values('张三','男',22)

delete from person where name = '张三'

update person set age = 23  wehre name = '张三'

select * from person

新建表和数据库create,删除表和数据库drop

新增一列 alter table person add year_born date
更改列定义:alter table person change year_born brithday
删除列: alter table person drop year_born
为表重新命名 alter table person person rename personinformation   或rename to  或 rename old table to newtable


查询的时候字符串结尾的空格会被忽略 select 'abc' = 'ABC '

insert into person(firstname,lastname,sex) select first_name,surname,sum from sales

原文地址:https://www.cnblogs.com/xiangzhong/p/2819527.html