MySQL查询语句

1.固定语法

select * from 表名
--*代表查询‘结果’
1.  若后边有查询条件,则*代表所有可能结果;比如select name/* from 表名 where age ='11';为查询年龄为11的姓名/所有字段
2.  若后边无条件,则*代表所有查询内容(其实也是查询结果)select * from 表名;
--  select from 为固定语法,表示从表中查询
##select from 中间为查询结果,不可为age = '11'这样的条件
##有筛选条件,where不可望,where后边跟筛选条件

2.扩展

1.select * from 表名 where name = 'xiaoming' and age = '11';
--where为固定连词,后跟条件
--and/or为多条件筛选
其他变形形式:
select * from 表名 where age = '11';
select * from 表名 where name = 'xiaoming';
select * from 表名 where name = 'xiaoming' and/or age = '11';

##select name from 表名 where age = '11';
--查询年龄为11的名字
  
##所有代码在英文状态下,保持空格一致
posted @ 2020-01-07 15:55  python界泥石流  阅读(456)  评论(0编辑  收藏  举报