1、实验环境。
以实验案例一的结果为环境。
2、需求描述。
【1】查询成本低于10元的水果信息。
【2】将所有蔬菜的成本上调1源。
【3】查询成本大于3元并小于40元的产品信息,并按照成本从高到低的顺序显示结果。
【4】查询成本最高的5个产品信息。
【5】查询有哪些产品种类。
【6】将products表中所有水果的名称、种类和出厂日期信息并插入products_new中。
3、实验步骤。
使用SSMS管理工具连接数据库,然后右键点击PM数据库--点击查询。

1、查询成本低于10元的水果信息。

2、将所有蔬菜的成本上调1元。

**3、查询成本大于3元并小于40元的产品信息,**并按照成本从高到低的顺序显示结果。

4、查询成本最高的5个产品信息。

5、查询有哪些产品种类。

6、将products表中所有水果的名称、种类和出厂日期信息并插入products_new中。

4、命令参考。
##查询成本小于10的所有信息
select * from products
where 成本 <10
------------------------------------------------------------------------------------------
##将数据表中蔬菜的成本加1
update products set 成本 = 成本+1
where 种类 = '蔬菜'
select * from products //查询所有信息
------------------------------------------------------------------------------------------
##查询表中成本小于3并且大于40的数据,再以降序(高到底)显示
select * from products
where 成本 >3 and 成本<40
order by 成本 desc
------------------------------------------------------------------------------------------
##查询表中前5的数据并以降序显示
select top 5 * from products
order by 成本 desc
------------------------------------------------------------------------------------------
##查询表中的种类有几种
select distinct 种类 from products
------------------------------------------------------------------------------------------
##查询表中的数据,然后创建一个新的表products_new并加入查询的数据
select 名称,种类,出厂日期 into products_new from products
select * from products_new