数据库的查询语句

数据库的查询语句,第1张

你的表有问题,请问,一部**是否只有一个演员!怎么来的外键

如果是那么只是两个表的联结,非常的容易的!

select Movietitl,Movieyear,Movielength,Mvoiedirector from Movie join Player on Movieplayactor = PalyerplayerID where Palyername like '_nike_' and Playersex = '男' and birthday < getDate() - 40365

还有,请问你用的是SQL server还是使用的ACCESS这生成的时间语句与时间加减是不一样的,所以只能粗略写一下两个都支持的语句还要看你用的是ACCESS还是SQL SERVER才能写啊!

假设职员表是Personnel

5

select

from [职员表] join [部门表] on [职员表]部门Id = [部门表]id

where

([职员表][类型]='经理' and [部门表][编号]=10)

or ([职员表][类型]='办事员' and [部门表][编号]=20)

6

select

from [职员表] join [部门表] on [职员表]部门Id = [部门表]id

where

([职员表][类型]='经理' and [部门表][编号]=10)

or ([职员表][类型]='办事员' and [部门表][编号]=20)

or ([职员表][类型] not in ('经理', '办事员') and [职员表][薪金]>=2000)

你没有说表结果 我只能猜测下

以下语句 ,在SQL Server 中测试通过,如果你用的别的数据库,可能需要做其他调整

查询女职工平均工资不低于600元的车间名称。

select DNAME

from DEPT

where DEPTDNO in ( select DNO from EMP where SEX = '女' group by DNO having avg(SALARY) >= 600 )

查询各车间中平均工资最低的车间编号

select top 1 DNO

from EMP

group by DNO

order by avg(SALARY)

描述:sql server 数据库中使用条件查询就可以实现符合查询条件的数据记录显示出来。查询语法为:select from 表名 where 字段名=条件(语法说明:select后面的号代表的是所有字段显示出来。条件出的条件如果为字符型条件需要使用单引号引起来,如果是int类型不用引号),以下以某数据中的一张数据表user_user为例子,分别使用两种查询方式:

1、完整条件查询语法为:select from 表名 where 字段名=条件

查询语句:select from user_user where Dname='管理员'

1select sc from sc inner join course on sccno=coursecno where coursecname like '%系统%'

2select asno,bsname,acno,ccname,agrade from sc a right outer join stueent b on asno=bsno inner join course c on acno=bcno where bssex='1'

3update sc set grade=grade+10 where grade<60

4delete from sc where cno in (select cno from course where cname='数据库')

5insert into course_avg select cno,avg(grade) from sc group by cno

6update course_avg set avg_grade=aavggrade from (select cno,avg(grade) as avggrade from sc group by cno

)

SELECT

pid,

ptheme,

picon,

pfid,

puid,

pcontent,

ppublishdate,

fplatename

FROM

t_sys_post AS p

AND t_sys_forum AS f 什么意思

WHERE

id =(

SELECT

max(id)

FROM

t_sys_post

)

以上就是关于数据库的查询语句全部的内容,包括:数据库的查询语句、数据库问题。简单的查询语句、数据库 SQL 查询语句等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/10180822.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-06
下一篇 2023-05-06

发表评论

登录后才能评论

评论列表(0条)

保存