首頁 文章 MySQL语法练习

MySQL语法练习

2021-07-15 17:13  瀏覽數:688  來源:程序猿    

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



聲明:以上文章均為用戶自行添加,僅供打字交流使用,不代表本站觀點,本站不承擔任何法律責任,特此聲明!如果有侵犯到您的權利,請及時聯系我們刪除。

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