单表查询

本文介绍了使用SQL进行各种查询的方法,包括基本的全字段查询、特定字段查询、带条件的查询及排序等,帮助读者掌握SQL查询的基本技能。

select * from Customers---显示所有消费者的所有信息--------

-----显示消费者的特定信息--------

select c_ID,c_Name,c_TrueName,c_Password from Customers

select c_ID,c_Name,c_TrueName,c_Password, year(getdate())-year(c_birth) from Customers

select c_ID as '会员编号',c_Name as '用户名',c_TrueName as '真实姓名', c_Password as '密码',year(getdate())-year(c_birth) as '年龄' from Customers

select * from Customers where c_Type='VIP'

select c_ID as '编号',c_Name as '姓名',c_birth as '出生日期', c_address as '籍贯',c_phone as '联系电话',c_email as '地址' from Customers where c_Type='VIP'

select * from Customers where c_Type='VIP'and c_address like '湖南%'

select top 10 percent * from Customers

select * from Customers where c_TrueName like '刘%'

select * from Customers order by year(getdate())-year(c_birth) desc

select * from Customers order by c_Type,year(getdate())-year(c_birth) desc

 

转载于:https://www.cnblogs.com/1992duanduan/archive/2013/04/19/3031246.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值