oracle语法大全

2024-04-30

oracle语法大全(精选3篇)

篇1:oracle语法大全

---------------------------不准用组函数(即MAX()),求薪水的最高值(面试题)--第一种解决办法:--1,先把所有薪水按照倒序排列--2,再取第一行 select * from(select sal from emp order by sal desc)t where rownum=1

--第二种解决办法:--1,先跨表查询自己,先求出的结果中,e1.sal不可能出现最大数--2,然后再not in select e2.sal from emp e1,emp e2 where e1.sal>e2.sal select sal from emp where sal not in(select e2.sal from emp e1,emp e2 where e1.sal>e2.sal)

-----求平均薪水最高的部门的部门编号--第一种解决办法:--1,先求出每个部门的平均薪水, select deptno,avg(sal)avg_sal from emp group by deptno--2,再求每个部门的平均薪水的最高值, select max(avg_sal)from(***1111111111)--3,最后再求第一步结果中avg_sal = 最高薪水的记录.select deptno from(111111111111)where avg_sal =(22222222)

select deptno from(select deptno,avg(sal)avg_sal from emp group by deptno)where avg_sal =(select max(avg_sal)from(select deptno,avg(sal)avg_sal from emp group by deptno))

--没法考虑并列第一的情况 select deptno from(select deptno,avg(sal)avg_sal from emp group by deptno order by avg(sal)desc)

where rownum<=1

--第二种解决办法:--1,将上面的第一步第二步合并,先求最高平均薪水,用max(avg(sal))的办法--不能写成select deptno,max(avg(sal))from emp group by deptno select max(avg(sal))from emp group by deptno--2,求出每个部门的平均薪水

select deptno,avg(sal)avg_sal from emp group by deptno--3,最后再求第二步结果中(即每个部门的平均薪水),avg_sal =(第一步结果)的记录.即avg_sal =最高薪水的记录.select deptno from(select deptno,avg(sal)avg_sal from emp group by deptno)where avg_sal =(select max(avg(sal))from emp group by deptno)

--第三种解决办法:--1,先求出每个部门的平均薪水, select avg(sal)avg_sal from emp group by deptno--2,求最高平均薪水,用max(avg(sal))的办法

select max(avg(sal))from emp group by deptno--3,再使用having语句, avg(sal)= 第二步的结果 注意:为组函数起的别名在having中不能用

select deptno from emp group by deptno having avg(sal)=(select max(avg(sal))from emp group by deptno)

-----求平均薪水最高的部门的部门名称--1,部门平均最高薪水

--2,得到部门编号列表,注意用group by deptno--3,再应用having子句, having avg(sal)=(第一步的结果)--4,得到平均最高薪水的那个部门的编号--5,再得到部门名称

select dname from dept where deptno in(select deptno from(select deptno,avg(sal)avg_sal from emp group by deptno)

where avg_sal =(select max(avg_sal)from(select deptno,avg(sal)avg_sal from emp group by deptno)))

-----求平均薪水的等级最低的部门的部门名称

--第一步:部门平均薪水的等级,分成两个小步骤,第一小步是求部门平均薪水

select * from(select deptno,avg(sal)avg_sal from emp group by deptno)t join salgrade on avg_sal between losal and hisal

--第二步:最低的等级值

select min(grade)from(***1111111111)

--第三步:等于最低值的部门编号------------有错误,应该是grade= select deptno from(111111111111)where grade =(22222222222222)--第四步:求名称

select dname from dept where deptno in(33333333333)select dname from dept where deptno in(select deptno from(select * from(select deptno, avg(sal)avg_sal from emp group by deptno)t join salgrade on avg_sal between losal and hisal)where grade =(select min(grade)from(select * from(select deptno, avg(sal)avg_sal from emp group by deptno)t join salgrade on avg_sal between losal and hisal)))

--也可以用视图的方式来解决--conn sys/bjsxt as sysdba--grant create table, create view, create sequence to scott--根据第一步的结果,建立一个view

create or replace view v1 as--必须明确定义列

select deptno, avg_sal, grade from(select deptno,avg(sal)avg_sal from emp group by deptno)t join salgrade on avg_sal between losal and hisal

--查看一下

select * from v1--查询一下

--带入view

select dname from dept where deptno in(select deptno from(v1)where grade =(select min(grade)from v1))

篇2:oracle语法大全

句子 sentence简单句 simple sentence并列句 compound sentence复合句 complex sentence并列复合句 compound complex sentence陈述句declarative sentence疑问句 interrogative sentence一般疑问句 general question特殊疑问句 special question选择疑问句 alternative question附加疑问句 tag question反义疑问句 disjunctive question修辞疑问句 rhetorical question感叹疑问句 exclamatory question 存在句 existential sentence肯定句 positive sentwence否定句 negative sentence祈使句 imperative sentence省略句 elliptical sentence感叹句 exclamatory sentence基本句型 basic sentence patern

人称 person第一人称 first person第二人称 second person第三人称 third person

一致 agreement主谓一致 subject-predicate agreement语法一致 grammatical agreement概念一致 notional agreement就近原则 principle of proximity

语态 voice主动语态 active voice被动语态 passive voice 语气 mood陈述语气 indicative mood祈使语气 imperative mood虚拟语气 subjunctive mood

句子成分 members of sentences主语 subject谓语 predicate宾语 object双宾语 dual object直接宾语 direct object间接宾语 indirect object复合宾语 complex object同源宾语 cognate object补语 complement主补 subject complement宾补 object complement表语 predicative定语 attribute同位语 appositive状语 adverbial 时态 tense过去将来时 past future tense过去将来进行时 past future continuous tense过去将来完成时 past future perfect tense一般现在时 present simple tense一般过去时 past simple tense一般将来时 future simple tense现在完成时 past perfect tense过去完成时 present perfect tense将来完成时 future perfect tense现在进行时 present continuous tense过去进行时 past continuous tense将来进行时 future continuous tense过去将来进行时 past future continuous tense现在完成进行时 present perfect continuous tense过去完成进行时 past perfect continuous tense

否定 negation否定范围 scope of negation全部否定 full negation局部否定 partial negation转移否定 shift of negation语序 order自然语序 natural order倒装语序 inversion全部倒装 full inversion部分倒装 partial inversion 直接引语 direct speech间接引语 indirect speech自由直接引语 free direct speech自由间接引语 free indirect speech

语法 grammar句法 syntax词法 morphology结构 structure层次 rank句子 sentence从句 clause词组 phrase词类 part of speech单词 word实词 notional word虚词 structural word单纯词simple word派生词derivative复合词compound词性part of speech名词 noun专有名词 proper noun普通名词 common noun可数名词 countable noun不可数名词 uncountable noun抽象名词 abstract noun具体名词 concret noun物质名词 material noun集体名词 collective noun个体名词 individual noun介词 preposition连词 conjunction动词

verb主动词 main verb及物动词 transitive verb不及物动词 intransitive verb系动词 link verb助动词 auxiliary verb情态动词 modal verb规则动词 regular verb不规则动词 irregular verb短语动词 phrasal verb限定动词 finite verb非限定动词 infinite verb使役动词 causative verb感官动词 verb of senses动态动词 event verb静态动词 state verb感叹词 exclamation形容词 adjective副词 adverb方式副词 adverb of manner程度副词 adverb of degree时间副词 adverb of time地点副词 adverb of place修饰性副词 adjunct连接性副词 conjunct疑问副词 interogative adverb关系副词 relative adverb代词 pronoun人称代词 personal pronoun物主代词 possesive pronoun反身代词 reflexive pronoun相互代词 reciprocal pronoun指示代词 demonstrative pronoun疑问代词 interrogative pronoun关系代词 relative pronoun不定代词 indefinite pronoun物主代词 possecive pronoun名词性物主代词 nominal possesive prnoun形容词性物主代词 adjectival possesive pronoun冠词 article定冠词 definite article不定冠词 indefinite article数词 numeral基数词 cardinal numeral序数词 ordinal numeral分数词 fractional numeral形式 form单数形式 singular form复数形式 plural form限定动词 finite verb form非限定动词 non-finite verb form原形 base form从句 clause从属句 subordinate clause并列句 coordinate clause名词从句 nominal clause定语从句 attributive clause状语从句 adverbial clause宾语从句 object clause主语从句 subject clause同位语从句 appositive clause时间状语从句 adverbial clause of time地点状语从句 adverbial clause of place方式状语从句 adverbial clause of manner让步状语从句 adverbial clause of concession原因状语从句 adverbial clause of cause结果状语从句 adverbial clause of result目的状语从句 adverbial clause of purpose条件状语从句 adverbial clause of condition真实条件状语从句 adverbial clause of real condition非真实条件状语从句 adverbial clause of unreal condition含蓄条件句 adverbial clause of implied condition错综条件句 adverbial clause of mixed condition句子 sentence简单句 simple sentence并列句 compound sentence复合句 complex sentence并列复合句 compound complex sentence陈述句 declarative sentence疑问句 interrogative sentence一般疑问句 general question特殊疑问句 special question选择疑问句 alternative question附加疑问句 tag question反义疑问句 disjunctive question修辞疑问句 rhetorical question感叹疑问句 exclamatory question存在句 existential sentence肯定句 positive sentence基本句型 basic sentence patern否定句 negative sentence祈使句 imperative sentence省略句 elliptical sentence感叹句 exclamatory sentence句子成分 members of sentences主语 subject谓语 predicate宾语 object双宾语 dual object直接宾语 direct object间接宾语 indirect object复合宾语 complex object同源宾语 cognate object补语 complement主补 subject complement宾补 object complement表语 predicative定语 attribute同位语 appositive状语 adverbial句法关系 syntatic relationship并列 coordinate从属 subordination修饰 modification前置修饰 pre-modification后置修饰 post-modification限制 restriction双重限制 double-restriction非限制 non-restriction数 number单数形式 singular form复数形式 plural form规则形式 regular form不规则形式 irregular form格 case普通格 common case所有格 possessive case主格 nominative case宾格 objective case性 gender阳性 masculine阴性 feminine通性 common中性 neuter人称 person第一人称 first person第二人称 second person第三人称 third person时态 tense过去将来时 past future tense过去将来进行时 past future continuous tense过去将来完成时 past future perfect tense一般现在时 present simple tense一般过去时 past simple tense一般将来时 future simple tense现在完成时 past perfect tense过去完成时 present perfect tense将来完成时 future perfect tense现在进行时 present continuous tense过去进行时 past continuous tense将来进行时 future continuous tense过去将来进行时 past future continuous tense现在完成进行时

篇3:语法填空解题技法大全

一、纯空格试题的解题技巧

首先,分析句子结构,根据句子所缺句子成分确定填哪类词。然后,再根据句子的意思,确定具体填什么词;或根据两句间的逻辑关系确定用具体哪个连词。确定填哪类词有以下7个技巧:

技巧1:缺主语或宾语,一定是填代词或名词(多考代词)。

[例1]I can send a message to Kenya whenever I want to, and____38____gets there almost in a second. (2007年茂名一模)

解析:and连接前后两个句子,and后面的句子缺主语,应填名词或代词;结合前一分句,不难推知,“马上可到达那里”的是the message,替代the message用代词it。

技巧2:名词前面,若没有限定词(冠词、形容词性物主代词、不定代词),很可能是填限定词。

[例2]It is said that a short-tempered man in the Song Dynasty (960—1279) was very anxious to help________33____ rice crop grow up quickly.(2008年广东高考)

解析:名词rice crop前还没有限定词,应当填限定词;根据句意,这个急性子人当然是急于使“他的”禾苗长得快,故填形容词性物主代词his。

[例3]...the head of the village was tying up his horse to my car to pull it to____35____small town some 20 kilometres away where there was a garage. (2007年广东高考)

解析:因单数可数名词town前还没有限定词,应填限定词;根据句意,是指将车拉到离那里大约有20公里远的一个小镇上去修理,表示“一个”,用不定冠词,故填a。

技巧3:名词或代词在句中不作主语、表语或动词的宾语时,其前面,一定是填介词。

[例4]... who should have the honour of receiving me________33____a guest in their house. (2007年广东高考)

解析:因a guest在句中不作主语、表语、动词的宾语,前面一定是填介词,使其成为该介词的宾语;又由句意可知,他们“把我当作客人”来接待,表示“当作”,用介词as。

技巧4:若两个或几个单词或短语之间没有连词,可能是填连词。

[例5]...two world-famous artists, Pablo Picasso____34____Candido Portinari, which are worth millions of dollars.

解析:因Pablo Picasso (毕加索)与Candido Portinari (坎迪多·波尔蒂纳里)这两个名词之间没有连词,一定是填连词;两者是并列关系,应填and。

[例6]...all I saw was this beautiful girl, whose smile just melted me________36 ____almost instantly gave me a completely new sense of what life is all about. (2008年深圳一模)

解析:因melted me和gave me两个动宾短语之间没有连词,一定是填连词;两者是并列关系,故填and。

技巧5:若两句(一个主谓关系算一个句子)之间没有连词,也没有分号或句号,一定是填并列连词或从属连词。

[例7] I wanted to see as much of the city as possible in the two days____32____I was to return to Guangzhou. (2008年广州一模)

解析:因I wanted to...是一个句子,I was to return...也是一个句子,这两个句子之间没有连词,也没有分号或句号,一定是填连词;根据句意和两句之间的逻辑关系,可知“参观这个城市的尽可能多的地方”应是在“返回广州”之前,故填before。

[例8] He was very tired after doing this for a whole day,________37____he felt very happy... (2008年广东高考)

解析:因He was very tired...是一个句子,he felt very happy...也是一个句子,这两个句子之间没有连词,也没有分号或句号,一定是填连词;根据句意和两句之间的逻辑关系,可知“干了一整天活累极了”与“感到非常高兴”是转折关系,故填but。

技巧6:若结构较完整,空格后的谓语动词是原形,特别是与上下文时态不一致或主谓不一致时,很可能是填情态动词或表示强调或倒装的助动词(do, does, did等)。

[例9]What is acceptable in one country ________36________be considered extremely rude in another. (2007珠三角五校联考)

解析:句中What is acceptable in one country是主语从句,空格后的be considered是谓语;因其中的be是原形,故空格处必定是填情态动词或助动词does(由语境可知是一般现在时,主语是第三人称单数);由句意及作者的语气可知,需填表示“可能”的情态动词may。

[例10] He had no time or energy to play with his children or talk with his wife, but he ____________bring home a regular salary.

解析:这是一个由but连接的并列句,由前一分句的谓语动词had是一般过去时可知,后一分句的谓语动词bring也应用一般过去时。可是,bring却用的是原形,既与语境的时态不符,也与主语he不一致,该句不是倒装句,因此,此处必定是填情态动词或表示强调的助动词did。由句意和作者的语气推测,应当填对谓语动词表示强调的助动词did(的确)。

技巧7:由特殊的句式结构来判断空格应填的词。

(1)由it is...that...强调结构的形式,判断填it还是that。

[例11] ...and____40________was only after I heard she became sick that I learned she couldnt eat MSG (味精)!(2007年广州一模)

解析:由句式结构可知,本句为强调句,应填it。

(2)由倒装句式判断,是填构成倒装的条件的only, so, neither, nor, never, hardly, seldom, not, until, had等,还是填do, does, did等。

[例12] ________________with hard work can you expect to get pay rise.

解析:由can you expect to...可知,这是倒装句,根据构成倒装的条件可知,应填副词only,因为“only +状语(with hard work)”放在句首,句子要用倒装。

(3)由it作形式主语或形式宾语的的句式判断,空格处是否填it。

[例13] ...as ____32___took them just three minutes to steal paintings by two world-famous artists...(2008年佛山二模)

解析:由句式结构可知,这是it takes sb. some time to do sth.句型,本句的不定式to steal paintings是真正的主语,空格处填形式主语it。

[例14]Dating sites also make____36____easy to avoid someone whom you are not interested in. (2008年惠州二模)

解析:由句式结构可知,to avoid...是真正的宾语,easy是宾补,空格处应填作形式宾语的it。

(4)so /such...that...句型。

[例15] This made the goat so jealous ____34____it began plotting against(谋划对付)the donkey.(2007年惠州二模)

解析:由句式结构可知,这是so...that...句型,应填that。

(5)more...than... (与其说……不如说……,比……更……)句型。

[例16]Cynthias story shows vividly that people remember more how much a manager cares_____40____ how much he pays. (2007深圳宝安期末)

解析:由句式结构可知,这是more...than...句型,故填that。句意是与经理所给的报酬相比,雇员更铭记于心的是他的关心。

二、给出了动词的试题的解题技巧

首先,判断要填的动词是谓语动词还是非谓语动词。然后按以下两点进行思考。

技巧8:若句中没有别的谓语动词,或者虽然已有谓语动词,但需填的动词与之是并列关系时,所给动词就是谓语动词;若是谓语动词,就要考虑时态语态。

[例17]His fear of failure___36____(keep) him from classroom games that other children played with joyous abandon. (2008年深圳一模)

解析:因主语His fear of failure后没有别的谓语动词,需填的动词应为谓语动词;因主语与keep是主动关系,应用主动语态;由从句谓语动词played可知,要用一般过去时,故填kept。

[例18] That was definitely not an attractive idea so I politely declined her invitation, ____40____(close) my book and walked away. (2008年广州一模)

解析:虽然句中已有谓语动词declined,但由and walked可知,所填词与declined和walked是并列关系,所以也用一般过去式closed。

[例19] In Logan, three people ____8____(take)to a hospital, while others were treated at a local clinic. (2007梅州二模)

解析:因主语three people与take是被动关系,即三个人被送进医院,故用被动语态;由were treated可知,要用一般过去时,故填were taken。

技巧9:若句中已有谓语动词,又不是并列谓语时,所给动词就是非谓语动词。若是非谓语动词就要确定用—ing形式、—ed形式,还是用不定式形式,确定的方法主要有:

(1)作主语或宾语,通常用—ing形式表示习惯或一般情况,用不定式表示具体的情况。

[例20]...but it is not enough only ____35___(memorize) rules from a grammar book. (2007年佛山一模)

解析:因it是形式主语,后面用不定式作真正的主语,故填to memorize。

[例21]________________(speak)out your inner feeling wont make you feel ashamed, on the contrary...

解析:句中已有谓语wont make,所以speak应为非谓语动词;谓语前面应为主语,作主语,表示一般情况,要用动名词短语,故填Speaking。

(2)作目的状语或者在形容词后作状语,一般用不定式。

[例22]________________(complete)the project as planned, well have to work two more hours a day.

解析:因句中已有谓语will have to work,所以complete应为非谓语动词;因“(为了)按计划完成这项工程”是“我们每天不得不额外多工作两小时”的目的,作目的状语,用动词不定式,故填To complete。

[例23]Some people say that oldest children, who are smart and strong-willed,are very likely _____33_____

(succeed).(2008年佛山一模)

解析:因在形容词likely后作状语,要用动词不定式,故填to succeed。

(3)作伴随状语,常用分词,与逻辑主语是主动关系,用现在分词,是被动关系,用过去分词。

[例24]He saw the stone, ___37____(say) to himself: “The night will be very dark.”(2008年东莞一模)

解析:句中已有谓语saw,所给动词与saw不是并列关系,应当是非谓语动词;又因He与say是主动关系,故填saying作伴随状语。

[例25] The headmaster went into the lab,________ (follow)by the foreign guests.

解析:句中已有谓语went,而follow又不是与之并列的,故为非谓语动词;又因the headmaster与follow是被动关系,故用过去分词作伴随状语。

(4)不论非谓语动词在句中作何种成分,若判断得出其需要用分词时,分词与逻辑主语是主动关系的,用—ing形式,是被动关系的,用—ed形式。

[例26]There will be a meeting,_____40____(start)later this year to review the film.(2008年广州二模)

解析:因a meeting与start是主动关系,用现在分词短语作定语,补充说明a meeting,故填starting。

[例27]Lessons ___39___(learn)in sports can help us in our dealing with other people.(广东考试说明)

解析:因句中已有谓语can help,所以learn应为非谓语动词;又因lesson与learn是被动关系,要用过去分词短语作定语,故填learned。

三、词类转换题的解题技巧

根据该词在句中所作句子成分确定用哪种形式。具体方法有:

技巧10:作表语、定语或补语,通常用形容词形式。

[例28]The youngster immediately fell ____ (silence)as tears flew down from his big blue eyes.

解析:因在系动词felt后作表语,用形容词,故填silent。

[例29] In a ________(danger)part of the sea off the coast of New Zealand, they learnt to...

解析:在冠词与名词之间,要用形容词作定语,故填dangerous。

[例30] Teachers must try their best to make most of their students ________(interest)in the subject

解析:因所填词在句中作宾语most of their students的补足语,用形容词;表示“感兴趣的”,填interested。

技巧11:作主语,或在及物动词或介词后作宾语,用名词形式。

[例31] When Chinas ancient scientific and technological ________(achieve)are mentioned, the nation will generally refer to the Four Great Inventions.

解析:在时间状语从句中,要求填的词作主语,Chinas ancient scientific and technological是主语的定语;作主语要用名词,又由are可知,主语是复数,故填achievements。

[例32] These people have made great____ 39 ___(contribute) to China with their work. (2007年茂名二模)

解析:在句中作及物动词have made的宾语,要用名词形式;表示“作贡献”,contribution前面没有不定冠词时,习惯上用复数,故填contributions。

[例33] ...instructors expect students to be familiar with _____32____(inform) in the reading... (2008年三校联考)

解析:因with是介词,在介词后作宾语,要用名词,故填information。

技巧12:在形容词性物主代词后,或者在“冠词(+形容词)”后,用名词形式。

[例34] ...the remains date from this period because of their ____38____(similar) to those found elsewhere. (2008年广州二模)

解析:在形容词性物代词(their)后应当用名词,故填similarities。

[例35] With the large numbers of students,the

________________(operate)of the system does involve a certain amount of activity.

解析:在冠词后,要用名词,故填operation。

技巧13:修饰动词、形容词、副词,或整个句子,作状语,用副词形式。

[例36] As I looked _____32____(close)at this girl, I fount that... (2008年深圳一模)

解析:修饰动词looked,作状语,用副词,故填closely。

[例37] There must be something ____40____ (serious) wrong with our society. (2008潮州期末)

解析:要求填的词修饰形容词wrong,作状语,用副词,故填seriously。

[例38]Singles are flocking(涌向) to the Internet ___33____(main)because their busy lifestyles leave them little time... (2008年惠州三模)

解析:修饰because引导的原因状语从句,修饰整个句子,作状语,用副词,故填mainly。

技巧14:有可能是词义转换题,词类或词性不一定要变,主要是考查具有与词根意义相反的派生词,需根据句子意思及前后逻辑关系,在词根前加un—, im—等,在词根后加—less等。

[例39] People certainly have a variety of reasons for going back to school but one important thing to know is, no knowledge is ____________________(use).

解析:作表语要用形容词;又由句意可知,作者是表达“没有什么知识是无用的”,故填useless。

[例40] Your mistake caused a lot of ____________(necessary)work in the office.

解析:在名词前作定语,仍用形容词形式;但根据句意可知,错误是引起不必要的麻烦事,故填unnecessary。

技巧15:括号中所给词为动词时,也不一定是考动词的时态语态或非谓语动词,而是考词类转换;若是形容词或副词,有可能是考查其比较等级。

[例41]...there was a lot of information about the citys well-known tourist____34___(attract)... (2008年广州一模)

解析:尽管attract是动词,但这是考查词类转换的;在句中作介词about的宾语,用名词,故填attraction。

[例42]The other frog went on jumping as hard as he could...He jumped even ___36___(hard)and finally made himself out. (2008年期末)

解析:联系前句,又有even(更加)的提示,可知这里用比较级,故填harder。

[例43]Storms which produced at least 13 tornadoes swept along New Mexicos border with Texas on Friday, destroying homes and other buildings and injuring at least 16 people, several critically, authorities said.

The ______33____(bad)damage was reported in the towns of Logan and Clovis, which are about 80 miles apart, police said. (2007梅州二模)

解析:结合前段内容,特别是the的提示,可知要用bad的最高级worst,表示“最严重的”。

上一篇:农村小学课程开发流程下一篇:控尘污染治理总结