(4)将room表中客房价格按90%价格显示,并且将价格列名改为‘调价后价格’。 select调价后价格=price*0.9 from room
(5)查询customer表中的客户信息,并以姓名、电话、地址作为列名。 Select Customername as 姓名,tel as 电话,address as 地址 from customer Select Customername姓名,tel电话, address 地址 from customer Select 姓名=Customername,电话=tel, 地址=address from customer
(6)查询room表,显示客房价格在150到200之间的客房信息。 Select * from room
Where price between 150 and 200
(7)从客房表中找出客房价格大于200的客房信息,并按照升序和降序显示。 Select * from room
Where price>200 order by price desc Select * from room
Where price>200 order by price asc
(8)找出姓王的所有客户。 Select * from customer
Where customername like '%王%'
(9)查询预订天数大于2天的所有客户的姓名,年龄,证件名称,证件号码和预订的房间号和房间等级。
Select customername,age,cardname,grade,room.roomid,customer.cardid From orderdetail join room on orderdetail.roomid=room.roomid Join customer on customer.customerid=orderdetail.customerid Where days>2
selectcustomername,age,cardname,grade,b.roomid,cardid from orderdetail a join room b on a.roomid=b.roomid join customer c on c.customerid=a.customerid where days>2
(10)查询客户地址在成都的客户所预定的房间号,房间价格和房间等级 Select room.roomid,price,grade
From orderdetail join room on orderdetail.roomid=room.roomid Join customer on customer.customerid=orderdetail.customerid Where address like '%成都%'
Select b.roomid,price,grade from orderdetail a join room b on a.roomid=b.roomid Join customer c on c.customerid=a.customerid Where address like '%成都%'
Select roomid,price,grade from room Where roomid in
(selectroomid from orderdetail Where customerid in
(selectcustomerid from customer Where address like '%成都%') )