Friday, February 22, 2019

The European Court of Justice and the Supremacy of Ec Law

THE EUROPEAN stillterfly OF JUSTICE AND THE SUPREMACY OF EC LAW I. demonstration In the making and promulgation of conjunction mature, the European royal judicature of justness (ECJ) plays a crucial role. M some(prenominal) of the natural beliefs of EC truth argon non to be found in the Treaties, or spotary EC legislation, only when in the shimmy faithfulness of the European hail. No prep atomic number 18dness of the fareity on European Union (TEU) contains an run term regulating the pop of the control between the residential area and the various field natural regulations of the fraction severalizes.The only implied reference to the issue of mastery is word 101 of the TEU which get downs a art on al whizz section carrys to adopt appropriate measures to hold back that the obligations of the pact are observed, together with an additional duty to abstain from in tot every(prenominal)y acts which suck up playfulness jeopardise the executem ent of the objectives of the treaty. Article 10 states that come out of the clo shapegrowth raises sh both take all appropriate measures, whether general or particular, to contain fulfillment of the obligations arising out of this accord or entrusting from action taken by the institutions of the conjunction.They shall facilitate the achievement of the fraternitys tasks. They shall abstain from any measure which could jeopardise the attainment of the objectives of this treaty. . Thus, the precept of the command of participation faithfulnessfulness all over bailiwick police was counterbalance established by the European butterfly of Justice whose role is explicitly express in Article 2202 of the TEU The mash of Justice shall ensure that in the explanation and occupation of this treaty the jurisprudence is observed. Prior to an analysis of the doctrine of conquest and the pertinent baptistry virtue and implementation of the doctrine, an introduction into t he compo baition, expression and practices of the European salute of Justice (ECJ) conk be followed. THE EUROPEAN COURT OF JUSTICE Composition and Structure The ECJ, to which the move of First fount (CFI) is accustomed, is the juridical branch of the conjunction. It has been described by Shaw as a heroin auspicate in the teaching of the EU. The ECJ, which sits in Luxembourg, straight off has 15 preparednesstle who are assisted by 9 Advocate-Generals (AGs).Each outgrowth State (MS) is entitled to ap bear witness a judge of its stimulate subject fieldity. The fitting of all decide is craved by Article 223 TEU3 to be by parking area accord of the Governments of the penis States. The term of site is six years and the appointment of new judges or reappointment (for an new(prenominal) term) of the existing judges is staggered so that there leave behind be a partial replacement of judges every 3 years. The judges select one of their number to be chair of the acc ost for a renewable term of 3 years. The President fills the fix of the Court and controls at hearings and deliberations.The ECJ is assisted by 9 AGs. quintet of the 9 AGs should be appointed by the 5 largest Member States, the stay to be appointed by the early(a) Member States on a body of rotation. Their duty, which is set out in Art. 222 TEU4 is, to pip, in open dally, tumesce-grounded submissions on cases brought originally the ECJ with complete impartiality and independence. 5 The qualifications for selection, method of appointment and conditions of office of the Attorney Generals are the same as for the judges of the Court. The qualifications for selection as a judge of the ECJ are stated in Article 223 TEU6 and require individuals whose independence is beyond doubt and who possess the qualifications required for appointment to the highest juridic offices in their respective countries or who are jurisconsults of recognised competence. Furthermore, judges may not hold any other governmental or administrative office while they are members of the Court. In accordance with their respective traditions, authorized Member States pull in appointed academics to sit as judges, whereas others such as the U. K. have nominated existing home(a) judges or practicing advocates.Although states work to select their own subject areas, the accordance cleanly requires that the judges be enti swear in mutualist of their study governments. Judging from the spirit of the ECJ? s jurisprudence, the wishes of individual Member States have had little influence on its decisions-making. Under Article 221 TEU7 the ECJ is permitted to sit in Chambers of 3 or 5 as well as in plenary session. The court willing, however sit in plenary session when a Member State or a community of interests Institution which is party to the proceedings so requests, or in particularly complex or important cases.The organisation of the Court is correct by a separate protocol to the EC conformity Protocol on the Statute of the Court of Justice. Matters of affair are regulated by this Protocol, including the content of oral and written pleadings, citation of witnesses, costs and expenses etc. The business of over burdening the Court apparently conserves to grow8 despite the temporary easing of the caseload which the organisation of the CFI, in 1988 initially brought astir(predicate).Other than the appeal on a point of statutory philosophy from the decisions of the CFI to the ECJ, there is no further appeal from the archetypes of the ECJ, which is the ultimate or imperative Court of the EC. The Court of First Instance (CFI) Composition The toffee-nosed European turning, (1988) authorised the Council of Ministers to create a CFI to alleviate the volume of work before the ECJ. The aim of the creation of the CFI in 1989 was to strengthen the discriminatory safeguards functional to individuals by introducing a second tier of juridic authority and modify the ECJ to concentrate on its essential task, the uniform interpretation of residential district fairness.The CFI consists of 15 judges who are appointed by agreement between Member States for periods of 6 years. there are no permanent AGs. The duties of an AG are performed by one of the judges. Jurisdiction The CFI does not extend the jurisdiction of the ECJ, but rather, it exercises certain aspects of the Courts functions. The jurisdiction extends to the following classes of cases staff cases argument cases cases infra the ECSC accordance anti-dumping cases It has no jurisdiction to hear preliminary rulings. Furthermore, gibe to Art. 25 TEU, decisions of the CFI are subject to an appeal to the ECJ on points of lawfulness only. En rivement of EC Law in Domestic Courts Like any true heavy system, the connection sound system charters an impressive system of discriminatory safeguards when Community law is challenged or essential be applied. The ECJ, as the judicial institution of the Community, is the backbone of that system of safeguards. It is responsible for interpreting interrogates of EC law and purvey is do in the accordance for references to the ECJ by case courts.Decisions of the ECJ, upon a reference, are reached by majority vote and are binding on all house servant courts of all Member States. Under Article 234 TEU9 it is provided that The Court of Justice shall have jurisdiction to appoint preliminary rulings concerning a) The interpretation of the Treaty b) The validity and interpretation of acts of the institutions of the Community where such a enquire is raise before any court of a Member State that court.. may, if it considers that a decision on the question is indispensable to enable it to utilize judgment, request the ECJ to withstand a ruling..Where any such question is raisedbefore a court of a Member State against whose decisions there is no judicial remedy under topic law, the courtshall bring the matt er before the Court. It is through this Article that the ECJ has achieved the belief of supremacy and its uniform application in all Member States when Community law may be in conflict with house servant help legislation. In CILFIT (1983) the ECJ emphasize that the propose of the then Art. 177 was to ensure the proper application and uniform interpretation of EC law in all Member States.However, preliminary references procedure depends on the operationiveness of cooperation between the ECJ and national courts. The world-beater to ask for a preliminary ruling rests solely with the national court and the power of the ECJ is limit to an interpretation of EC law10. In procedural foothold, individuals still have no right of appeal to the ECJ and the national court bay window decide whether a reference is necessary the Court? s judgements are still, in surmisal, at least, only accustomed on points of interpretation and validity.However, following the some throws that the Co mmunity has gone under, the ECJ? s role has been evolutionary, siting at the elevation of the Community judicial hierarchy. The increasing emphasis which the ECJ places on Article 10 TEU, rendering Community law applicable to national courts as well as to the political arm of Member States, is yet one important manifestation of this surgery in operation. The Community as a whole is in a state of transition, and it would be surprising if the family relationship between the ECJ and the national courts were to catch ones breath immune from the wider changes.As the Community moves towards a closer social and political union, one could well expect the ECJ to cement its position at the apex of the judicial hierarchy. II. THE DOCTRINE OF SUPREMACY PRINCIPLE The ECJ, as the shielder of fair play and instrument of cohesion within the Community, has, from the start been in a grueling position to define the status of Community law and to give it precession when in conflict with the n ational healthy systems of the various Member States. The starting case where the Court made a statement on the disposition of European law is the famous case of van Gend en Loos v.Netherlands (1963)11 relations with the dominion of rank establish of EC Treaty preparednesss and the academic degree to which individuals bunghole trust on such terms to challenge measures of national law. In that case, which will be dealt with in detail later on, the ECJ stated that The objective of the EEC Treaty, which is to establish a Common Market, the functioning of which is of direct concern to interested parties in the Community, implies that this Treaty is more than an agreement which merely creates mutual obligations between the contracting statesThe Community constitutes a new reasoned order of international law for the realize of which the states have limited their autonomous rights, albeit within limited fields, and the subjects of which comprise not only Member States but al so their nationals. The reasoning of the Court in the case is brief and by from its elaboration on the belief of direct found, where it stressed the need for direct enforcement by national courts of Community norms, little more was said about the need for national courts to accord primacy to EC law over irrelevant national law.The Courts focus in Van Gend was on whether Article 12 (customs duties on imports from Member States to other Member States) could give rise to so-called direct proceedings the immediate enforceability in national courts by individual applicants of Treaty commissariat so that an individual could rely on and have that Article enforced before domestic courts. The turn up of the Court was based on the Courts vision of the pleasant of Community which those Treaties had set out to create, and the kind of legal system which the exitive creation of such a Community would necessitate.It was in a second important case, two years later, however, that the ECJ expanded on its reputational theory of the Community, declaring again that the states had created a sovereign Community by limiting their own sovereign rights. The case was rib v. ENEL (1964)12 and the facts were as follows An individual was claiming before his topical anaesthetic court that the law nationalising production and distribution of electricity was in congruous with the EC Treaty. The topical anaesthetic court referred the question to the ECJ for a preliminary ruling.The ECJ in its judgment emphasised the unlimited duration of the Community, the autonomy of Community power, both internally and externally, and e finically the limitation of competence or transfer of powers from the states to the EC. The Court was set(p) to show that the words and spirit of the treaty necessarily implied that It is im thinkable for the states to set up a subsequent one-sided measure against a legal order which they have accepted on a reciprocal flat coat.The Court found the primacy of EC law confirmed by the diction of Article 189 EC Treaty13 under which regulations have binding force and are outright applicable in all Member States. The Court pointed out that this provision which is not qualified by any reservation would be meaningless if a state would unilaterally nullify its resolution by direction of legislative measures which could prevail over EC law.The Court was thus able to reach a conclusion in Costa in words which have become classic and have had hearty influence in national decisions It follows from all these observations that the law stemming from the Treaty, an independent consultation of law could not, because of its special and original nature, be overridden by domestic legal provisions, however framed, without being deprived of its character as Community law and without the legal al-Qaeda of the Community itself being called into question.The transfer by the states from their domestic legal system to the Community legal system of rights an d obligations arising under the Treaty carries with it a permanent limitation of their sovereign rights against which a subsequent unilateral act incompatible with the belief of the Community cannot prevail. As in the case of Van Gend, the Court made no reference to the constitution of any particular Member State to see whether such a transfer or limitation of sovereignty was contemplated or even was possible in accordance with that constitution. Furthermore, the Court drew on the spirit and the aims of the Treaty to conclude that it was impossible for the Member States to accord primacy to domestic laws. The spirit of the Treaty required that they all act with equal diligence to give entire stamp to Community laws which they had accepted on the basis of state reciprocity meaning presumably that since each state was equally bound by laws passed for the Community as a whole, they had all agreed that no one of them would unilaterally derogate from Treaty obligations.And since th e aims of the Treaty were those of integration and co-operation, their achievement would be undermined by one Member State refusing to give effect to a Community law which, should bind all. In Van Gend and Costa v. Enel the Court set out its theorical basis for the principle of supremacy of Community law. The force and practical application of the principle became clearer still in its later decisions. In the following case, the Court made clear that the legal status of a onflicting national measure was not relevant to the question whether Community law should take precedence not even a fundamental reign of national organic law could, of itself, be invoked to challenge the supremacy of a flat applicable EC law externale Handelsgesellschaft v. Einfuhr (1970)14 Recourse to the legal rein ins or concepts of national law in order to judge the validity of measures espouse by the institutions of the Community would have an adverse effect on the agreement and efficacy of Community law. The validity of such measures can only be judged in the light of Community law.The validity of a Community measure or its effect within a Member State cannot be affected by allegations that it runs counter to either fundamental rights as formulated by the constitution of that state or the principles of a national intact structure. This decision gave rise for nearly time to a potentially serious deadlock in relations between the German essential Court, which held that the Community deposit system breached a fundamental provision of the national legal order, and the ECJ, which denied that national constitutional principles could have any effect on the domestic applicability of Community law.But far from mountain off from its claims, the Court continued to emphasise the importance of ensuring that the supremacy of Community law was not simply a matter of principle or of theory only, but was condition practical effect by all national courts in cases arising before them. It is howev er, interesting to note that following this case, the ECJ evolved the concept of EU fundamental rights declaring them to be general principles of law that the Court will render within the framework of Community lawIn Simmenthal resort hotel (1978)15 an Italian judge was faced with a conflict between a Council Regulation on the common organisations of the market in beef and veal and the Italian veterinary and public health laws. Under Italian law, domestic legislation contrary to EC Regulations may be held to be unconstitutional but only by such declaration from the Constitutional Court and not by the ordinary courts. Should the Italian judge of First Instance disregard unreconciled national legislation without waiting for its repeal from the Constitutional Court?In a reference to the ECJ on the question, the last mentioned held that the national court was under a duty to give full effect to Community law even where there was a conflicting provision of national law and without wa iting for a higher court to detect on the matter. Every national court must. apply Community law in its entirety and protect rights which the latter confers on individuals and must accordingly set aside any provision of national law which may conflict with it, whether prior or subsequent to the Community rule.Simmenthal is an interesting case, since it spells out the practical implications for the Community legal order of the principles of supremacy and direct effect. The facts of it highlighted a further problem for national courts what if the national court was one which had no jurisdiction in the domestic legal system to question or to set aside national legislative acts?The clear implication of the Courts response was that, even if the only national court empowered to pronounce on the constitutionality of a national law is the Constitutional Court, nevertheless, if such a case arises before any other national court, that court is bound to give immediate effect to Community law without awaiting for the ruling of the Constitutional Court. We therefore see how Community law has conferred on domestic courts indeed how it has required them to exercise powers and jurisdiction which they did not have under national law.The key emphasis in these decisions is on the principle of effectiveness. This certainly became clear in the U. K. afterwards the ruling in the well-k in a flashn Factortame litigation (1990)16, on the question of interim relief against a provision of national law which appeared to conflict with one of Community law. The facts of the case were as follows The U. K. Merchant Shipping make believe 1988 operated to exclude from registration for purposes of search permits 95 fishing vessels owned by Spanish nationals who challenged the ferment on the basis of breach of the EC Treaty (discrimination by nationality).The U. K. Court asked the ECJ for a preliminary ruling. In the meantime, interim relief was granted and then lifted on the basis that that remedy did not lie against the Crown in English law. The ECJ govern that interim relief must be useable and that this obligation overrode conflicting domestic principles. The domestic court was required to set aside national law, if that would have interrupted the grant of interim relief great(p) effect to EC law. This was required to enable effective enforcement of Community law .. the full effectiveness of Community law would be just as much impaired if a rule of national law could pr consequence a courtgranting interim relief in order to ensure the full effectiveness ofCommunity law. According to Lord straddle of the House of Lords17, If the supremacy within the European Community of Community law over the national law of Member States were not always inwrought in the EEC Treaty, it was certainly well established in the jurisprudence of the ECJ.Thus, in so far as the Court was concerned, by 1990, the principle of supremacy of Community law and its practical effectivenes s amongst Member States were established beyond question. However, the theorys practical application is ultimately dependent on the internal acceptance and adaptation of the constitutional orders of the Member States. And as AG Roemer noted in Van Gend en Loos the constitutional orders of some of the Member States do not easily accommodate the principle of supremacy.The accommodation so far reached by the courts of various Member States on this issue will now be examined. For reasons of time, only some Member States will be discussed, although every state has its own interesting constitutional military position to offer. III. THE PRINCIPLE OF SUPREMACY IMPLEMENTATION MEMBER STATES Under Public International Law (PIL), there are 2 conceptions regarding the transfer or delegating of sovereign powers to international organisations Monism Dualism PIL+ national law ( part of one bingle system with PIL taking PIL + national law ( separate systems, precedence. each supreme within its own spheres. ie Dutch + French constitutions provide that punctually ratified ie UK ( here you need internalisation of international obligations preside over municipal law. PIL into national law by national act as of Also, Belgian courts achieved the same result in absence of explicitfantan in the form of a statute constitutional provision by proclaiming that international BA v. Laker and Blackburn case ( obligations have effect transcendent to domestic law. European Communities Act, 1972. ( at present speak of transfer powers. ( always seeking statutes to conform to EC law. In practice, there is little difference in the application of EC law.In France, there was not any particular constitutional problem since the constitution provides that international treaties have a direct effect and are accorded supremacy. In accordance, Article 55 of the French Constitution of 1958 states that Treaties or agreements duly ratified or approved shall.. have an author ity superior to that of Laws. However, the Conseil d? Etat, the supreme administrative court had difficulties in accepting the supremacy of Community law.In the case of Semoules (1970)18, the problem was expressed as a jurisdictional one The Conseil d? Etat ruled that, since it had no jurisdiction to review article the validity of French legislation, it could not find such legislation to be incompatible with Community law, nor could it accord priority to the latter. Decisions on the constitutionality were matters for the Conseil Constitutionnel the Constitutional Council. However, in the Jacques Vabres19 case in 1975, the Court of Cessation Cour de Cassation the highest of the ordinary judicial Courts took a ifferent view and ruled that when a conflict exists between an internal law and a duly ratified international act which has thus entered the internal legal order (Art. 55 of the Constitution) the Constitution itself accorded priority to the latter. It was not until 1989 in Nicolo case20, however, that the Conseil d? Etat finally abandoned its so-called splendid isolation and distinct to adopt the same position as the Conseil Constitutionnel and the Cour de Cassation. The caution displayed by the French Conseil d?Etat in its flak to the supremacy of Community law is translucent in the case law of many other Member States. The Court of Justice? s view that national law can never take precedence over directly effective EC law on account of a transfer of sovereignty by the Member States and the spirit of the EC Treaty is not unconditionally accepted by the courts of Member States. In France, the main bar to the learning of supremacy of EC law was the jurisdictional limitation of the French courts.In other Member States, in particular in Germany, the difficulties which arose related to the fundamental constitutional nature of the national legislation which appeared to contravene Community law. Article 24 of the German Constitution allows for the tran sfer of legislative power to international organisations, but in litigation which arose over apparent conflicts between Community legislation and provisions of the German Constitution, the extent of power which would be transferred in accordance with this Article was questioned.In particular, the focus of the case law was on whether Article 24 permitted the transfer, to an organisation outside the German constitutional structure of a power to contravene certain basic principles protected under the Constitution itself. following the ECJ? s ruling in Internationale Handelsgesellschaft21, the German Administrative Court ruled that the compulsory scheme regarding the Community deposit system breached basic principles of German constitutional law (compulsory payment of money cannot be imposed in the absence of fault) and it requested a ruling from the Federal Constitutional Court.The latter refused to recognise the unconditional supremacy of Community law. The major objection was a conce rn over the possible impact on basic rights enshrined in the German Constitution of conflicting measures of Community law. For this reason, it held that the clause in the German Constitution which allowed for the transfer of legislative power to international organisations would not do by a transfer of power to alter or amend an inalienable essential feature of the German constitutional structure, such as its express protection for fundamental rights.It concluded by saying that the protection for fundamental rights in the German Constitution would have to prevail in the event of any conflict. Having considered various changes in Community law since the time of the 1974 decision, including the ripening by the ECJ of a doctrine of protection for fundamental rights, and the fact that all Member States by this stage acceded to the European Convention of Human Rights, the German Court in Solange II (1987)22 held that So long as the European Communities, and in particular the case law of the European Court, generally ensure an effective protection of fundamental rightsthe Court will no interminable exercise its jurisdiction More recently, in Brunner v. the European Union Treaty (1994) the Court had to consider the constitutional relationship between EC law and German law, on the occasion of the ratification of the TEU. It ruled that ratification was compatible with the Constitution.The judgment shows that the constitutional court asserts and clearly intends to exercise a power of review over the scope of Community competence. Even if the German courts have accepted that Community law should be given precedence over national law, the constitutional court has made clear that it will continue to review the actions of European institutions and agencies to ensure that they remain within the proper limits of their acquired powers. In the United Kingdom, the acceptance of the supremacy of Community law has certainly not been unproblematic.Since the British Constitution is largely unwritten, it is difficult to speak of amending it. The central obstacle to acceptance by the U. K. of supremacy of EC law is the fundamental constitutional principle of the sovereignty of Parliament. According to this principle, Parliament has the power to do anything other than to bind itself for the future. According to Dicey, Parliament has, under the English Constitution, the right to make or unmake any law whatever and no person or body. as the right to override or set aside the legislation of Parliament. Furthermore, the doctrine of implied repeal means that no Parliament can bind its successor, and no Parliament can be bound by its predecessor. Any Act is thus vulnerable to change by a future Parliament. With those problems in mind, it was nevertheless decided to give internal legal effect to Community law by means of an Act of Parliament (dualist state) the European Communities Act, 1972. Section 2(1) establishes a legal basis within domestic law for directly ap plicable EC laws as in accordance with the Treaties and without further legal enactment to be given legal effect or use in the U. K and shall be recognised and available in law. The section aims to make the concept of direct effect a part of the U. K. legal system. It states that law which under the EC Treaties is to be given immediate legal effect, is to be directly enforceable in the UK. Section 2(4) accords existing and future priority to EC laws. Any enactment passed or to be passed. shall be construed and shall have effect subject to the foregoing provisions of this section.Furthermore, section 3 states that For the purposes of all legal proceedings any question as to the meaning or effect of any of the Treaties, or as to the validity, meaning or effect any Community instrument, shall be treated as a question of law and, if not referred to the European Court, be for determination as such in accordance with the principles laid down by and any relevant decision of the European Co urt or any Court attached thereto. It is therefore apparent that the supremacy of EC law is recognised in the U. K. by virtue of domestic legal processes and legal theory.The principle of supremacy was in theory recognised by English judges. patronage previous judicial comments to the contrary23, the English Master of the Rolls, Lord Denning, in the case of Shields v. Coomes (Holdings) Ltd24(1979) demonstrated a willingness to accept the principle of supremacy of Community law. In Bulmer v. Bollinger (1974)25 he furthermore held that The Treaty is like an incoming ride. We must no longer speak or think of English law, as something of its own. We must speak and think of Community law, of Community rights and obligations and we must give effect to them.But again, this did not prevent judicial difficulties from arising over the practical recognition of the supremacy of EC law over national law. In Macarthys v. Smith26, a genuine conflict appeared to arise between Article 119 of the EC Treaty concerning equal pay and section 1 of the Equal Pay Act 1970 in the U. K. It was held by the Court of Appeal that priority should be given to Community law following section 2(1) and (4) of the European Communities Act, 1972. Here, then, is the judicial satisfaction of Parliamentary Sovereignty with the supremacy of EC law.But the overriding of the Act of Parliament is to be seen as a fulfillment of the Parliamentary designing the intention to comply with directly effective Community law and if it is made clear that the legislative contravention of Community law was intentional, then domestic law must prevail. In other words, the supremacy of EC law is assured in the U. K. only in so far as Parliament intends it to be, and the courts have no power to undermine the clear will of Parliament, whether or not it presents a breach of Community law27.The Factortame Litigation 28 earlier discussed, shows that, although an equilibrium may now have been reached in the relationship s between U. K. courts and the ECJ as to the requirements of supremacy of EC law, the obligations of the U. K. courts stem from the express will of Parliament, and not directly from the Treaties Whatever limitation of its sovereignty Parliament accepted when it enacted the European Communities Act 1972,was entirely voluntary.Thus, in conclusion we see that the bidimensional picture of the supremacy of Community law exists, even today, for although all Member States by now accept the practical requirement to give priority to EC law, few, if any, would be prepared to abandon their supervision of it, to ensure that the Community does not onset to extend the powers it has been given. Individuals The principle of supremacy has implications for individuals. The principle of direct effect gives the right to individuals to plead before the national court the provisions of EC legislation.As a doctrine which principally protects individuals and often gives them rights which they can rely up on as against Member States, it sets up a mechanism for individual or confirmative enforcement of EC law making thus Community law a reality for the citizens of Europe. Van Gend en Loos provides a clear example of the approach of the Court. The Court pointed to the fact that individuals were envisaged as being able to plead and rely on points of EC law through the preliminary ruling procedure. The Court set out certain criteria for the direct effect of a Treaty provision.There must be 1. a clear, negative, unconditional obligation on a Member State, 2. containing no reservation on the part of the MS, 3. and not dependent on any national implementing measure. (MS-no real discretion whether to apply measure). The Court held that Art. 12 of the EC Treaty was directly effective. This process establishes private rights for individuals which are enforceable in municipal courts. The principle applies most oft in the relationship between private individuals and national authorities. This is called straight effect. nearly provisions, however, because of their nature, have been recognised by the Court as having a wider effect in that they can be invoked against other individuals. This is called horizontal effect i. e. they impose obligations on other individuals. eg. the Treaty provisions regarding the competition rules applicable to childbeds, for example, can clearly be invoked before the national courts by one undertaking against another. Furthermore, a Regulation, as described in Article 189(2) EC Treaty, now 249 TEU shall have general application.It shall be binding in its entirety and directly applicable in all Member States. A Regulation is delimit as a general legislative instrument which is binding in its entirety and which is directly applicable within the legal orders of the Member States without the need of intervention on the part of legislative bodies. Thus it has horizontal and vertical effect. In contrast, a Directive which is defined in Art. 249 T EU too, shall be binding, as to the result to be achieved, upon each Member State to which it is addressed, but shall leave to the national authorities the choice of form and methods.Therefore, directives are not mechanically applicable within Member States. Since directives are given legal force through national measures, rights and duties are conferred on individuals only after incorporation into national law. The conditions to be satisfied before direct effect can be pleaded are the 3 ones mentioned earlier. However, 2 important limitations are fit(p) on the application of this principle a) The principle only applies to directives which are unimplemented after the date set for implementation. ) The Court has only been prepared to apply this doctrine to the relationship between individuals and the state (vertical direct effect) as opposed to the relationship amongst individuals themselves (horizontal direct effect). The recent case of Dori (1992) reiterats this refusal. 29 In Mar shall (1986)30 and in Van Duyn31 (1974) the Court confirmed that while a directive might be upheld against defaulting Member States, it cannot be invoked directly against other individuals.However, the Court has sought to achieve the same result though the process of interpretation. For example, where the Court is interpreting the terms of an unimplemented directive as it applies between private individuals, the Court has observed that In applying national law, whether the provisions in question were adopted before or after the directive, a national court called upon to interpret it is required to do so, as far as possible, in light of the wording and purpose of the directive in order to achieve the result pursued by the latter32 Marleasing SA (1992).Furthermore, the principle of construction requires national courts, in conformity with Art. 10 TEU, to give full effect to EC law, to interpret all national legislation in the light of all relevant EC law, irrespective of whether the p articular provision is of direct effect EC law does not have to be directly effective in order for it to benefit from the general doctrine of supremacy Van Colson (1984)33. Furthermore, the ECJ has broadly defined the legal opinion of the state to include anything that provides public service, with sufficient statutory powers beyond those which result from normal rules applicable between individuals. hold dear (1991)34 Regional policy, health, tax and local authorities may be included. Furthermore, the state may be held to be responsible in respect of breaches of EC law, and liable in reparation for the non-implementation of a directive, following the decision in Francovich35 (1991) which held that The full effectiveness of Community rules would be impaired and the protection of the rights which they grant would be weakened if individuals were otiose to obtain compensation when their rights are infringed by a breach of Community law for which a Member State can be held responsi ble. . However, 3 conditions must be satisfied Implementation of the directive would confer rights on individuals. Its terms should be sufficiently precise and unconditional to determine rights. There should be a causal link between the breach and the loss.The development by the Court of strong legal requirements in the area of national remedies for breach of Community law has generally been welcomed as a significant contribution to the effectiveness of Community law, at least through the long suit of judicial intervention by national courts. However, the welcome has not been unconditional, and many commentators have called on the legislative institutions and political players in the Community legal process, to take appropriate action, rather than to leave this area of law for the Court to develop through the haphazard process of litigation.Conclusion It is clear that the ECJ the guardian of the Treaty in formulating the principle of supremacy, reaffirmed the nature and developm ent of EC law. The supremacy of EC law is inherent within the nature and spirit of the TEU. The special and original nature of Community law requires that its supremacy over national law is acknowledged and followed. The ECJ will not entertain the prospect of any provision of national law, even of constitutional validity, prevailing over an inconsistent provision of Community law.The success of this development is well profound, especially when one has in mind that the Court in developing the principle, attributed to it characteristics and force which it considered necessary to carry through a set of profoundly altering and potentially far reaching common goals within a group of politically and geographically distinct nations and historically sovereign states. / 1 ex art. 5 of the EC Treaty 2 ex Art. 164 of the EC Treaty 3 ex Art. 167 EC Treaty 4 ex. Art. 166 EC Treaty 5 Their duties should not be confused with those of a prosecuting officer or similar official that is the rol e of the Commission, as guardian of t he Community? s interests. 6 ex Art. 167 EC Treaty. 7 ex Art. clxv EC Treaty. 8 Since it was set up in 1952, more than 8,600 cases have been brought before the Court. 9 Ex Art. 177 EC Treaty 10 See also case 104/79, Pasquale Foglia v. Mariella Novello (1980)1 ECR 745, (1981) CMLR 45 and character 244/80, Pasquale Foglia v. Mariella Movello (N2) (1981) ECR 3045, (1982) CMLR 585. 11 geek 26/62 (1963) ECR 1, (1963) CMLR 105. 12 Case 6/64 (1964) ECR 585 (1964) CMLR 425. 13 now Art. 249 TEU. 14 Case 11/70 (1970) ECR 1125 (1970) CMLR 255. 15 Case 106/77 (1978) ECR 629 (1978) 3 CMLR 263 16 (No 2) Case C213/89 (1990) ECR 2433 (1990)3 CMLR 867 17 R v. Secretary of State, ex parte Factortame (No 1) (1989)2 WLR 999 18 Decision of 1 March, 1968 in Syndicat General de Fabricants de Semoules de France (1970) CMLR 395 19 Decision of 24 March 1975 in political science des Douanes v. Societe Cafes-Jacques Vabre et SARL Weigel et Cie (1975) 2 CMLR 336 20 Dec ision of 20 Oct. 1989 in Nicolo (1990)I CMLR 173 21 (1972) CMLR 177, at 184 22 Re Wunsche Handelsgesellschat, Decision of 22 Oct. 1986 (1987)3 CMRL 225 at 265 23 Felixstone Dock and Railway Company v. British Transport and Docks Board (1976) 2 CLR 655. 24 (1979)1 tout ensemble ER 456. 25 (1974) Ch 401 26 (1979) 3 All ER 325 27 see T. Allan, Parliamentary Sovereignty Lord Denning? s expert Revolution (1983)3 6 OLS 22 28 (1990)2 AC85 and (1991)1 AC 603. 29 Dori C-91/92 Dori v. RecrebSrl (1994) ECR I 3325 30 Case 152/84 Marshall v.Southampton and South West Area Health empowerment (1986) ECR 723, (1988)1 CMLR 688 31 Case 41/74l, Van Duyn v. Home Office (1974) ECR 1337, (1975)1 CMLR 1 32 Case C-106/89, Marleasing SA v. La Comercial de Alimentacion SA (1990) ECR 1-4135 (1992)1 CMLR 305, at p. 4146 33 Case 14/83,l Von Colson and Kamann v. Land Nordrhein Westfalen (1984) ECR 1891, (1986)2 CMLR430 34 Case C-188/89, A. Foster and others v. British Gas (1990) ECR 1-3313, (1990) 2 CMLR833 35 Case C-6/90 and C-9/90, Francovich v. Italy (1991) ECR 1 5357, (1993)2

Paleolithic and Neolithic Essay

The palaeolithic and neolithic durations were in divers(prenominal) periods of time even though they had similarities and differences in social, economic, and governmental areas. The palaeolithic season or old stone age the cultural period of the stone pit get on that began about 2.5 to 2 million years ago, marked by the earliest accustom of tools made of chipped stone. The principle of the characteristic of the Stone Age was that human being hunted wild animals or gather non-poisonous products of naturally grown animals for nutriment. The neolithic era or Agricultural vicissitude was a marker event that change food aggregation to food producing and transformed human parliamentary procedure. palaeolithic and neolithic eras had lots in car park in social, economic, and policy-making areas.Paleolithic and Neolithic eras had some similarities in semipolitical structures. In the Paleolithic era leaders emerged in each tribe, simply none of them had wealth because of t he constant mournful for resources. In the Paleolithic and Neolithic eras both had some sort of leader or leadership although the Neolithic Era had a daedal organized government the Paleolithic era had a group leader to make the decisions for the tribe consisting of a petite amount of plurality. The Paleolithic and Neolithic also differ in political structures because the Paleolithic era only had a small group of people direct by a group leader because of the constant moving they had to do to get resources. However the Neolithic era had a complex government because of the growth of population due to food surplus when they reconcile down at a resourceful location.Paleolithic and Neolithic eras had many similarities in social structures. In the Paleolithic and Neolithic era each gender had a federal agency in society, precisely later on the Neolithic era the mens role was superior to the womens role. In the Paleolithic era men hunted and women gathered, everyone in society was equal and no one was above only the gods they worshiped were the only high ones than them. The Neolithic and Paleolithic era differ in social structures because in the Paleolithic era women had drop down in the equality surrounded by men and women because men took over both the care of animals and plants therefore women were led to domestic chores but were not essential to the choice of the village. In the Paleolithic era genderequality was extended even further to relations between sexes and all members of a tribe made important contributions to the survival of the community.The Paleolithic and Neolithic era had many similarities and differences in economics. In the Paleolithic and Neolithic era agriculture and hatful was an economic resource. In the Paleolithic era meat had a high value over everything else they use to trade.In both Neolithic and Paleolithic era trade was done by both eras, but in the Neolithic Era there were much resources to trade because of the development of agriculture. In the Paleolithic era hunting and gathering economy practically prevents individuals from accumulating private property and basing social distinctions on wealth. In the Neolithic era specialization would make all the work much efficiently and raise the economy of the city.The Paleolithic and Neolithic eras had similarities and differences in social, economic, and political areas. In the Paleolithic and Neolithic eras each gender had a role in society but later on in the Neolithic era the mens role was superior to the womens role. In the Paleolithic and Neolithic eras both had some sort of leader or leadership although the Neolithic Era had a complex organized government. In the Paleolithic and Neolithic eras trade was done by both eras but in the Neolithic Era there were much more resources to trade because of the development of agriculture. The Paleolithic and Neolithic eras were very much familiar and differently.

Thursday, February 21, 2019

Exclusionary Rule Evaluation Essay

The Exclusionary Rule was designed to exclude evidence obtained in irreverence of a venomous defendants quarter Amendment rights. The Fourth Amendment protects against illogical try and seizures by law enforcement personnel. If the search of a criminal shadowed is searched unreasonable, the evidence obtained in the search will be excluded from trial. The Exclusionary Rule is a court made sway it is not in any of the statutes, it was not created by the Legislative bodies but rather by the United States coercive Court. The Exclusionary Rule applies to the federal courts by virtue of the Fourth Amendment. Police wrongful conduct plays a key role the rein and if there wasnt ball up within our police department the Exclusionary Rule would not exist today. The Fourth Amendment and the Exclusionary Rule go hand in hand the 4th Amendment protects us from unreasonable (illegal) search and seizures and if there is evidence steaming from a rape of the 4th Amendment then that evidenc e ikest thrown completely out of the trial.The rule mostly is there tas the enforcer on the government, the Exclusionary Rule was introduced by the positive Court in 1914 from the case Weeks v. United States. I think that the rule does not need to be abolished because the government should be held accountable for their actions even up though the government is a system divided. I think that we the volume are held accountable in the court of law then it is provided right they are too. Have you ever taken a bound in good doctrine? Well, the Exclusionary Rule has a good faith exception And it provides that when an honest mistake is made during the course of a search and seizure any subsequently obtained evidence will be considered admissible. (Worrall, 2012) I think some things could be updated not only in the criminal justice system but the Constitution and statutes. The judges are attached absolute immunity protecting them from any of their decisions and the prosecutors are giv en measure up ammunityReferenceswww.findlaw.comwww.studymode.comCriminal Procedure John Worrall, (2012)

Community Policing vs. Traditional Policing Essay

Policing in the United States has taken on m all different forms and facets in the past 50 years. Although, various modes & poseurs of policing styles report to be introduced, two main aspects of integrity enforcement have remained constant, ( traditionalistic policing & biotic community oriented- policing). at that place argon so many different facets, trends, and new emerging technologies in the wide world of impartiality enforcement. First, we depart outline a apprise history of the origins and evolvement of policing. Special attention will be lent to expand the effectiveness of the paramilitary style of dress, loyalty, and discipline in relation to the traditional style of policing in the States casting particular illumination on the organizational structure of the traditional practice of law of nature segment.In addition, the solid, familial sequester of brotherhood and sisterhood that exists within the casing of the traditional style of policing will also be pres ented and explained. participation oriented policing is the second side of policing that we are going to deal with focusing on its American roots, effectiveness, and future caution of community-oriented policing. A brief biographical sketch will be miscellaneous of the person who many law enforcement researchers and analysts have credited with the implementation of the community-oriented model of policing. His basis, reasoning, and a cross-section of his 9 Policing Principles will also be discussed. The domain re fulfil and relationship to-wards the community-oriented model of policing will also be brought to light. The many triumphs, pitfalls, differences, similarities, and core effectiveness of both models of policing will be contrasted and compared.The subject of what mode or rule is best to use in the protection of the citizens who live, work, and cost increase families in the United States will more than likely remain a hot-button issue for many years to come. Depending upon the current governmental administration that is occupying our nations highest office, drumbeater politics play a vital role in how law enforcement precincts across America are funded, staffed, and managed. The prevailing morality views and sentiments of the community-at-large, and what they feel is close important to them, in terms of the main focus of law enforcement in their town, must definitely must be taken into account when law enforcement agencies are outlining a departmental plan of action.More community action groups, government watchdog organizations, youthful offender programs,positive, after school athletic activities, youthful offender programs, peer mentor-ship programs, faith-based, community initiative alliances, and law enforcement partnering with the community that it serves, (not just with City Hall and its partisan policies), are sorely inevitable in cities nationwide. When the law enforcement brotherhood is able to gain a crystallization clear underst anding of what type of services are needed in the various communities that each individual department serves, hence and only then will the proverbial bridges begin to be built. Then better and reconciliation can finally start surrounded by law enforcement and relate citizens. All of these factors are core essential to ensure that cities across America are able to grow and maintain a peaceful existence. move to many, who whitethorn think that modern-day policing has its roots in the United States, the authentic formation and design for the Metropolitan practice of law department was started in London, England. Sir Robert flake, (also cognize affectionately as, orange peel), is credited with creating the first organized police force in 1829 while serving as Home secretarial assistant of England. According to Peel, the true core concept of policing is, the police are the mickle and the people are the police. Sir Robert Peel established nine break dance bedrock principles fo r policing that continue to stand as a road use for law enforcement agencies across America. The first principle Peel outlined in his plan was that, the basic mission for which the police exist is to prevent disgust and disorder. This could arguably be one of his nigh important principles. Peel established a force of military officeholders, also cognize as, Bobbies, and, Peelers, as they were known, in London.The new Bobbies were given beats, (particular area a Bobbie would be responsible for). darn walking the beat, the Bobbies would interact closely with shop owners, and ordinary citizens. The close proximity of law enforcement in the community established not only an autocratic presence in the community, but also a sense of trade protection for citizens. Bobbies wore dark, passe-partout uniforms that further established their authoritative presence, (the uniforms from the 1800s are lighten quite similar to the ones half-hearted by the New York City constabulary Depar tment).According to an article concerning the significance of uniforms, Richard R. Johnson, suggests from often research thatThe uniform worn by also elicits stereotypes about that human beings status, authority,attitudes, and motivations. The police uniform serves to put a person as one vested with the powers of the state to arrest and use force. The uniform also serves to establish order and conformity within the ranks of those who strike it by suppressing individuality. The psychological impact of the police uniform should not be underestimated, Johnson, (2005).This really professional, paramilitary style of uniform worn by most American law enforcement officers is a perfect visual representation of the sign that a traditional police officer should portray one of power, professionalism, and trust. grammatical construction off of the professional concept of serving the public interest by uniform, clear-cut channels, we will explore the traditional police concept. The traditio nal method of policing, if practiced correctly and efficiently, is an extremely effective mode of operation for any successful police unit. The professional, paramilitary style of dress places the law enforcement officer in the frame of mind that he is a polished professional and must live up to the image that his uniform represents, on or off the job. The traditional concept of policing also focuses on police administration, (also known as brass), to make most, if not all administrative decisions for all officers in a department or unit.This type of set-up relies almost totally upon loyalty,duty, and the keep code that exists among law enforcement officers to ensure compliance with the way that daily semiofficial law enforcement business is handled from department to department. Depending on the particular department, law enforcement officers may adhere to an extremely strict code of fraternal brotherhood and sisterhood. This very same bond is usually only found in the build up services this is the reason why many soldiers are honorably discharge or retire from the armed services to pursue fruitful careers in law enforcement. It means a great deal to a law enforcement officer to know beyond the shadow of a doubt that he or she can definitely depend on their fellow officer no matter what.Contrastingly, the community-oriented side of policing relies very heavily on placing much of the administrative and social duties that were once reserved for upper-level management in the laps of street level law enforcementofficers. One of the earliest accounts of active community policing in the U.S. was in 1962 by the San Francisco practice of law Department who established a specialized unit of law enforcement officers based on the core concept that, police would help to reduce crime by reducing desperation- by acting as a social service spot to ameliorate roughly of the difficulties encountered by minority group persons, Patterson, J. (n.d.). With the creation of this unit, as officers assigned to this unique unit began to draw closer to the people in the surrounding community, the citizens new found relationship with members of this new, community-based police unit prompted some of them to muster enough courage to file formal complaints against regular guard officers.While on the one hand, the close relationship with the community was a good thing, the tension that now existed between the community-based unit officers and the regular patrol officers was one of major distrust and constant scandal. The community-based officer program was started to relieve oneself a balance in community/police relations, but instead, displace up a huge political mess in the San Francisco Police Department. In any event, the program was discontinued due to the dis-harmony that now existed between these separate sides of the police force. Many times solving one bother only creates a much larger dilemma. Community-policing had seen a major upswing in the 80s and 90s but, departments across America are beginning to realize that the traditional-style of policing is one that commands the most overall respect from citizens.In closing, as law enforcement technology continues to increase at an almost febrile pace, the styles of law enforcement, (although slowly evolving), will basically remain the same. It would probably be safe to say that many police departments across the nation do not rely totally on community-oriented policing or traditional-policing each department more than likely has a unique mixture of both of these policing concepts. Whether a particular leans toward the community concept or the traditional concept depends on the individual communities that each department serves. When law enforcement officials take time to action research on the various communities that they serve, then our cities can begin the surgery of placing their trust back in the hands of the police departments that patrol our multi-cultural communities either day.Bibliography1)The formalised Website of the City of Clearwater, FL., The Community and its History of Community-Policing., (2006). Retrieved from http//www.clearwaterpolice.org/cp/cp_history.asp2)Leineweber, G. V., (200-2005), Leines 10-42 Hideaway., History of Policing, Retrieved from http//www.leineshideaway.com/PoliceHistory.html3)History.com., Police., (n.d.)., Retrieved from http//www.history.com/encyclopedia.do?articleId=2195224)The Official Site of the Prime Ministers social occasion., History and Tour, Sir Robert Peel., (n.d.), Retrieved from http//www.number10.gov.uk/history-and-tour/prime-ministers-in-history/sir-robert-peel5)U.S. Department of Justice, Office of Community Oriented Policing Services. , What is Community-Policing? (2008, April 30). Retrieved from http//www.cops.usdoj.gov/default.asp?Item=366)Associated Content, Law Enforcement Sir Robert Peels purpose of Community Policing in Todays Society. (2007, Nov 8). Retrieved from http//www.associatedc ontent.com/article/435980/law_enforcement_sir_robert_peels_concept.html7)LondonBobbies.com, Home Page. (2004, July 19). Retrieved from http//www.aowo42.dsl.pipex.com/8)Johnson, M.S., R.R., Police Uniform Articles, The pspsychological influence of the police uniform. (2005, March 4).,retrieved from http//www.policeone.com/police-products/apparel/uniforms/articles/99417/9)Patterson, Sgt. J., Lectric Law Library, Community Policing Learning the Lessons of History., (n.d.)., Retrieved from http//www.lectlaw.com/files/cjs07.htm

Sql Study Matetial

oracle/SQL Tutorial1 Michael Gertz entropy root and In trackation agreements Group Department of Computer intuition University of California, Davis emailprotected ucdavis. edu http//www. db. cs. ucdavis. edu This illusionist/SQL tutorial provides a expounded introduction to the SQL wonder diction and the seer Relational t to identifyly wizardingbase Management System. win in remainsation nigh seer and SQL bunghole be found on the web site www. db. cs. ucdavis. edu/dbs. Comments, corrections, or hyperkinetic syndromeitions to these nvirtuosos argon welcome. M either(prenominal) thanks to Christina Chung for comments on the previous meter reading. Recomm finished LiteratureGeorge Koch and Kevin L wizardy Oracle8 The Complete part (The Single Most Comprehensive Sourcebook for Oracle Server, Includes CD with electronic chance varying star of the book), 1299 pages, McGraw-Hill/Osborne, 1997. Michael Abbey and Michael Corey Oracle8 A Beginners maneuver A Thoroug h Introduction for First-time Users, 767 pages, McGraw-Hill/Osborne, 1997. St veri put back(a) Feuerstein, billet Pribyl, Debby Russell Oracle PL/SQL Programming (2nd Edition), OReilly & Associates, 1028 pages, 1997. C. J. Date and Hugh Darwen A Guide to the SQL touchstvirtuoso (4th Edition), Addison-Wesley, 1997. Jim Melton and Alan R.Simon Understanding the New SQL A Complete Guide (2nd Edition, Dec 2000), The Morgan Kaufmann series in discernive in levelation Management Systems, 2000. 1 revised Version 1. 01, January 2000, Michael Gertz, pro mongrele 2000. Contents 1. SQL Structured Query Language 1. 1. sidesteps 1. 2. Queries (Part I) 1. 3. Data De? nition in SQL 1. 4. Data Modi? cations in SQL 1. 5. Queries (Part II) 1. 6. Views 1 3 6 9 11 19 2. SQL* positive (Minimal User Guide, Editor Commands, Help System) 20 3. Oracle Data Dictionary 23 4. Application Programming 4. 1. PL/SQL 4. 1. 1 Introduction 4. 1. 2 Structure of PL/SQL Blocks 4. 1. Declarations 4. 1. 4 Language Elements 4. 1. 5 Exception Handling 4. 1. 6 Procedures and Functions 4. 1. 7 Packages 4. 1. 8 Programming in PL/SQL 4. 2. Embedded SQL and Pro*C 26 27 27 28 32 34 36 38 39 5. Integrity Constraints and Triggers 5. 1. Integrity Constraints 5. 1. 1 Check Constraints 5. 1. 2 Foreign Key Constraints 5. 1. 3 More About newspaper newspaper towboat- and Table Constraints 5. 2. Triggers 5. 2. 1 Over pull in 5. 2. 2 Structure of Triggers 5. 2. 3 vitrine Triggers 5. 2. 4 Programming Triggers 6. System Arc chargeecture 6. 1. Storage Management and Processes 6. 2. Logical Database Structures 6. 3.Physical Database Structures 6. 4. Steps in touch on an SQL Statement 6. 5. Creating Database Objects 46 47 49 50 50 53 55 58 60 61 63 63 1 SQL Structured Query Language 1. 1 Tables In singingal entropybase systems (DBS) info argon represented employ eludes ( proportions ). A doubtfulness issued against the DBS as well as closures in a postp angiotensin-converting enzyme. A skirt has the interest structure mainstay 1 Column 2 . . . Column n A tabulate is unequivoc any told in whollyy identi? ed by its bid and consists of courseings that intercept the interjectd in trendation, for to each 1 nonp beil row containing on the neverthe littleton wiz tuple (or go into ). A plank give the axe receive hotshot and only(a) or practic all(prenominal)(a)y(prenominal) newspaper mainstays.A tugboat is made up of a towboat list and a take inive in reachation judge, and it describes an pass judgment of the tuples. The structure of a play-in, also called congeneric schema, thus is de? ned by its attri just straight offes. The fictional charactersetters casecast of in initializeion to be stored in a submit is de? ned by the entropy slips of the attributes at skirt public time. SQL uses the basis hedge, row, and column for relation, tuple, and attribute, respectively. In this tutorial we will use the terms inter tiltably. A bow push aside energise up to 254 columns which whitethorn take in di? e operate or tote uping information attributes and batchs of nurtures ( publics), respectively.Possible domains ar alphanumeric entropy ( quarters), itemises and go out orders. Oracle o? ers the following basic data types char(n) Fixed-duration character data (string), n characters long. The muckimum size for n is 255 bytes (2000 in Oracle8). logical argument that a string of type char is always pad on right with blanks to full length of n. ( piece of tail be recollection con conjugationing). recitation char(40) varchar2(n) Variable-length character string. The liquid ecstasyimum size for n is 2000 (4000 in Oracle8). lone both(prenominal)(prenominal) if the bytes apply for a string require storage. physical exertion varchar2(80) progeny(o, d) Numeric data type for integers and reals. = overall tour of digits, d = estimate of digits to the right of the quantitative point. Maximu m mensurates o =38, d= ? 84 to +127. Examples quash(8), number(5,2) Note that, e. g. , number(5,2) plunder non contain anything larger than 999. 99 without dissolving agenting in an error. Data types derived from number be integer, decimal, smallint and real. engagement Date data type for storing fitting and time. The c atomic number 18lessness format for a hear is DD-MMM-YY. Examples 13-OCT-94, 07-JAN-98 1 long Character data up to a length of 2GB. Only one long column is go awayed per mesa. Note In Oracle-SQL at that place is no data type boolean.It stinkpot, however, be simulated by victimization all char(1) or number(1). As long as no control restricts the feasible appraises of an attribute, it may cede the particular(a) value visionary (for unk n profess). This value is di? erent from the number 0, and it is also di? erent from the empty string . Further properties of shelves be the rank in which tuples out in a put off is non relevant (unless a in terrogate requires an explicit sort). a dishearten has no duplicate tuples (depending on the interrogative sentence, however, duplicate tuples arsehole appear in the interview military issue). A database schema is a set of relation schemas.The appendage of a database schema at database run-time is called a database instance or database, for short. 1. 1. 1 Example Database In the following discussions and employments we use an example database to deliver the goods randomness somewhat employees, subdivisions and salary scales. The jibe shelves enkindle be piddled under the UNIX stick apply the overleap demobld. The tables smoke be dropped by issuing the teaching demodrop under the UNIX thrum. The table EMP is apply to store information about employees EMPNO ENAME furrow MGR HIREDATE SAL DEPTNO 7369 SMITH CLERK 7902 17-DEC-80 800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 30 7521WARD SALESMAN 7698 22-FEB-81 1250 30 .. 7698 BLAKE MANAGER 01-MAY-81 3850 30 7902 F ORD ANALYST 7566 03-DEC-81 3000 10 For the attributes, the following data types be de? ned EMPNOnumber(4), ENAMEvarchar2(30), railway cablechar(10), MGRnumber(4), HIREDATEdate, SALnumber(7,2), DEPTNOnumber(2) each(prenominal) row (tuple) from the table is interpreted as follows an employee has a number, a countenance to, a ancestry title and a salary. Further much, for each employee the number of his/her passenger car, the date he/she was hired, and the number of the part where he/she is on the blood(p) ar stored. 2The table DEPT stores information about discussion sections (number, nominate, and location) DEPTNO 10 20 30 40 DNAME farm animal RESEARCH SALES MARKETING LOC CHICAGO DALLAS NEW YORK capital of Massachusetts Finally, the table SALGRADE contains all information about the salary scales, more(prenominal) precisely, the maximum and minimum salary of each scale. GRADE 1 2 3 4 5 1. 2 LOSAL 700 1201 1401 2001 3001 HISAL 1200 1400 2000 3000 9999 Queries (Part I) In monastic couch to retrieve the information stored in the database, the SQL question language is utilize. In the following we restrict our attention to impartial SQL queries and defer the discussion of more complex queries to Section 1. In SQL a query has the following (simpli? ed) form (components in brackets atomic number 18 preferenceal) pack distinct from where order by 1. 2. 1 Selecting Columns The columns to be exacted from a table ar speci? ed afterwards the come uponword demand. This operation is also called endureion. For example, the query bring LOC, DEPTNO from DEPT lists one the number and the location for each tuple from the relation DEPT. If all columns should be subscribeed, the asterisk attribute ? heap be use to de none all attributes. The query select ? from EMP retrieves all tuples with all columns from the table EMP.alternatively of an attribute anatomy, the select article may also contain arithmetic ex shortenions involving arithm etic hookers etc. select ENAME, DEPTNO, SAL ? 1. 55 from EMP 3 For the di? erent data types supported in Oracle, several operators and functions be provided for verse abs, cos, sin, exp, log, power, mod, sqrt, +, ? , ? , /, . . . for strings chr, concat(string1, string2), lower, stop number, replace(string, search string, replacement string), translate, substr(string, m, n), length, to date, . . . for the date data type lead month, month amongst, abutting day, to char, . . The wont of these operations is described in detail in the SQL* positive(p) function system ( look into also Section 2). overturn the query select DEPTNO from EMP which retrieves the part number for each tuple. Typically, some poetry will appear more than and once in the query result, that is, duplicate result tuples are non mechanically eliminated. Inserting the appoin twainrd distinct after the keyword select, however, forces the elimination of duplicates from the query result. It is also pos sible to de simple eyeate a sieve order in which the result tuples of a query are displayed.For this the order by article is use and which has one or more attributes listed in the select article as parameter. desc speci? es a descending order and asc speci? es an ascending order (this is also the fail order). For example, the query select ENAME, DEPTNO, HIREDATE from EMP from EMP order by DEPTNO asc, HIREDATE desc displays the result in an ascending order by the attribute DEPTNO. If deuce tuples have the akin attribute value for DEPTNO, the sorting criteria is a descending order by the attribute set of HIREDATE. For the in a higher place query, we would disturb going the following produce ENAME DEPTNO HIREDATEFORD 10 03-DEC-81 SMITH 20 17-DEC-80 BLAKE 30 01-MAY-81 WARD 30 22-FEB-81 ALLEN 30 20-FEB-81 1. 2. 2 Selection of Tuples Up to now we have all focused on selecting (some) attributes of all tuples from a table. If one is interested in tuples that satisfy certain te achs, the where article is used. In a where clause simple conditions based on equality operators empennage be combinationd using the logical connectives and, or, and not to form complex conditions. Conditions may also accommodate principle matching operations and blush subqueries (Section 1. 5). 4 Example amount the job title and the salary of those employees whose manager has the number 7698 or 7566 and who earn more than 1500 select dividing line, SAL from EMP where (MGR = 7698 or MGR = 7566) and SAL 1500 For all data types, the comparison operators =, = or , , are allowed in the conditions of a where clause. Further comparison operators are Set Conditions not in () Example select ? from DEPT where DEPTNO in (20,30) nought value is not ineffectual, i. e. , for a tuple to be selected in that respect mustiness (not) embody a de? ned value for this column. Example select ? from EMP where MGR is not zero point Note the operations = unavailing and useless are not d e? ned Domain conditions not between and Example select EMPNO, ENAME, SAL from EMP where SAL between 1500 and 2500 select ENAME from EMP where HIREDATE between 02-APR-81 and 08-SEP-81 1. 2. 3 String operations In order to compare an attribute with a string, it is required to duck the string by apostrophes, e. g. , where LOCATION = DALLAS. A powerful operator for aim matching is the wish well operator. To originateher with this operator, two special characters are used the percent sign % (also called wild card), and the underline , also called position marker.For example, if one is interested in all tuples of the table DEPT that contain two C in the name of the department, the condition would be where DNAME like %C%C%. The percent sign means that any (sub)string is allowed there, even the empty string. In contrast, the underline stands for exactly one character. Thus the condition where DNAME like %C C% would require that exactly one character appears between the two Cs. To tes t for inequality, the not clause is used. Further string operations are upper() takes a string and converts any letters in it to upper plate, e. g. DNAME = upper(DNAME) (The name of a department must consist only of upper case letters. ) lower() converts any letter to lowercase, initcap() converts the initial letter of every word in to uppercase. length() returns the length of the string. substr(, n , m) clips out a m character piece of , starting at position n. If m is not speci? ed, the end of the string is assumed. substr(DATABASE systemS, 10, 7) returns the string SYSTEMS. 5 1. 2. 4 Aggregate Functions Aggregate functions are statistical functions much(prenominal) as count, min, max etc. They are used to compute a hit value from a set of attribute determine of a column count ax min sum avg Note 1. 3 1. 3. 1 Counting Rows Example How many tuples are stored in the relation EMP? select count(? ) from EMP Example How many di? erent job titles are stored in the relation EM P? select count(distinct JOB) from EMP Maximum value for a column Minimum value for a column Example enumerate the minimum and maximum salary. select min(SAL), max(SAL) from EMP Example Compute the di? erence between the minimum and maximum salary. select max(SAL) min(SAL) from EMP Computes the sum of values (only applicable to the data type number) Example Sum of all salaries of employees working(a) in the department 30. elect sum(SAL) from EMP where DEPTNO = 30 Computes average value for a column (only applicable to the data type number) avg, min and max ignore tuples that have a null value for the speci? ed attribute, but count considers null values. Data De? nition in SQL Creating Tables The SQL manage for creating an empty table has the following form seduce table ( not null unique , not null unique , ) For each column, a name and a data type must be speci? ed and the column name must be unique within the table de? nition. Column de? nitions are separated by colons. Ther e is no di? rence between name calling in lower case letters and call in upper case letters. In fact, the only place where upper and lower case letters matter are strings comparisons. A not null 6 constraint is directly speci? ed after the data type of the column and the constraint requires de? ned attribute values for that column, di? erent from null. The keyword unique speci? es that no two tuples fuck have the same attribute value for this column. Unless the condition not null is also speci? ed for this column, the attribute value null is allowed and two tuples having the attribute value null for this column do not violate the constraint.Example The bring forth table ensure for our EMP table has the form lay down table EMP ( EMPNO number(4) not null, ENAME varchar2(30) not null, JOB varchar2(10), MGR number(4), HIREDATE date, SAL number(7,2), DEPTNO number(2) ) Remark Except for the columns EMPNO and ENAME null values are allowed. 1. 3. 2 Constraints The de? nition of a tab le may include the speci? cation of uprightness constraints. Basically two types of constraints are provided column constraints are associated with a single column whereas table constraints are typically associated with more than one column.However, any column constraint stooge also be explicate as a table constraint. In this section we consider only very simple constraints. More complex constraints will be discussed in Section 5. 1. The speci? cation of a (simple) constraint has the following form constraint prime feather key unique not null A constraint squirt be named. It is advisable to name a constraint in order to get more meaningful information when this constraint is violated due to, e. g. , an institution of a tuple that violates the constraint. If no name is speci? ed for the constraint, Oracle mechanically generates a name of the pattern SYS C.The two most simple types of constraints have already been discussed not null and unique. Probably the most important typ e of integrity constraints in a database are primary key constraints. A primary key constraint enables a unique identi? cation of each tuple in a table. Based on a primary key, the database system ensures that no duplicates appear in a table. For example, for our EMP table, the speci? cation create table EMP ( EMPNO number(4) constraint pk emp primary key, . . . ) 7 de? nes the attribute EMPNO as the primary key for the table. Each value for the attribute EMPNO thus must appear only once in the table EMP.A table, of course, may only have one primary key. Note that in contrast to a unique constraint, null values are not allowed. Example We want to create a table called PROJECT to store information about projects. For each project, we want to store the number and the name of the project, the employee number of the projects manager, the budget and the number of persons working on the project, and the start date and end date of the project. Furthermore, we have the following conditions a project is identi? ed by its project number, the name of a project must be unique, the manager and the budget must be de? ed. Table de? nition create table PROJECT ( PNO number(3) constraint prj pk primary key, PNAME varchar2(60) unique, PMGR number(4) not null, PERSONS number(5), reckon number(8,2) not null, PSTART date, PEND date) A unique constraint locoweed include more than one attribute. In this case the pattern unique(, . . . , ) is used. If it is required, for example, that no two projects have the same start and end date, we have to add the table constraint constraint no same dates unique(PEND, PSTART) This constraint has to be de? ned in the create table bidding after twain columns PEND and PSTART have been de? ed. A primary key constraint that includes more than only one column arse be speci? ed in an like way. Instead of a not null constraint it is sometimes useful to specify a default value for an attribute if no value is given, e. g. , when a tuple is insert ed. For this, we use the default clause. Example If no start date is given when inserting a tuple into the table PROJECT, the project start date should be set to January 1st, 1995 PSTART date default(01-JAN-95) Note Unlike integrity constraints, it is not possible to specify a name for a default. 8 1. 3. 3 Checklist for Creating TablesThe following provides a small qualifylist for the issues that lead to be considered in advance creating a table. What are the attributes of the tuples to be stored? What are the data types of the attributes? Should varchar2 be used sort of of char ? Which columns build the primary key? Which columns do (not) allow null values? Which columns do (not) allow duplicates ? atomic number 18 there default values for certain columns that allow null values ? 1. 4 Data Modi? cations in SQL After a table has been created using the create table restraint, tuples roll in the hay be inserted into the table, or tuples mint be call offd or modi? ed. 1. 4. 1Insertions The most simple way to insert a tuple into a table is to use the insert statement insert into () values () For each of the listed columns, a corresponding (matching) value must be speci? ed. Thus an interjection does not necessarily have to follow the order of the attributes as speci? ed in the create table statement. If a column is omitted, the value null is inserted kind of. If no column list is given, however, for each column as de? ned in the create table statement a value must be given. Examples insert into PROJECT(PNO, PNAME, PERSONS, BUDGET, PSTART) values(313, DBS, 4, 150000. 42, 10-OCT-94) r insert into PROJECT values(313, DBS, 7411, null, 150000. 42, 10-OCT-94, null) If there are already some data in former(a) tables, these data crapper be used for insertions into a new table. For this, we write a query whose result is a set of tuples to be inserted. Such an insert statement has the form insert into () Example Suppose we have de? ned the following table 9 create table OLDEMP ( ENO number(4) not null, HDATE date) We now dismiss use the table EMP to insert tuples into this new relation insert into OLDEMP (ENO, HDATE) select EMPNO, HIREDATE from EMP where HIREDATE 31-DEC-60 1. 4. 2 UpdatesFor modifying attribute values of (some) tuples in a table, we use the modify statement update set = , . . . , = where An expression consists of either a constant (new value), an arithmetic or string operation, or an SQL query. Note that the new value to appoint to must a the matching data type. An update statement without a where clause results in changing respective attributes of all tuples in the speci? ed table. Typically, however, only a (small) portion of the table requires an update. Examples The employee JONES is transfered to the department 20 as a manager and his salary is increased by 1000 pdate EMP set JOB = MANAGER, DEPTNO = 20, SAL = SAL +1000 where ENAME = JONES all(prenominal) employees working in the departments 10 and 30 get a 15% salary increase. update EMP set SAL = SAL ? 1. 15 where DEPTNO in (10,30) Analogous to the insert statement, another(prenominal) tables can be used to retrieve data that are used as new values. In much(prenominal)(prenominal) a case we have a instead of an . Example All salesmen working in the department 20 get the same salary as the manager who has the lowest salary among all managers. update EMP set SAL = (select min(SAL) from EMP where JOB = MANAGER) where JOB = SALESMAN and DEPTNO = 20Explanation The query retrieves the minimum salary of all managers. This value and then is assigned to all salesmen working in department 20. 10 It is also possible to specify a query that retrieves more than only one value (but excuse only one tuple ). In this case the set clause has the form set() = . It is important that the order of data types and values of the selected row exactly correspond to the list of columns in the set clause. 1. 4. 3 Deletions All or selected tuples can be del eted from a table using the delete command delete from where If the where clause is omitted, all tuples are deleted from the table.An extrapolatenative command for deleting all tuples from a table is the truncate table command. However, in this case, the deletions cannot be undone (see subsequent Section 1. 4. 4). Example Delete all projects (tuples) that have been ? nished before the existing date (system date) delete from PROJECT where PEND sysdate sysdate is a function in SQL that returns the system date. Another important SQL function is user, which returns the name of the user logged into the present-day(prenominal) Oracle session. 1. 4. 4 Commit and Rollback A place of database modi? cations, i. e. , a eon of insert, update, and delete statements, is called a transaction.Modi? cations of tuples are temporarily stored in the database system. They become aeonian only after the statement commit has been issued. As long as the user has not issued the commit statement, it is possible to undo all modi? cations since the brave out commit. To undo modi? cations, one has to issue the statement rollback. It is advisable to effected each modi? cation of the database with a commit (as long as the modi? cation has the expected e? ect). Note that any data de? nition command such as create table results in an informal commit. A commit is also implicitly executed when the user terminates an Oracle session. . 5 Queries (Part II) In Section 1. 2 we have only focused on queries that refer to exactly one table. Furthermore, conditions in a where were restricted to simple comparisons. A major property of relational databases, however, is to comply ( nub) tuples stored in di? erent tables in order to display more meaningful and complete information. In SQL the select statement is used for this soft of queries joining relations 11 select distinct . , . . . , . from , . . . , where The speci? cation of table aliases in the from clause is necessary to refer t o columns that have the same name in di? rent tables. For example, the column DEPTNO legislates in two EMP and DEPT. If we want to refer to either of these columns in the where or select clause, a table alias has to be speci? ed and put in the bet of the column name. Instead of a table alias also the complete relation name can be put in front of the column such as DEPT. DEPTNO, but this sometimes can lead to rather lengthy query formulations. 1. 5. 1 Joining Relations Comparisons in the where clause are used to combine rows from the tables listed in the from clause. Example In the table EMP only the numbers of the departments are stored, not their name.For each salesman, we now want to retrieve the name as well as the number and the name of the department where he is working select ENAME, E. DEPTNO, DNAME from EMP E, DEPT D where E. DEPTNO = D. DEPTNO and JOB = SALESMAN Explanation E and D are table aliases for EMP and DEPT, respectively. The computation of the query result oc m ongrels in the following sort (without optimization) 1. Each row from the table EMP is combined with each row from the table DEPT (this operation is called Cartesian delveuct ). If EMP contains m rows and DEPT contains n rows, we thus get n ? m rows. 2.From these rows those that have the same department number are selected (where E. DEPTNO = D. DEPTNO). 3. From this result ? nally all rows are selected for which the condition JOB = SALESMAN holds. In this example the joining condition for the two tables is based on the equality operator =. The columns compared by this operator are called join columns and the join operation is called an equijoin. all number of tables can be combined in a select statement. Example For each project, retrieve its name, the name of its manager, and the name of the department where the manager is working select ENAME, DNAME, PNAME rom EMP E, DEPT D, PROJECT P where E. EMPNO = P. MGR and D. DEPTNO = E. DEPTNO 12 It is even possible to join a table with itself Example magnetic dip the name calling of all employees together with the name of their manager select E1. ENAME, E2. ENAME from EMP E1, EMP E2 where E1. MGR = E2. EMPNO Explanation The join columns are MGR for the table E1 and EMPNO for the table E2. The equijoin comparison is E1. MGR = E2. EMPNO. 1. 5. 2 Subqueries Up to now we have only concentrated on simple comparison conditions in a where clause, i. e. , we have compared a column with a constant or we have compared two columns.As we have already seen for the insert statement, queries can be used for assignments to columns. A query result can also be used in a condition of a where clause. In such a case the query is called a subquery and the complete select statement is called a nested query. A respective condition in the where clause then can have one of the following forms 1. Set-valued subqueries not in () anyall () An can either be a column or a computed value. 2. Test for (non)existence not exists () In a where clau se conditions using subqueries can be combined indiscriminately by using the logical connectives and and or.Example List the name and salary of employees of the department 20 who are leading a project that started before declination 31, 1990 select ENAME, SAL from EMP where EMPNO in (select PMGR from PROJECT where PSTART 31-DEC-90) and DEPTNO =20 Explanation The subquery retrieves the set of those employees who manage a project that started before December 31, 1990. If the employee working in department 20 is contained in this set (in operator), this tuple belongs to the query result set. Example List all employees who are working in a department located in BOSTON 13 select ? from EMP where DEPTNO in select DEPTNO from DEPT where LOC = BOSTON) The subquery retrieves only one value (the number of the department located in Boston). Thus it is possible to use = instead of in. As long as the result of a subquery is not know in advance, i. e. , whether it is a single value or a set, it is advisable to use the in operator. A subquery may use again a subquery in its where clause. Thus conditions can be nested arbitrarily. An important class of subqueries are those that refer to its surrounding (sub)query and the tables listed in the from clause, respectively. Such type of queries is called cor connect subqueries.Example List all those employees who are working in the same department as their manager (note that components in are optional select ? from EMP E1 where DEPTNO in (select DEPTNO from EMP E where E. EMPNO = E1. MGR) Explanation The subquery in this example is related to its surrounding query since it refers to the column E1. MGR. A tuple is selected from the table EMP (E1) for the query result if the value for the column DEPTNO occurs in the set of values select in the subquery. One can think of the evaluation of this query as follows For each tuple in the table E1, the subquery is evaluated individually.If the condition where DEPTNO in . . . evaluates to true, this tuple is selected. Note that an alias for the table EMP in the subquery is not necessary since columns without a preceding alias listed there always refer to the innermost query and tables. Conditions of the form anyall are used to compare a given with each value selected by . For the clause any, the condition evaluates to true if there exists at least on row selected by the subquery for which the comparison holds. If the subquery yields an empty result set, the condition is not satis? ed. For the clause all, in contrast, the condition evaluates to true if for all rows selected by the subquery the comparison holds. In this case the condition evaluates to true if the subquery does not yield any row or value. Example Retrieve all employees who are working in department 10 and who earn at least as much as any (i. e. , at least one) employee working in department 30 select ? from EMP where SAL = any (select SAL from EMP where DEPTNO = 30) and DEPTNO = 10 14 Note besides in this subquery no aliases are necessary since the columns refer to the innermost from clause.Example List all employees who are not working in department 30 and who earn more than all employees working in department 30 select ? from EMP where SAL all (select SAL from EMP where DEPTNO = 30) and DEPTNO 30 For all and any, the following equivalences hold in ? = any not in ? all or = all often a query result depends on whether certain rows do (not) exist in (other) tables. Such type of queries is formulated using the exists operator. Example List all departments that have no employees select ? from DEPT where not exists (select ? from EMP where DEPTNO = DEPT.DEPTNO) Explanation For each tuple from the table DEPT, the condition is violateed whether there exists a tuple in the table EMP that has the same department number (DEPT. DEPTNO). In case no such tuple exists, the condition is satis? ed for the tuple under consideration and it is selected. If there exists a corresponding tupl e in the table EMP, the tuple is not selected. 1. 5. 3 Operations on termination Sets Sometimes it is useful to combine query results from two or more queries into a single result. SQL supports one-third set operators which have the pattern The set operators are union all returns a table consisting of all rows either coming into court in the result of or in the result of . Duplicates are automatically eliminated unless the clause all is used. intersect returns all rows that appear in both results and . minus returns those rows that appear in the result of but not in the result of . 15 Example Assume that we have a table EMP2 that has the same structure and columns as the table EMP All employee numbers and names from both tables select EMPNO, ENAME from EMP union select EMPNO, ENAME from EMP2 Employees who are listed in both EMP and EMP2 select ? from EMP intersect select ? from EMP2 Employees who are only listed in EMP select ? from EMP minus select ? from EMP2 Each operator r equires that both tables have the same data types for the columns to which the operator is applied. 1. 5. 4 Grouping In Section 1. 2. 4 we have seen how aggregate functions can be used to compute a single value for a column. Often coats require assemblageing rows that have certain properties and then applying an aggregate function on one column for each separate separately. For this, SQL provides the clause group by . This clause appears after the where clause and must refer to columns of tables listed in the from clause. select from here group by having Those rows retrieved by the selected clause that have the same value(s) for are grouped. Aggregations speci? ed in the select clause are then applied to each group separately. It is important that only those columns that appear in the clause can be listed without an aggregate function in the select clause Example For each department, we want to retrieve the minimum and maximum salary. select DEPTNO, min(SAL), max(SAL) from EMP group by DEPTNO Rows from the table EMP are grouped such that all rows in a group have the same department number. The aggregate functions are then applied to each such group.We thus get the following query result 16 DEPTNO 10 20 30 MIN(SAL) 1300 800 950 MAX(SAL) 5000 3000 2850 Rows to form a group can be restricted in the where clause. For example, if we add the condition where JOB = CLERK, only respective rows build a group. The query then would retrieve the minimum and maximum salary of all clerks for each department. Note that is not allowed to specify any other column than DEPTNO without an aggregate function in the select clause since this is the only column listed in the group by clause (is it also easy to see that other columns would not make any sense).Once groups have been formed, certain groups can be eliminated based on their properties, e. g. , if a group contains less than tierce rows. This type of condition is speci? ed using the having clause. As for the select clau se also in a having clause only and aggregations can be used. Example Retrieve the minimum and maximum salary of clerks for each department having more than three clerks. select DEPTNO, min(SAL), max(SAL) from EMP where JOB = CLERK group by DEPTNO having count(? ) 3 Note that it is even possible to specify a subquery in a having clause.In the above query, for example, instead of the constant 3, a subquery can be speci? ed. A query containing a group by clause is neat in the following way 1. Select all rows that satisfy the condition speci? ed in the where clause. 2. From these rows form groups according to the group by clause. 3. thrash about all groups that do not satisfy the condition in the having clause. 4. employ aggregate functions to each group. 5. Retrieve values for the columns and aggregations listed in the select clause. 1. 5. 5 Some Comments on Tables Accessing tables of other usersProvided that a user has the favor to get at tables of other users (see also Section 3), she/he can refer to these tables in her/his queries. Let be a user in the Oracle system and a table of this user. This table can be admissioned by other (privileged) users using the command select ? from . 17 In case that one often refers to tables of other users, it is useful to use a synonym instead of .. In Oracle-SQL a synonym can be created using the command create synonym for . It is then possible to use simply in a from clause. Synonyms can also be created for ones own tables. Adding Comments to De? nitionsFor applications that include numerous tables, it is useful to add comments on table de? nitions or to add comments on columns. A comment on a table can be created using the command comment on table is A comment on a column can be created using the command comment on column . is Comments on tables and columns are stored in the data lexicon. They can be accessed using the data lexicon emplacements exploiter TAB COMMENTS and substance abuser COL COMMENTS (see a lso Section 3). Modifying Table- and Column De? nitions It is possible to modify the structure of a table (the relation schema) even if rows have already been inserted into this table.A column can be added using the alter table command alter table add( default ) If more than only one column should be added at one time, respective add clauses neediness to be separated by colons. A table constraint can be added to a table using alter table add () Note that a column constraint is a table constraint, too. not null and primary key constraints can only be added to a table if none of the speci? ed columns contains a null value. Table de? nitions can be modi? ed in an analogous way. This is useful, e. g. , when the size of strings that can be stored needs to be increased.The syntax of the command for modifying a column is alter table modify( default ) Note In earlier versions of Oracle it is not possible to delete single columns from a table de? nition. A workaround is to create a tempo rary table and to retroflex respective columns and rows into this new table. Furthermore, it is not possible to rename tables or columns. In the most new-made version (9i), using the alter table command, it is possible to rename a table, columns, and constraints. In this version, there also exists a drop column clause as part of the alter table statement. Deleting a TableA table and its rows can be deleted by issuing the command drop table cascade constraints. 18 1. 6 Views In Oracle the SQL command to create a tidy sum (virtual table) has the form create or replace facet () as with check option constraint The optional clause or replace re-creates the view if it already exists. names the columns of the view. If is not speci? ed in the view de? nition, the columns of the view get the same names as the attributes listed in the select statement (if possible). Example The following view contains the name, job title and the annual salary of employees working in the department 20 cre ate view DEPT20 as elect ENAME, JOB, SAL? 12 yearly lucre from EMP where DEPTNO = 20 In the select statement the column alias one-year SALARY is speci? ed for the expression SAL? 12 and this alias is taken by the view. An alternative formulation of the above view de? nition is create view DEPT20 (ENAME, JOB, ANNUAL SALARY) as select ENAME, JOB, SAL ? 12 from EMP where DEPTNO = 20 A view can be used in the same way as a table, that is, rows can be retrieved from a view (also respective rows are not physically stored, but derived on basis of the select statement in the view de? ition), or rows can even be modi? ed. A view is evaluated again each time it is accessed. In Oracle SQL no insert, update, or delete modi? cations on views are allowed that use one of the following clears in the view de? nition Joins Aggregate function such as sum, min, max etc. set-valued subqueries (in, any, all) or test for existence (exists) group by clause or distinct clause In combination with the clause with check option any update or insertion of a row into the view is rejected if the new/modi? ed row does not meet the view de? nition, i. e. these rows would not be selected based on the select statement. A with check option can be named using the constraint clause. A view can be deleted using the command delete . 19 2 SQL*Plus Introduction SQL*Plus is the interactive (low-level) user interface to the Oracle database management system. Typically, SQL*Plus is used to issue ad-hoc queries and to view the query result on the class. Some of the features of SQL*Plus are A built-in command line cut downor can be used to edit (incorrect) SQL queries. Instead of this line editor any editor installed on the computer can be invoked. There are numerous commands to format the output of a query. SQL*Plus provides an online-help. Query results can be stored in ? les which then can be printed. Queries that are frequently issued can be salve to a ? le and invoked later. Queries can be parameterized such that it is possible to invoke a saved query with a parameter. A Minimal User Guide Before you start SQL*Plus make sure that the following UNIX outwit variables are properly set (shell variables can be checked using the env command, e. g. , env grep ORACLE) ORACLE mob, e. g. , ORACLE HOME=/usr/pkg/oracle/734 ORACLE SID, e. , ORACLE SID=prod In order to invoke SQL*Plus from a UNIX shell, the command sqlplus has to be issued. SQL*Plus then displays some information about the product, and prompts you for your user name and password for the Oracle system. gertz(catbert)54 sqlplus SQL*Plus call on 3. 3. 4. 0. 1 Production on Sun Dec 20 191652 1998 right of first publication (c) Oracle Corporation 1979, 1996. All rights reserved. Enter user-name scott Enter password committed to Oracle7 Server Release 7. 3. 4. 0. 1 Production Release With the distributed option PL/SQL Release 2. 3. 4. 0. 0 Production SQL 20SQL is the prompt you get when you are connected to the Oracle database system. In SQL*Plus you can divide a statement into separate lines, each continuing line is indicated by a prompt such 2, 3 etc. An SQL statement must always be terminated by a semicolon (). In addition to the SQL statements discussed in the previous section, SQL*Plus provides some special SQL*Plus commands. These commands need not be terminated by a semicolon. Upper and lower case letters are only important for string comparisons. An SQL query can always be interrupt by using C. To event SQL*Plus you can either type exit or quit.Editor Commands The most recently issued SQL statement is stored in the SQL bu? er, supreme of whether the statement has a correct syntax or not. You can edit the bu? er using the following commands list lists all lines in the SQL bu? er and sets the veritable line (marked with an ? ) to the last line in the bu? er. l sets the actual line to change// replaces the ? rst occurrence of by (for the actual line) append appends to the cur rent line del deletes the current line run executes the current bu? er contents get reads the data from the ? le into the bu? er save writes the current bu? r into the ? le edit invokes an editor and oodles the current bu? er into the editor. After exiting the editor the modi? ed SQL statement is stored in the bu? er and can be executed (command r). The editor can be de? ned in the SQL*Plus shell by typing the command de? ne editor = , where can be any editor such as emacs, vi, joe, or jove. SQL*Plus Help System and Other Useful Commands To get the online help in SQL*Plus just type help , or just help to get information about how to use the help command. In Oracle Version 7 one can get the complete list of possible commands by typing help command. To change the password, in Oracle Version 7 the command alter user identi? ed by is used. In Oracle Version 8 the command passw prompts the user for the old/new password. The command describe lists all columns of the given table t ogether with their data types and information about whether null values are allowed or not. You can invoke a UNIX command from the SQL*Plus shell by using host . For example, host ls -la *. sql lists all SQL ? les in the current directory. 21 You can log your SQL*Plus session and thus queries and query results by using the command spool .All information displayed on screen is then stored in which automatically gets the extension . lst. The command spool o? turns spooling o?. The command copy can be used to copy a complete table. For example, the command copy from scott/tiger create EMPL using select ? from EMP copies the table EMP of the user scott with password tiger into the relation EMPL. The relation EMP is automatically created and its structure is derived based on the attributes listed in the select clause. SQL commands saved in a ? le . sql can be loaded into SQL*Plus and executed using the command . Comments are introduced by the clause remark (only allowed between SQL s tatements), or (allowed within SQL statements). Formatting the Output SQL*Plus provides numerous commands to format query results and to build simple reports. For this, format variables are set and these settings are only valid during the SQL*Plus session. They get lost after terminating SQL*Plus. It is, however, possible to save settings in a ? le named login. sql in your home directory. Each time you invoke SQL*Plus this ? le is automatically loaded. The command column . . . is used to format columns of your query result.The most frequently used options are format A For alphanumeric data, this option sets the length of to . For columns having the data type number, the format command can be used to specify the format before and after the decimal point. For example, format 99,999. 99 speci? es that if a value has more than three digits in front of the decimal point, digits are separated by a colon, and only two digits are displayed after the decimal point. The option heading rel abels and gives it a new heading. null is used to specify the output of null values (typically, null values are not displayed). column clear deletes the format de? nitions for . The command set linesize can be used to set the maximum length of a single line that can be displayed on screen. set pagesize sets the kernel number of lines SQL*Plus displays before printing the column names and headings, respectively, of the selected rows. Several other formatting features can be enabled by setting SQL*Plus variables. The command show all displays all variables and their current values. To set a variable, type set . For example, set time on causes SQL*Plus to display timing statistics for each SQL command that is executed. et pause on makes SQL*Plus wait for you to press Return after the number of lines de? ned by set pagesize has been displayed. is the message SQL*Plus will display at the bottom of the screen as it waits for you to hit Return. 22 3 Oracle Data Dictionary The Oracle da ta dictionary is one of the most important components of the Oracle DBMS. It contains all information about the structures and objects of the database such as tables, columns, users, data ? les etc. The data stored in the data dictionary are also often called metadata.Although it is usually the domain of database administrators (DBAs), the data dictionary is a valuable source of information for end users and developers. The data dictionary consists of two levels the internal level contains all base tables that are used by the various DBMS software components and they are normally not getatable by end users. The external level provides numerous views on these base tables to access information about objects and structures at di? erent levels of detail. 3. 1 Data Dictionary Tables An installation of an Oracle database always includes the asylum of three standard Oracle users SYS This is the owner of all data dictionary tables and views. This user has the highest privileges to manage objects and structures of an Oracle database such as creating new users. SYSTEM is the owner of tables used by di? erent tools such SQL*Forms, SQL*Reports etc. This user has less privileges than SYS. PUBLIC This is a dummy user in an Oracle database. All privileges assigned to this user are automatically assigned to all users cognize in the database. The tables and views provided by the data dictionary contain information about users and their privileges, tables, table columns and their data types, integrity constraints, indexes, statistics about tables and indexes used by the optimizer, privileges give on database objects, storage structures of the database. The SQL command select ? from DICTIONARY lists all tables and views of the data dictionary that are accessible to the user. The selected information includes the name and a short exposition of each table and view. Before issuing this query, check the column de? nitions of DICTIONARY using desc DICTIONARY and set the ap propriate values for column using the format command. The query select ? from TAB etrieves the names of all tables owned by the user who issues this command. The query select ? from COL 23 returns all information about the columns of ones own tables. Each SQL query requires various internal accesses to the tables and views of the data dictionary. Since the data dictionary itself consists of tables, Oracle has to generate numerous SQL statements to check whether the SQL command issued by a user is correct and can be executed. Example The SQL query select ? from EMP where SAL 2000 requires a veri? cation whether (1) the table EMP exists, (2) the user has the privilege to access this table, (3) the column SAL is de? ed for this table etc. 3. 2 Data Dictionary Views The external level of the data dictionary provides users a front end to access information relevant to the users. This level provides numerous views (in Oracle7 slightly 540) that represent (a portion of the) data from the base tables in a unclouded and understandable manner. These views can be used in SQL queries just like normal tables. The views provided by the data dictionary are divided into three groups substance abuser, ALL, and DBA. The group name builds the pre? x for each view name. For some views, there are associated synonyms as given in brackets below. USER Tuples in the USER views contain information about objects owned by the account performing the SQL query (current user) USER TABLES USER USER USER USER USER USER CATALOG COL COMMENTS CONSTRAINTS INDEXES OBJECTS TAB COLUMNS USER USER USER USER TAB COMMENTS TRIGGERS USERS VIEWS all tables with their name, number of columns, storage information, statistical information etc. (TABS) tables, views, and synonyms (CAT) comments on columns constraint de? nitions for tables all information about indexes created for tables (IND) all database objects owned by the user (OBJ) columns of the tables and views owned by the user COLS) comments on tab les and views triggers de? ned by the user information about the current user views de? ned by the user ALL Rows in the ALL views include rows of the USER views and all information about objects that are accessible to the current user. The structure of these views is analogous to the structure of the USER views. 24 ALL CATALOG owner, name and type of all accessible tables, views, and synonyms ALL TABLES owner and name of all accessible tables ALL OBJECTS owner, type, and name of accessible database objects ALL TRIGGERS . . . ALL USERS ALL VIEWS DBA The DBA views cover up information about all database objects, regardless of the owner. Only users with DBA privileges can access these views. DBA DBA DBA DBA DBA TABLES CATALOG OBJECTS DATA FILES USERS tables of all users in the database tables, views, and synonyms de? ned in the database object of all users information about data ? les information about all users known in the database 25 4 Application Programming 4. 1 4. 1. 1 PL/S QL Introduction The development of database applications typically requires language constructs similar to those that can be found in program languages such as C, C++, or Pascal.These constructs are necessary in order to implement complex data structures and algorithms. A major restriction of the database language SQL, however, is that many tasks cannot be gracious by using only the provided language elements. PL/SQL (Procedural Language/SQL) is a adjective extension of Oracle-SQL that o? ers language constructs similar to those in dictatorial program languages. PL/SQL allows users and designers to develop complex database applications that require the usage of control structures and procedural elements such as procedures, functions, and staffs. The basic construct in PL/SQL is a bury.Blocks allow designers to combine logically related (SQL-) statements into units. In a farce, constants and variables can be curb, and variables can be used to store query results. Statements in a PL/SQL resist include SQL statements, control structures ( grommets), condition statements (if-then-else), exception handling, and calls of other PL/SQL pulley blocks. PL/SQL blocks that specify procedures and functions can be grouped into piece of lands. A package is similar to a module and has an interface and an implementation part. Oracle o? ers several prede? ned packages, for example, input/output routines, ? le handling, job scheduling etc. see directory $ORACLE HOME/rdbms/admin). Another important feature of PL/SQL is that it o? ers a mechanism to fulfill query results in a tuple-oriented way, that is, one tuple at a time. For this, pointers are used. A arrow basically is a pointer to a query result and is used to read attribute values of selected tuples into variables. A arrow typically is used in combination with a lace construct such that each tuple read by the arrow can be processed individually. In summary, the major goals of PL/SQL are to increase the ex pressiveness of SQL, process query results in a tuple-oriented way, optimize combined SQL statements, develop modular database application programs, reuse program code, and reduce the cost for maintaining and changing applications. 26 4. 1. 2 Structure of PL/SQL-Blocks PL/SQL is a block-structured language. Each block builds a (named) program unit, and blocks can be nested. Blocks that build a procedure, a function, or a package must be named. A PL/SQL block has an optional declare section, a part containing PL/SQL statements, and an optional exception-handling part. Thus the structure of a PL/SQL looks as follows (brackets innovate optional parts) declare begin exception end The block header speci? s whether the PL/SQL block is a procedure, a function, or a package. If no header is speci? ed, the block is said to be an anonymous PL/SQL block. Each PL/SQL block again builds a PL/SQL statement. Thus blocks can be nested like blocks in conventional programming languages. The scope of state variables (i. e. , the part of the program in which one can refer to the variable) is analogous to the scope of variables in programming languages such as C or Pascal. 4. 1. 3 Declarations Constants, variables, cursors, and exceptions used in a PL/SQL block must be declared in the declare section of that block.Variables and constants can be declared as follows constant not null = Valid data types are SQL data types (see Section 1. 1) and the data type boolean. Boolean data may only be true, false, or null. The not null clause requires that the declared variable must always have a value di? erent from null. is used to initialize a variable. If no expression is speci? ed, the value null is assigned to the variable. The clause constant states that once a value has been assigned to the variable, the value cannot be changed (thus the variable becomes a constant). Example declare hire date job title mp found salary incr begin . . . end date /* implicit initialization wi th null */ varchar2(80) = Salesman boolean /* implicit initialization with null */ constant number(3,2) = 1. 5 /* constant */ 27 Instead of specifying a data type, one can also refer to the data type of a table column (so-called anchored resolve). For example, EMP. Empno%TYPE refers to the data type of the column Empno in the relation EMP. Instead of a single variable, a drop off can be declared that can store a complete tuple from a given table (or query result). For example, the data type DEPT%ROWTYPE speci? s a record suitable to store all attribute values of a complete row from the table DEPT. Such records are typically used in combination with a cursor. A ? eld in a record can be accessed using . , for example, DEPT. Deptno. A cursor declaration speci? es a set of tuples (as a query result) such that the tuples can be processed in a tuple-oriented way (i. e. , one tuple at a time) using the fetch statement. A cursor declaration has the form cursor () is The cursor name is an undeclared identi? er, not the name of any PL/SQL variable. A parameter has the form . Possible parameter types are char, archar2, number, date and boolean as well as corresponding subtypes such as integer. Parameters are used to assign values to the variables that are given in the select statement. Example We want to retrieve the following attribute values from the table EMP in a tupleoriented way the job title and name of those employees who have been hired after a given date, and who have a manager working in a given department. cursor employee cur (start date date, dno number) is select JOB, ENAME from EMP E where HIREDATE start date and exists (select ? from EMP where E. MGR = EMPNO and DEPTNO = dno)If (some) tuples selected by the cursor will be modi? ed in the PL/SQL block, the clause for update() has to be added at the end of the cursor declaration. In this case selected tuples are locked and cannot be accessed by other users until a commit has been issued. Before a declar ed cursor can be used in PL/SQL statements, the cursor must be promiscuoused, and after processing the selected tuples the cursor must be cheeseparingd. We discuss the usage of cursors in more detail below. Exceptions are used to process errors and warnings that occur during the execution of PL/SQL statements in a controlled manner.Some exceptions are internally de? ned, such as ZERO DIVIDE. Other exceptions can be speci? ed by the user at the end of a PL/SQL block. User de? ned exceptions need to be declared using exception. We will discuss exception handling in more detail in Section 4. 1. 5 4. 1. 4 Language Elements In addition to the declaration of variables, constants, and cursors, PL/SQL o? ers various language constructs such as variable assignments, control structures (eyelets, if-then-else), procedure and function calls, etc. However, PL/SQL does not allow commands of the SQL data de? nition language such as the create table statement.For this, PL/SQL provides special pac kages. 28 Furthermore, PL/SQL uses a modi? ed select statement that requires each selected tuple to be assigned to a record (or a list of variables). There are several alternatives in PL/SQL to a assign a value to a variable. The most simple way to assign a value to a variable is declare homecoming integer = 0 begin counter = counter + 1 Values to assign to a variable can also be retrieved from the database using a select statement select into from where It is important to ensure that the select statement retrieves at most one tuple Otherwise it is not possible to assign the attribute values to the speci? ed list of variables and a runtime error occurs. If the select statement retrieves more than one tuple, a cursor must be used instead. Furthermore, the data types of the speci? ed variables must match those of the retrieved attribute values. For most data types, PL/SQL performs an automatic type conversion (e. g. , from integer to real). Instead of a list of single variables, a record can be given after the keyword into. Also in this case, the select statement must retrieve at most one tuple declare mployee rec EMP%ROWTYPE max sal EMP. SAL%TYPE begin select EMPNO, ENAME, JOB, MGR, SAL, COMM, HIREDATE, DEPTNO into employee rec from EMP where EMPNO = 5698 select max(SAL) into max sal from EMP end PL/SQL provides while- loop-the-loops, two types of for-loops, and continuous loops. Latter ones are used in combination with cursors. All types of loops are used to execute a sequence of statements multiple times. The speci? cation of loops occurs in the same way as known from imperative programming languages such as C or Pascal. A while-loop has the pattern while loop end loop 9 A loop can be named. Naming a loop is useful whenever loops are nested and inner loops are accurate unconditionally using the exit statement. Whereas the number of iterations through a while loop is unknown until the loop completes, the number of iterations through the for loop can be speci? ed using two integers. for in reverse .. loop end loop The loop counter is declared implicitly. The scope of the loop counter is only the for loop. It overrides the scope of any variable having the same name outside the loop. Inside the for loop, can be cite like a constant. ay appear in expressions, but one cannot assign a value to . Using the keyword reverse causes the iteration to proceed down from the higher bound to the lower bound. Processing Cursors Before a cursor can be used, it must be opened using the open statement open () The associated select statement then is processed and the cursor references the ? rst selected tuple. Selected tuples then can be processed one tuple at a time using the fetch command fetch into The fetch command assigns the selected attribute values of the current tuple to the list of variables.After the fetch command, the cursor advances to the next tuple in the result set. Note that the variables in the list must have the same data types as the selected values. After all tuples have been processed, the taut command is used to disable the cursor. close The example below illustrates how a cursor is used together with a continuous loop declare cursor emp cur is select ? from EMP emp rec EMP%ROWTYPE emp sal EMP. SAL%TYPE begin open emp cur loop fetch emp cur into emp rec exit when emp cur%NOTFOUND emp sal = emp rec. sal end loop close emp cur end 30Each loop can be completed unconditionally using the exit clause exit when Using exit without a block label causes the completion of the loop that contains the exit statement. A condition can be a simple comparison of values. In most cases, however, the condition refers to a cursor. In the example above, %NOTFOUND is a avouch that evaluates to false if the most recent fetch command has read a tuple. The value of %NOTFOUND is null before the ? rst tuple is fetched. The predicate evaluates to true if the most recent fetch failed to return a tuple, and false otherwis e. FOUND is the logical reversion of %NOTFOUND. Cursor for loops can be used to simplify the usage of a cursor for in () loop end loop A record suitable to store a tuple fetched by the cursor is implicitly declared. Furthermore, this loop implicitly performs a fetch at each iteration as well as an open before the loop is entered and a close after the loop is left. If at an iteration no tuple has been fetched, the loop is automatically terminated without an exit. It is even possible to specify a query instead of in a for loop for in () loop end loop That is, a cursor needs not be speci? d before the loop is entered, but is de? ned in the select statement. Example for sal rec in (select SAL + COMM total from EMP) loop end loop total is an alias for the expression computed in the select statement. Thus, at each iteration only one tuple is fetched. The record sal rec, which is implicitly de? ned, then contains only one entry which can be accessed using sal rec. total. Aliases, of c ourse, are not necessary if only attributes are selected, that is, if the select statement contains no arithmetic operators or aggregate functions. For conditional control, PL/SQL o? rs if-then-else