Home Article Practice MySQL语法练习

MySQL语法练习

2021-07-15 17:13  views:600  source:程序猿    

select dname from dept
select dname,lower(dname) from dept
select dname,lower(dname),upper(dname) from dept
select dname,length(dname),loc,length(loc) from dept
SELECT dname,SUBSTR(dname,2) from dept
SELECT dname,SUBSTR(dname,2,5) from dept
select dname,concat(dname,'hello') from dept
select dname,replace(dname,'a','666') from dept
select comm,ifnull(comm,0) from emp
select now(),year(now()),month(now()),day(now())
select now(),hour(now()),minute(now()),second(now())
select * from dept where loc='二区' and dname='research'
select deptno from dept where loc='二区' and dname='research'
select * from dept where loc='一区' or deptno=3
select count(1),tname from teachers
where tsex='男'
group by tname
select * from students where ssex='女'
select sname,count(1) from students
where ssex='女'
group by class
having count(1)> 1
select * from students order by sbirthday
select min(sbirthday),max(sbirthday) from students
select * from students where year(sbirthday) <
( select avg( year(sbirthday) ) from students )
limit 0,1



Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)