请高手帮忙 1、select custnm from customer where year(start_dt)=year(getdate()) and month(start_dt)=month(getdate())至于存为sql文件吗,保存时改后缀名即可问题太多了,回答乱 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 create table operator(oper_cd char(4),oper_nm char(4))op01 mikeop02 jikeop03 joe op04 niceop05 jen create table cruise(cruise_cd char(4),cruise_nm char(6),oper_id char(4),des_city char(10),country_nm char(10),duration int,price int,)cr01 北京 op01 北京 中国 7 200cr02 上海 op01 上海 中国 4 300cr03 纽约 op02 纽约 美国 6 4000cr04 巴黎 op03 巴黎 法国 10 8000cr05 桂林线 op05 桂林 中国 2 800create table curise_book( curise_cd char(4), start_dt datetime,tot_seats int,seats_avail int)cr01 2002-07-01 00:00:00.000 50 10cr01 2002-07-05 00:00:00.000 30 8cr01 2002-08-01 00:00:00.000 30 8cr01 2002-08-11 00:00:00.000 40 3cr02 2002-08-11 00:00:00.000 20 3cr03 2002-07-11 00:00:00.000 60 10cr03 2002-09-01 00:00:00.000 56 7cr04 2002-07-17 00:00:00.000 47 6cr04 2002-08-17 00:00:00.000 47 6cr04 2002-09-17 00:00:00.000 47 6cr04 2002-10-17 00:00:00.000 47 6cr05 2002-07-05 00:00:00.000 48 5cr05 2002-07-15 00:00:00.000 48 5cr05 2002-07-25 00:00:00.000 70 58cr05 2002-08-25 00:00:00.000 40 17cr05 2002-08-15 00:00:00.000 40 17create table customer(cust_cd char(6),cust_nm char(8),cruise_cd char(4),start_dt datetime,no_of_per int)cs01 王 cu01 2002-07-15 00:00:00.000 30cs02 李 cu01 2002-07-05 00:00:00.000 10cs03 赵 cu03 2002-09-05 00:00:00.000 10cs04 卫 cu02 2002-08-31 00:00:00.000 40cs05 程 cu05 2002-07-01 00:00:00.000 5cs06 范 cu01 2002-10-01 00:00:00.000 141. select cust_cd,cust_nm,start_dt from customerwhere substring(convert(char(6),start_dt,112),5,2) in (07,08) and convert(char(4),start_dt,112)=datepart(year,getdate())2 select a.cruise_cd, a.cruise_nm,no_of_per*price as totalmoneyfrom cruise a inner join customer b on a.cruise_cd=b.cruise_cdwhere no_of_per*price<200003 select * from operator where oper_cd not in(select a.oper_cd from cruise a inner join customer bon a.cruise_cd=b.cruise_cdwhere convert(char(8),b.start_dt,112)>20021001)4 CREATE CLUSTERED INDEX CLNDX_CRCDNM ON curise_book (curise_cd) WITH FILLFACTOR = 207 create procedure CountryCruise@country_nm char(10)asselect country_nm,duration, price*no_of_per as 价格,tot_seats-seats_avail as 座位数from cruise a inner join customer b on a.cruise_cd=b.cruise_cdinner join curise_book c on a.cruise_cd=c.curise_cdwhere country_nm=@country_nm8 create trigger CheckSeats on customerfor insertasdeclare @cruise_cd char(4)declare @no_of_per intdeclare @start_dt datetimedeclare @tmp intselect @cruise_cd=cruise_cd from insertedselect @no_of_per=no_of_per from insertedselect @start_dt=start_dt from insertedselect @tmp=tot_seats-seats_avail from curise_book where curise_cd=@cruise_cd and start_dt= @start_dtif (@tmp<@no_of_per)BEGIN ROLLBACK TRANSACTIONEND 5 的表述行程是什么 价格为price*no_of_per么 怪了楼主的“号”是中文的呀!是CSDN的新功能吗?? 可能填的是WEB裡面的那個識別碼 语句修改 怎么求出按一定时间间隔(比如秒)的最高和最低值? 如何选择 所有那些 不是以 0 - 9 a - z A-Z 开头的数据 ??? 分组排序 求同一字段出现多值拿符号分隔的方法或SQL语句 怎么在客户端(也就是只能用查询分析器的情况下)能够把DATA下的某个数据库MDF文件导出来到客户端机器上来呢? 请教一下如何在C#的程序中执行T-SQL的数据库脚本,实现数据库复制? 求助 ADO写数据入数据库问题(在线等待,急急急) PLSQL表的排序问题 我老问题. 求教各位大哥!!
create table operator(
oper_cd char(4),
oper_nm char(4)
)op01 mike
op02 jike
op03 joe
op04 nice
op05 jen create table cruise(
cruise_cd char(4),
cruise_nm char(6),
oper_id char(4),
des_city char(10),
country_nm char(10),
duration int,
price int,
)
cr01 北京 op01 北京 中国 7 200
cr02 上海 op01 上海 中国 4 300
cr03 纽约 op02 纽约 美国 6 4000
cr04 巴黎 op03 巴黎 法国 10 8000
cr05 桂林线 op05 桂林 中国 2 800create table curise_book
( curise_cd char(4),
start_dt datetime,
tot_seats int,
seats_avail int)cr01 2002-07-01 00:00:00.000 50 10
cr01 2002-07-05 00:00:00.000 30 8
cr01 2002-08-01 00:00:00.000 30 8
cr01 2002-08-11 00:00:00.000 40 3
cr02 2002-08-11 00:00:00.000 20 3
cr03 2002-07-11 00:00:00.000 60 10
cr03 2002-09-01 00:00:00.000 56 7
cr04 2002-07-17 00:00:00.000 47 6
cr04 2002-08-17 00:00:00.000 47 6
cr04 2002-09-17 00:00:00.000 47 6
cr04 2002-10-17 00:00:00.000 47 6
cr05 2002-07-05 00:00:00.000 48 5
cr05 2002-07-15 00:00:00.000 48 5
cr05 2002-07-25 00:00:00.000 70 58
cr05 2002-08-25 00:00:00.000 40 17
cr05 2002-08-15 00:00:00.000 40 17
create table customer(
cust_cd char(6),
cust_nm char(8),
cruise_cd char(4),
start_dt datetime,
no_of_per int)
cs01 王 cu01 2002-07-15 00:00:00.000 30
cs02 李 cu01 2002-07-05 00:00:00.000 10
cs03 赵 cu03 2002-09-05 00:00:00.000 10
cs04 卫 cu02 2002-08-31 00:00:00.000 40
cs05 程 cu05 2002-07-01 00:00:00.000 5
cs06 范 cu01 2002-10-01 00:00:00.000 141. select cust_cd,cust_nm,start_dt from customer
where substring(convert(char(6),start_dt,112),5,2) in (07,08)
and convert(char(4),start_dt,112)=datepart(year,getdate())
2 select a.cruise_cd, a.cruise_nm,no_of_per*price as totalmoney
from cruise a inner join customer b on a.cruise_cd=b.cruise_cd
where no_of_per*price<200003 select * from operator where oper_cd not in(
select a.oper_cd from cruise a inner join customer b
on a.cruise_cd=b.cruise_cd
where convert(char(8),b.start_dt,112)>20021001
)4 CREATE CLUSTERED INDEX CLNDX_CRCDNM
ON curise_book (curise_cd)
WITH FILLFACTOR = 20
7 create procedure CountryCruise
@country_nm char(10)
asselect country_nm,duration, price*no_of_per as 价格,tot_seats-seats_avail as 座位数
from cruise a inner join customer b on a.cruise_cd=b.cruise_cd
inner join curise_book c on a.cruise_cd=c.curise_cd
where country_nm=@country_nm
8 create trigger CheckSeats on customer
for insert
asdeclare @cruise_cd char(4)
declare @no_of_per int
declare @start_dt datetime
declare @tmp int
select @cruise_cd=cruise_cd from inserted
select @no_of_per=no_of_per from inserted
select @start_dt=start_dt from insertedselect @tmp=tot_seats-seats_avail from curise_book
where curise_cd=@cruise_cd and start_dt= @start_dt
if (@tmp<@no_of_per)
BEGIN
ROLLBACK TRANSACTION
END