- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
(
二〇一六年 四月实验目的
(1)掌握SELECT语句的基本语法;
(2)掌握子查询的表示;
(3)掌握链接查询的表示;
(4)掌握SELECT语句的GROUP BY子句的作用和使用方法;
(5)掌握SELECT语句的ORDER BY子句的作用和使用方法。
实验准备
(1)了解SELECT语句的基本语法格式;
(2)了解SELECT语句的执行方法;
(3)了解子查询的表示方法;
(4)了解连接查询的表示;
了解SELECT语句的GROUP BY子句的作用和使用方法;
了解SELECT语句的ORDER BY子句的作用。
实验程序
(1)基本查询
select * from employees
select Address,PhoneNumber
from Employees
select Address,PhoneNumber
from Employees
where EmployeeID=000001
Go
select Address AS 地址,PhoneNumber AS 电话
from Employees
where Sex=0
select Name AS 姓名,
case
when Sex=1 then男
when Sex=0 then女
END AS 性别
from Employees
select EmployeeID,实际收入=InCome-OutCome
from Salary
select count(*)
from Employees
select DepartmentID
from Employees
where Name LIkE王%
select EmployeeID
from Salary
where InCome between 2000 and 3000
select EmployeeID as 编号,InCome as 收入
INTO 收入在元以上的员工
from Salary
where InCome1500
select *
from Employees
where DepartmentID=
(
select DepartmentID
from Departments
where DepartmentName=财务部
)
select Name
from Employees
where DepartmentID In
(
select departmentID
from Departments
where DepartmentName=财务部
)
AND
Birthday!ALL
(
select Birthday
from Employees
where DepartmentID in
(
select DepartmentID
from Departments
where DepartmentName=研发部
)
)
select Name
from Employees
where EmployeeID IN
(
select EmployeeID
from Salary
where InComeALL
(
select InCome
from Salary
where EmployeeID IN
(
select EmployeeID
from Employees
where DepartmentID=
(
select DepartmentID
from Departments
where DepartmentName=财务部
)
)
)
)
select Employees.*,Salary.*
from Employees,Salary
where Employees.EmployeeID=Salary.EmployeeID
select DepartmentName
from Dep
文档评论(0)