SqlServer Case When用法

SqlServer Case When用法
SqlServer Case When用法

SQL中Case的使用方法(上篇)

Case具有两种格式。简单Case函数和Case搜索函数。

--简单Case函数

CASE sex

WHEN'1'THEN'男'

WHEN'2'THEN'女'

ELSE'其他'END

--Case搜索函数

CASE WHEN sex ='1'THEN'男'

WHEN sex ='2'THEN'女'

ELSE'其他'END

这两种方式,可以实现相同的功能。简单Case函数的写法相对比较简洁,但是和Case搜索函数相比,功能方面会有些限制,比如写判断式。

还有一个需要注意的问题,Case函数只返回第一个符合条件的值,剩下的Case部分将会被自动忽略。

--比如说,下面这段SQL,你永远无法得到“第二类”这个结果

CASE WHEN col_1 IN('a','b')THEN'第一类'

WHEN col_1 IN('a')THEN'第二类'

ELSE'其他'END

下面我们来看一下,使用Case函数都能做些什么事情。

一,已知数据按照另外一种方式进行分组,分析。

有如下数据:(为了看得更清楚,我并没有使用国家代码,而是直接用国家名作为Primary Key)国家(country)人口(population)

中国600

美国100

加拿大100

英国200

法国300

日本250

德国200

墨西哥50

印度250

根据这个国家人口数据,统计亚洲和北美洲的人口数量。应该得到下面这个结果。

洲人口

亚洲1100

北美洲250

其他700

想要解决这个问题,你会怎么做?生成一个带有洲Code的View,是一个解决方法,但是这样很难动态的改变统计的方式。

如果使用Case函数,SQL代码如下:

SELECT SUM(population),

CASE country

WHEN'中国'THEN'亚洲'

WHEN'印度'THEN'亚洲'

WHEN'日本'THEN'亚洲'

WHEN'美国'THEN'北美洲'

WHEN'加拿大'THEN'北美洲'

WHEN'墨西哥'THEN'北美洲'

ELSE'其他'END

FROM Table_A

GROUP BY CASE country

WHEN'中国'THEN'亚洲'

WHEN'印度'THEN'亚洲'

WHEN'日本'THEN'亚洲'

WHEN'美国'THEN'北美洲'

WHEN'加拿大'THEN'北美洲'

WHEN'墨西哥'THEN'北美洲'

ELSE'其他'END;

同样的,我们也可以用这个方法来判断工资的等级,并统计每一等级的人数。SQL代码如下;

SELECT

CASE WHEN salary <= 500 THEN'1'

WHEN salary > 500 AND salary <= 600 THEN'2'

WHEN salary > 600 AND salary <= 800 THEN'3'

WHEN salary > 800 AND salary <= 1000 THEN'4'

ELSE NULL END salary_class,

COUNT(*)

FROM Table_A

GROUP BY

CASE WHEN salary <= 500 THEN'1'

WHEN salary > 500 AND salary <= 600 THEN'2'

WHEN salary > 600 AND salary <= 800 THEN'3'

WHEN salary > 800 AND salary <= 1000 THEN'4'

ELSE NULL END;

二,用一个SQL语句完成不同条件的分组。

有如下数据

国家(country)性别(sex)人口(population)

中国1 340

中国2 260

美国1 45

美国2 55

加拿大1 51

加拿大2 49

英国1 40

英国2 60

按照国家和性别进行分组,得出结果如下

国家男女

中国340 260

美国45 55

加拿大51 49

英国40 60

普通情况下,用UNION也可以实现用一条语句进行查询。但是那样增加消耗(两个Select部分),而且SQL语句会比较长。

下面是一个是用Case函数来完成这个功能的例子

SELECT country,

SUM(CASE WHEN sex ='1'THEN

population ELSE 0 END),--男性人口

SUM(CASE WHEN sex ='2'THEN

population ELSE 0 END)--女性人口

FROM Table_A

GROUP BY country;

这样我们使用Select,完成对二维表的输出形式,充分显示了Case函数的强大。

三,在Check中使用Case函数。

在Check中使用Case函数在很多情况下都是非常不错的解决方法。可能有很多人根本就不用Check,那么我建议你在看过下面的例子之后也尝试一下在SQL中使用Check。

下面我们来举个例子

公司A,这个公司有个规定,女职员的工资必须高于块。如果用Check和Case来表现的话,如下所示

CONSTRAINT check_salary CHECK

(CASE WHEN sex ='2'

THEN CASE WHEN salary > 1000

THEN 1 ELSE 0 END

ELSE 1 END= 1 )

如果单纯使用Check,如下所示

CONSTRAINT check_salary CHECK

( sex ='2'AND salary > 1000 )

女职员的条件倒是符合了,男职员就无法输入了。

四,根据条件有选择的UPDATE。

例,有如下更新条件

工资以上的职员,工资减少%

工资在到之间的职员,工资增加%

很容易考虑的是选择执行两次UPDATE语句,如下所示

--条件

UPDATE Personnel

SET salary = salary * 0.9

WHERE salary >= 5000;

--条件

UPDATE Personnel

SET salary = salary * 1.15

WHERE salary >= 2000 AND salary < 4600;

但是事情没有想象得那么简单,假设有个人工资块。首先,按照条件,工资减少%,变成工资。接下来运行第二个SQL时候,因为这个人的工资是在到的范围之内,需增加%,最后这个人的工资结果是,不但没有减少,反而增加了。如果要是反过来执行,那么工资的人相反会变成减少工资。暂且不管这个规章是多么荒诞,如果想要一个SQL 语句实现这个功能的话,我们需要用到Case函数。代码如下:

UPDATE Personnel

SET salary =CASE WHEN salary >= 5000

THEN salary * 0.9

WHEN salary >= 2000 AND salary < 4600

THEN salary * 1.15

ELSE salary END;

这里要注意一点,最后一行的ELSE salary是必需的,要是没有这行,不符合这两个条件的人的工资将会被写成NUll,那可就大事不妙了。在Case函数中Else部分的默认值是NULL,这点

是需要注意的地方。

这种方法还可以在很多地方使用,比如说变更主键这种累活。

一般情况下,要想把两条数据的Primary key,a和b交换,需要经过临时存储,拷贝,读回数据的三个过程,要是使用Case函数的话,一切都变得简单多了。

p_key col_1 col_2

a 1 张三

b 2 李四

c 3 王五

假设有如上数据,需要把主键a和b相互交换。用Case函数来实现的话,代码如下

UPDATE SomeTable

SET p_key =CASE WHEN p_key ='a'

THEN'b'

WHEN p_key ='b'

THEN'a'

ELSE p_key END

WHERE p_key IN('a','b');

同样的也可以交换两个Unique key。需要注意的是,如果有需要交换主键的情况发生,多半是当初对这个表的设计进行得不够到位,建议检查表的设计是否妥当。

五,两个表数据是否一致的检查。

Case函数不同于DECODE函数。在Case函数中,可以使用BETWEEN,LIKE,IS

NULL,IN,EXISTS等等。比如说使用IN,EXISTS,可以进行子查询,从而实现更多的功能。下面具个例子来说明,有两个表,tbl_A,tbl_B,两个表中都有keyCol列。现在我们对两个表进行比较,tbl_A中的keyCol列的数据如果在tbl_B的keyCol列的数据中可以找到,返回结果'Matched',如果没有找到,返回结果'Unmatched'。

要实现下面这个功能,可以使用下面两条语句

--使用IN的时候

SELECT keyCol,

CASE WHEN keyCol IN(SELECT keyCol FROM tbl_B )

THEN'Matched'

ELSE'Unmatched'END Label

FROM tbl_A;

--使用EXISTS的时候

SELECT keyCol,

CASE WHEN EXISTS(SELECT*FROM tbl_B

WHERE tbl_A.keyCol = tbl_B.keyCol )

THEN'Matched'

ELSE'Unmatched'END Label

FROM tbl_A;

使用IN和EXISTS的结果是相同的。也可以使用NOT IN和NOT EXISTS,但是这个时候要注意NULL的情况。

六,在Case函数中使用合计函数

假设有下面一个表

学号(std_id)课程ID(class_id)课程名(class_name)主修flag

(main_class_flg)

100 1 经济学Y

100 2 历史学N

200 2 历史学N

200 3 考古学Y

200 4 计算机N

300 4 计算机N

400 5 化学N

500 6 数学N

有的学生选择了同时修几门课程(100,200)也有的学生只选择了一门课程(300,400,500)。选修多门课程的学生,要选择一门课程作为主修,主修flag里面写入Y。只选择一门课程的学生,主修flag为N(实际上要是写入Y的话,就没有下面的麻烦事了,为了举例子,还请多多包含)。现在我们要按照下面两个条件对这个表进行查询

只选修一门课程的人,返回那门课程的ID

选修多门课程的人,返回所选的主课程ID

简单的想法就是,执行两条不同的SQL语句进行查询。

条件

--条件:只选择了一门课程的学生

SELECT std_id,MAX(class_id)AS main_class

FROM Studentclass

GROUP BY std_id

HAVING COUNT(*)= 1;

执行结果

STD_ID MAIN_class

------ ----------

300 4

400 5

500 6

条件

--条件:选择多门课程的学生

SELECT std_id, class_id AS main_class

FROM Studentclass

WHERE main_class_flg ='Y';

执行结果

STD_ID MAIN_class

------ ----------

100 1

200 3

如果使用Case函数,我们只要一条SQL语句就可以解决问题,具体如下所示

SELECT std_id,

CASE WHEN COUNT(*)= 1 --只选择一门课程的学生的情况

THEN MAX(class_id)

ELSE MAX(CASE WHEN main_class_flg ='Y'

THEN class_id

ELSE NULL END

)

END AS main_class

FROM Studentclass

GROUP BY std_id;

运行结果

STD_ID MAIN_class

------ ----------

100 1

200 3

300 4

400 5

500 6

通过在Case函数中嵌套Case函数,在合计函数中使用Case函数等方法,我们可以轻松的解决这个问题。使用Case函数给我们带来了更大的自由度。

最后提醒一下使用Case函数的新手注意不要犯下面的错误

CASE col_1

WHEN 1 THEN'Right'

WHEN NULL THEN'Wrong'

END

在这个语句中When Null这一行总是返回unknown,所以永远不会出现Wrong的情况。因为这句可以替换成WHEN col_1 =NULL,这是一个错误的用法,这个时候我们应该选择用WHEN col_1 IS NULL。

感官动词和使役动词

感官动词和使役动词 默认分类2010-05-28 23:14:26 阅读46 评论0 字号:大中小订阅 使役动词,比如let make have就是3个比较重要的 have sb to do 没有这个用法的 只有have sb doing.听凭某人做某事 have sb do 让某人做某事 have sth done 让某事被完成(就是让别人做) 另外: 使役动词 1.使役动词是表示使、令、让、帮、叫等意义的不完全及物动词,主要有make(使,令), let(让), help(帮助), have(叫)等。 2.使役动词后接受词,再接原形不定词作受词补语。 He made me laugh. 他使我发笑。 I let him go. 我让他走开。 I helped him repair the car. 我帮他修理汽车。 Please have him come here. 请叫他到这里来。 3.使役动词还可以接过去分词作受词补语。 I have my hair cut every month. 我每个月理发。 4.使役动词的被动语态的受词补语用不定词,不用原形不定词。 (主)He made me laugh. 他使我笑了。 (被)I was made to laugh by him. 我被他逗笑了。 使役动词有以下用法: a. have somebody do sth让某人去做某事 ??i had him arrange for a car. b. have somebody doing sth.让某人持续做某事。 ??he had us laughing all through lunch. 注意:用于否定名时,表示“允许” i won't have you running around in the house. 我不允许你在家里到处乱跑。 ******** 小议“使役动词”的用法 1. have sb do 让某人干某事 e.g:What would you have me do? have sb/sth doing 让某人或某事处于某种状态,听任 e.g: I won't have women working in our company. The two cheats had the light burning all night long. have sth done 让别人干某事,遭受到 e.g:you 'd better have your teeth pulled out. He had his pocket picked. notes: "done"这个动作不是主语发出来的。 2.make sb do sth 让某人干某事 e.g:They made me repeat the story. What makes the grass grow?

The way常见用法

The way 的用法 Ⅰ常见用法: 1)the way+ that 2)the way + in which(最为正式的用法) 3)the way + 省略(最为自然的用法) 举例:I like the way in which he talks. I like the way that he talks. I like the way he talks. Ⅱ习惯用法: 在当代美国英语中,the way用作为副词的对格,“the way+ 从句”实际上相当于一个状语从句来修饰整个句子。 1)The way =as I am talking to you just the way I’d talk to my own child. He did not do it the way his friends did. Most fruits are naturally sweet and we can eat them just the way they are—all we have to do is to clean and peel them. 2)The way= according to the way/ judging from the way The way you answer the question, you are an excellent student. The way most people look at you, you’d think trash man is a monster. 3)The way =how/ how much No one can imagine the way he missed her. 4)The way =because

初中英语考点 in_on_at_区别用法

in on at 区别用法 妙计口诀 1.早、午、晚要用in, at黎明、午夜、点与分。 年、月、年月、季节、周, 阳光、灯、影、衣、帽用in。 将来时态in...以后, 小处at大处in。 有形with无形by, 语言、单位、材料in。 特征、方面与方式, 心情成语惯用in。 介词at和to表方向, 攻击、位置、恶、善分。 2.日子、日期、年月日,星期加上早、午、晚, 收音、农场、值日on,关于、基础、靠、著论。 着、罢、出售、偷、公、假,故意、支付、相反,准。 特定时日和“一……就”,on后常接动名词。 年、月、日加早、午、晚,of之前on代in。 步行、驴、马、玩笑on,cab,carriage则用in。 at山脚、门口、在当前,速、温、日落、价、核心。 如大体掌握上面介词用法口诀,就不易出错。下面对该口诀分别举例帮助你理解消化。 <1.>关于时间 早、午、晚要用in in the evening 在晚上 in the day 在白天 例: in the afternoon 在下午 in the morning 在早上 at黎明、午、夜、点与分 例 at dawn /at daybreak 在黎明时候 at night 在夜间 at noon 在中午 at midnight 在午夜 (以上短语都不用冠词)

at nine o'clock 在9点钟 at half past ten 在10点半 at ten thirty a.m. 在上午10点30分 at the weekend 在周末 at a quarter to two 1点45分 <2.>关于年、月、年月、季节、周 即在“来年”,在“某月”,在“某年某月” 但在某年某月某日则用on ,在四季,在第几周等都要用in。 in 1927 在1927年 in March 在三月 in December 1986 在1986年12月 in July l984 在1984年7月 in the first week of this semester这学期的第一周 in the third week 在第三周 in spring 在春季 <3.>关于日子、日期、年月日,星期加上早午晚 以下皆用on on October the first 1949 1949年10月1日 on May the first 5月1日 on the sixteenth 16号 on the second of January /on January the second 1月2日 on a summer evening 在夏天的一个夜晚 on New Year's Day 在元旦 on my birthday 在我的生日 on winter day 在冬天 on December 12th 1950 l950年12月12日 on Sunday 在星期天 on Tuesday morning 星期二早晨 但last night 昨夜;in the evening 在晚上 on time准时,in time及时,等则不同。 【注】in the Christmas holidays在圣诞节假期 in the eighteenth century 在十八世纪 in ancient times 在古代 in earlier times 在早期 in modern times 在现代,则用in,at the present time 现在,at the present day当今则用at。 <4.>关于年月日,加早午晚,of之前on代in on the morning of 18th 18日早晨 On the eve of their departure在临行前夕 <5.>阳光、灯、影、衣、冒 in

感官动词的用法

感官动词 1.see, hear, listen to, watch, notice等词,后接宾语,再接省略to的动词不定式或ing形式。前者表全过程,后者表正在进行。句中有频率词时,以上的词也常跟动词原形。 注释:省略to的动词不定式--to do是动词不定式,省略了to,剩下do,其形式和动词原形是一样的,但说法不同。 see sb do sth 看到某人做了某事 see sb doing sth 看到某人在做某事 hear sb do sth 听到某人做了某事 hear sb doing sth 听到某人在做某事 以此类推... I heard someone knocking at the door when I fell asleep. (我入睡时有人正敲门,强调当时正在敲门) I heard someone knock at the door three times. (听到有人敲门的全过程) I often watch my classmates play volleyball after school. (此处有频率词often) (了解)若以上词用于被动语态,须将省略的to还原: see sb do sth----sb be seen to do sth hear sb do sth----sb be seen to do sth 以此类推... We saw him go into the restaurant. → He was seen to go into the restaurant. I hear the boy cry every day. → The boy is heard to cry every day. 2.感官动词look, sound, smell, taste, feel可当系动词,后接形容词。 He looks angry. His explanation sounds reasonable. The cakes smell nice.

The way的用法及其含义(二)

The way的用法及其含义(二) 二、the way在句中的语法作用 the way在句中可以作主语、宾语或表语: 1.作主语 The way you are doing it is completely crazy.你这个干法简直发疯。 The way she puts on that accent really irritates me. 她故意操那种口音的样子实在令我恼火。The way she behaved towards him was utterly ruthless. 她对待他真是无情至极。 Words are important, but the way a person stands, folds his or her arms or moves his or her hands can also give us information about his or her feelings. 言语固然重要,但人的站姿,抱臂的方式和手势也回告诉我们他(她)的情感。 2.作宾语 I hate the way she stared at me.我讨厌她盯我看的样子。 We like the way that her hair hangs down.我们喜欢她的头发笔直地垂下来。 You could tell she was foreign by the way she was dressed. 从她的穿著就可以看出她是外国人。 She could not hide her amusement at the way he was dancing. 她见他跳舞的姿势,忍俊不禁。 3.作表语 This is the way the accident happened.这就是事故如何发生的。 Believe it or not, that's the way it is. 信不信由你, 反正事情就是这样。 That's the way I look at it, too. 我也是这么想。 That was the way minority nationalities were treated in old China. 那就是少数民族在旧中

at,in与on的用法区别

at, in与on的用法区别 1. 表示时间,注意以下用法: ①表示时间的某一点、某一时刻或年龄等用at: I get up at six in the morning. 我早上六点钟起床。 He got married at the age of 25. 他25 岁结婚。 ②泛指一般意义的上午、下午或晚上以及月或年等较长的时间,一般用in:We watch TV in the evening. 我们晚上看电视。 He went to Japan in 1946. 他于1946 去了日本。 ③若表示星期几或某一特定的日期,则用on: He left here on the fifth of May. 他于5 月5 日离开这儿。 2. 表示地点、场所、位置等,注意以下用法: ①表示某一点位置,用at: We live at No 87 Beijing Road. 我们住在北京路87 号。 The hospital is at the end of the street. 医院在这条街的尽头。 与名词所有格连用表示地点,也用at。如: at my sister’s 在我姐姐家 at the doctor’s 在医务室 ②表示空间或范围,用in: What’s in the box? 这盒子里有什么? He lives in Paris with his wife. 他同他妻子住在巴黎。 但有时两者可换用:

The meeting was held at [in] the hotel. 会议在宾馆举行。 ③at与in的另一个区别是:at多用于指较小的地方,而in多用于指较大的地方:in Shanghai 在上海at the station 在车站 ④介词on 用于地点,主要指在某物的表面: What’s on the table? 桌上有什么? There’s a wallet lying on the ground. 地上有个钱包。 【注】在少数搭配中,也用介词on: He works on a farm. 他在农场工作。 3. 在某些搭配中,三者的区别与英国英语和美国英语有关: in the street (英) / on the street (美) 在街上 in the road (英) / on the road (美) 在路上 in the team (英) / on the team (美) 在这个队 at the weekend (英) / on the weekend (美) 在周末 at weekends (英) / on weekends (美) 在周末 4. 有时三者的差别与搭配习惯和用法有关: in bed / on the bed 在床上 in the tree (多指树外之物) / on the tree (多指树本身之物) 在树上

英语中感官动词的用法

英语中感官动词的用法 一、感官动词 1、感官动词(及物动词)有:see/notice/look at/watch/observe/listen to/hear/feel(Vt)/taste(Vt)/smell(Vt) 2、连缀动词(含感官不及物动词) be/get/become/feel/look/sound/smell/taste/keep/stay/seem/ appear/grow/turn/prove/remain/go/run 二、具体用法: 1、see, hear, smell, taste, feel,这五个动词均可作连系动词,后面接形容词作表语,说明主语所处的状态。其意思分别为"看/听/闻/尝/摸起来……"。除look之外,其它几个动词的主语往往是物,而不是人。 例如:These flowers smell very sweet.这些花闻起来很香。 The tomatoes feel very soft.这些西红柿摸起来很软。 2、这些动词后面也可接介词like短语,like后面常用名词。 例如:Her idea sounds like fun.她的主意听起来很有趣。 3、这五个感官动词也可作实义动词,除look(当"看起来……"讲时)只能作不及物动词外,其余四个既可作及物动词也可作不及物动词,此时作为实义动词讲时其主语一般为人。 例如:She smelt the meat.她闻了闻那块肉。 I felt in my pocket for cigarettes.我用手在口袋里摸香烟。 4、taste, smell作不及物动词时,可用于"t aste / smell + of +名词"结构,意为"有……味道/气味"。 例如:The air in the room smells of earth.房间里的空气有股泥土味。 5、它们(sound除外)可以直接作名词,与have或take构成短语。 例如:May I have a taste of the mooncakes?我可以尝一口这月饼吗?taste有品位、味道的意思。 例如:I don’t like the taste of the garlic.我不喜欢大蒜的味道。 She dresses in poor taste.她穿着没有品位。 look有外观,特色的意思,例:The place has a European look.此地具有欧洲特色。 feel有感觉,感受的意思,watch有手表,观察的意思。例:My watch is expensive.我的手表很贵。 6、其中look, sound, feel还能构成"look / sound / feel + as if +从句"结构,意为"看起来/听起来/感觉好像……"。 例如:It looks as if our class is going to win.看来我们班好像要获胜了。 7、感官动词+do与+doing的区别: see, watch, observe, notice, look at, hear, listen to, smell, taste, feel + do表示动作的完整性,真实性;+doing 表示动作的连续性,进行性。 I saw him work in the garden yesterday.昨天我看见他在花园里干活了。(强调"我看见了"

(完整版)the的用法

定冠词the的用法: 定冠词the与指示代词this ,that同源,有“那(这)个”的意思,但较弱,可以和一个名词连用,来表示某个或某些特定的人或东西. (1)特指双方都明白的人或物 Take the medicine.把药吃了. (2)上文提到过的人或事 He bought a house.他买了幢房子. I've been to the house.我去过那幢房子. (3)指世界上独一无二的事物 the sun ,the sky ,the moon, the earth (4)单数名词连用表示一类事物 the dollar 美元 the fox 狐狸 或与形容词或分词连用,表示一类人 the rich 富人 the living 生者 (5)用在序数词和形容词最高级,及形容词等前面 Where do you live?你住在哪? I live on the second floor.我住在二楼. That's the very thing I've been looking for.那正是我要找的东西. (6)与复数名词连用,指整个群体 They are the teachers of this school.(指全体教师) They are teachers of this school.(指部分教师) (7)表示所有,相当于物主代词,用在表示身体部位的名词前 She caught me by the arm.她抓住了我的手臂. (8)用在某些有普通名词构成的国家名称,机关团体,阶级等专有名词前 the People's Republic of China 中华人民共和国 the United States 美国 (9)用在表示乐器的名词前 She plays the piano.她会弹钢琴. (10)用在姓氏的复数名词之前,表示一家人 the Greens 格林一家人(或格林夫妇) (11)用在惯用语中 in the day, in the morning... the day before yesterday, the next morning... in the sky... in the dark... in the end... on the whole, by the way...

感官动词的用法

1.感官动词用法之一:see, hear, listen to, watch, notice等词,后接宾语,再接动词原形或ing形式。前者表全过程,后者表正在进行。句中有频率词时,以上的词也常跟动词原形。 I heard someone knocking at the door when I fell asleep. (我入睡时有人正敲门) I heard someone knock at the door three times. (听的是全过程) I often watch my classmates play volleyball after school.(此处有频率词often) 若以上词用于被动语态,后面原有动词原形改为带to不定式: We saw him go into the restaurant. →He was seen to go into the restaurant. I hear the boy cry every day. →The boy is heard to cry every day. 2.感官动词用法之二:look, sound, smell, taste, feel可当系动词,后接形容词: He looks angry. It sounds good. The flowers smell beautiful. The sweets taste sweet. The silk feels soft. I felt tired. They all looked tired. 这些动词都不用于被动语态。如:The sweets are tasted sweet.是个病句。注意:如果加介词like,则后不可接形容词,而接名词或代词:

“the way+从句”结构的意义及用法

“theway+从句”结构的意义及用法 首先让我们来看下面这个句子: Read the followingpassageand talkabout it wi th your classmates.Try totell whatyou think of Tom and ofthe way the childrentreated him. 在这个句子中,the way是先行词,后面是省略了关系副词that或in which的定语从句。 下面我们将叙述“the way+从句”结构的用法。 1.the way之后,引导定语从句的关系词是that而不是how,因此,<<现代英语惯用法词典>>中所给出的下面两个句子是错误的:This is thewayhowithappened. This is the way how he always treats me. 2.在正式语体中,that可被in which所代替;在非正式语体中,that则往往省略。由此我们得到theway后接定语从句时的三种模式:1) the way+that-从句2)the way +in which-从句3) the way +从句 例如:The way(in which ,that) thesecomrade slookatproblems is wrong.这些同志看问题的方法

不对。 Theway(that ,in which)you’re doingit is comple tely crazy.你这么个干法,简直发疯。 Weadmired him for theway inwhich he facesdifficulties. Wallace and Darwingreed on the way inwhi ch different forms of life had begun.华莱士和达尔文对不同类型的生物是如何起源的持相同的观点。 This is the way(that) hedid it. I likedthe way(that) sheorganized the meeting. 3.theway(that)有时可以与how(作“如何”解)通用。例如: That’s the way(that) shespoke. = That’s how shespoke.

way 用法

表示“方式”、“方法”,注意以下用法: 1.表示用某种方法或按某种方式,通常用介词in(此介词有时可省略)。如: Do it (in) your own way. 按你自己的方法做吧。 Please do not talk (in) that way. 请不要那样说。 2.表示做某事的方式或方法,其后可接不定式或of doing sth。 如: It’s the best way of studying [to study] English. 这是学习英语的最好方法。 There are different ways to do [of doing] it. 做这事有不同的办法。 3.其后通常可直接跟一个定语从句(不用任何引导词),也可跟由that 或in which 引导的定语从句,但是其后的从句不能由how 来引导。如: 我不喜欢他说话的态度。 正:I don’t like the way he spoke. 正:I don’t like the way that he spoke. 正:I don’t like the way in which he spoke. 误:I don’t like the way how he spoke. 4.注意以下各句the way 的用法: That’s the way (=how) he spoke. 那就是他说话的方式。 Nobody else loves you the way(=as) I do. 没有人像我这样爱你。 The way (=According as) you are studying now, you won’tmake much progress. 根据你现在学习情况来看,你不会有多大的进步。 2007年陕西省高考英语中有这样一道单项填空题: ——I think he is taking an active part insocial work. ——I agree with you_____. A、in a way B、on the way C、by the way D、in the way 此题答案选A。要想弄清为什么选A,而不选其他几项,则要弄清选项中含way的四个短语的不同意义和用法,下面我们就对此作一归纳和小结。 一、in a way的用法 表示:在一定程度上,从某方面说。如: In a way he was right.在某种程度上他是对的。注:in a way也可说成in one way。 二、on the way的用法 1、表示:即将来(去),就要来(去)。如: Spring is on the way.春天快到了。 I'd better be on my way soon.我最好还是快点儿走。 Radio forecasts said a sixth-grade wind was on the way.无线电预报说将有六级大风。 2、表示:在路上,在行进中。如: He stopped for breakfast on the way.他中途停下吃早点。 We had some good laughs on the way.我们在路上好好笑了一阵子。 3、表示:(婴儿)尚未出生。如: She has two children with another one on the way.她有两个孩子,现在还怀着一个。 She's got five children,and another one is on the way.她已经有5个孩子了,另一个又快生了。 三、by the way的用法

感官动词

感官动词的概念和相关考点 1、什么是感官动词? 听觉:listen to、hear 视觉:look at、seem、watch 嗅觉:smell 触觉:feel、touch 味觉:taste 2、感官动词如何正确使用? Tom drove his car away. →I saw him drive away. (全过程) 用法一:somebody did sth + I saw this I saw somebody do something. Tom was waiting for the bus. →I saw Tom waiting for the bus. (看不到全过程) 用法二:somebody was doing sth + I saw this I saw somebody doing something 练习: 一、句子翻译 1. I didn,t hear you come in. 2. I suddenly felt sth touch me on the shoulder. 3. I could hear it raining. 4. Listen to the birds singing. 5. Can you smell sth burning? 6. I found Sue in my room reading my letters. 二、灵活运用 1. I saw Ann waiting for the bus. 2. I saw Dave and Helen playing tenins. 3. I saw Clair having her meal. 三、选择最佳选项 1. Did anybody see the accident (happen/happening)? 2. We listen to the old man (tell/telling) his story from beginning to the end. 3. Listen! Can you hear a baby (cry/crying)? 4.—Why did you turn around suddenly? — I heard someone (call/calling) my name. 5. We watched the two men (open/opening) a window and (climb/climbing) through it into house. 6. When we got there, we found our cat (sleep/sleeping) on the table. 四、感官动词的被动语态 Oh,the milk is tasted strange.

感官动词用法

我们学过了五个与人的感觉有关的动词,它们是look,sound,smel l,taste,feel,我们可称之为“感官”动词。它们的用法有着许多相同点,但也有不同之处,现就此作一小结。 一、这五个动词均可作连系动词,后面接形容词作表语,说明主语所处的状态。其意思分别为“看/听/闻/尝/摸起来……”。除loo k之外,其它几个动词的主语往往是物,而不是人。例如:These flowers smell very sweet. 这些花闻起来很香。 The tomatoes feel very soft. 这些西红柿摸起来很软。 The music sounds beautiful. 二、这些动词后面也可接介词like短语,like后面常用名词。例如: Her idea sounds like fun. 她的主意听起来很有趣。 He looks like his father. 三、这五个感官动词也可作实义动词,除look(当“看起来……”讲时)只能作不及物动词外,其余四个既可作及物动词也可作不及物动词,其主语通常是人。例如: She smelt the meat. 她闻了闻那块肉。

I felt in my pocket for cigarettes. 我用手在口袋里摸香烟。 He tasted the soup and added some salt. Miss Wang asked us to look at the blackboard. 四、taste,smell作不及物动词时,可用于“taste / smell + of + 名词”结构,意为“有……味道 / 气味”。例如: The air in the room smells of earth. 房间里的空气有股泥土味。 The bread taste of sugar. 五、它们(sound除外)可以直接作名词,与have或take构成短语。例如: May I have a taste of the mooncakes?我可以尝一口这月饼吗? May I have a look at your photo? 六、其中look,sound,feel还能构成“look / sound / feel + as if +从句”结构,意为“看起来/听起来/ 感觉好像……”。例如:

The way的用法及其含义(一)

The way的用法及其含义(一) 有这样一个句子:In 1770 the room was completed the way she wanted. 1770年,这间琥珀屋按照她的要求完成了。 the way在句中的语法作用是什么?其意义如何?在阅读时,学生经常会碰到一些含有the way 的句子,如:No one knows the way he invented the machine. He did not do the experiment the way his teacher told him.等等。他们对the way 的用法和含义比较模糊。在这几个句子中,the way之后的部分都是定语从句。第一句的意思是,“没人知道他是怎样发明这台机器的。”the way的意思相当于how;第二句的意思是,“他没有按照老师说的那样做实验。”the way 的意思相当于as。在In 1770 the room was completed the way she wanted.这句话中,the way也是as的含义。随着现代英语的发展,the way的用法已越来越普遍了。下面,我们从the way的语法作用和意义等方面做一考查和分析: 一、the way作先行词,后接定语从句 以下3种表达都是正确的。例如:“我喜欢她笑的样子。” 1. the way+ in which +从句 I like the way in which she smiles. 2. the way+ that +从句 I like the way that she smiles. 3. the way + 从句(省略了in which或that) I like the way she smiles. 又如:“火灾如何发生的,有好几种说法。” 1. There were several theories about the way in which the fire started. 2. There were several theories about the way that the fire started.

六年级 介词 at、 in与on 用法区别

1、小学英语介词at,in与on在时间方面的用法 at表示时间的一点;in表示一个时期;on表示特殊日子。如: He goes to school at seven o’clock in the morning. 他早晨七点上学。 Can you finish the work in two days. 你能在两天内完成这个工作吗? Linda was born on the second of May. 琳达五月二日出生。 1. at后常接几点几分,天明,中午,日出,日落,开始等。如:at five o’clock (五点),at down (黎明),at daybreak (天亮),at sunrise (日出),at noon (中午),at su nset (日落),at midnight (半夜),at the beginning of the month (月初),at that time (那时),at that moment (那会儿),at this time of day (在一天的这个时候)。 2. in后常接年,月,日期,上午,下午,晚上,白天,季节,世纪等。如: in 2006(2006年),in May,2004 (2004年五月),in the morning (早晨/上午),in the afternoon (下午),in the evening (晚上),in the night (夜晚),in the daytime (白天),in the 21st century (21世纪),in three days (weeks/month)三天(周/个月),in a week (一周),in spring (春季)。 3. on后常接某日,星期几,某日或某周日的朝夕,节日等。如:on Sunday (星期日),on a warm morning in April (四月的一个温暖的上午),on a December night (12月的一个夜晚),on that afternoon (那天下午),on the following night (下一个晚上),o n Christmas afternoon (圣诞节下午),on October 1,1949 (1949年10月1日),on New Year’s Day (新年),on New Year’s Eve (除夕),on the morning of the 15t h (15日的早上)等。 2、常见的介词 about 大约在……时间 about five o'clock 在周围,大约多远 about five kilometres 关于、涉及 talk about you above 高出某一平面 above sea level across 横过walk across the street对面across the street after 在……之后 after supper 跟……后面 one a fter another 追赶run after you against 背靠逆风 against the wall, against the wind 反对 be against you among 三者以上的中间 among the trees at 在某时刻 at ten o’clock 在小地点 at the school gate 表示速度 at high speed 向着,对着 at me before 在……之前 before lunch 位于……之前 sit before me behind 位于……之后 behind the tree below 低于……水平 below zero 不合格 below the standard by 到……时刻,在……时刻之前 by five o'clock 紧挨着 site by site 乘坐交通工具 by air, by bick被由 was made by us during 在……期间during the holidays for 延续多长时间 for five years 向……去 leave for Shanghai 为了,对于be good for you from 从某时到……某时 from morning till night 来自何方 from New Y ork 由某原料制成be made from 来自何处 where are you from in 在年、月、周较长时间内 in a week 在里面 in the room 用某种语言 in English 穿着in red into 进入……里面 walk into 除分 divide into 变动 turn into water near 接近某时 near five years 在……附近 near the park of 用某种原料制成 be made of 属于……性质 a map of U. S .A

英语中常用介词in、on、at、to的用法区别

英语中常用介词in、on、at、to的用法区别 介词是英语用词中的一大项,涉及面较广且用法也较灵活,所以记起来很是麻烦,下面我把一些习惯用的介词作了一个小节,供以参考。 早、午、晚要用in,at黎明、午夜、点与分。 年、月、年月、季节、周,阳光、灯、影、衣、冒in。 将来时态in...以后,小处at大处in。 有形with无形by,语言、单位、材料in。 特征、方面与方式,心情成语惯用in。 介词at和to表方向,攻击、位置、恶、善分。 日子、日期、年月日,星期加上早、午、晚, 收音、农场、值日on,关于、基础、靠、著论。 着、罢、出售、偷、公、假,故意、支付、相反,准。 特定时日和“一……就”,on后常接动名词。 年、月、日加早、午、晚,of之前on代in。 步行、驴、马、玩笑on,cab,carriage则用in。 at山脚、门口、在当前,速、温、日落、价、核心。 如大体掌握上面介词用法口诀,就不易出错。当然,至于介词的详尽用法,同形词又是连词及副词等内容此篇不讲。下面对该口诀分别举例帮助你理解消化。 早、午、晚要用in in the evening 在晚上 in the day 在白天 例: in the afternoon 在下午 in the morning 在早上 at黎明、午、夜、点与分 例 at dawn at daybreak 在黎明时候 at night 在夜间 at noon 在中午 at midnight 在午夜 以上短语都不用冠词 at nine o'clock 在9点钟 at 8:30 seven thirty 在8点半 at half past ten 在10点半 at nine fifteen 在9点15分 at ten thirty a.m. 在上午10点30分 也可以写成 seven to five 5点差7分半小时以上

相关文档
最新文档