Monday, August 24, 2020
Saturday, August 22, 2020
The Role of Curriculum Design in Learning Experiences Research Paper
The Role of Curriculum Design in Learning Experiences - Research Paper Example The impacts of pondering educational plan and subjects and issues identifying with tutoring or potentially society on the authorized learning encounters of the instructors and decide if this announcement can be concurred or differ upon with introducing proper realities and reasons. Before dissecting the above-gave articulation regarding concurring or differing the equivalent, there lays the need of obtaining a short thought regarding the idea of the points just as the issues connected with tutoring or society that affect the learning encounters established by the instructors. Logically, the nature of the points and the issues connected with tutoring or society can be clearly noted as advancing readiness and reinforcing essential perusing just as composing aptitudes (Malaguzzi, 1994, p. 1-75). Reasonably, by concentrating on these highlights, the learning encounters authorized by the teachers will turn out to be very outcome situated (SAGE Publications, n.d., p. 2-36). There lays the prerequisite of comprehension the socio-social factors that impact an educational program and its execution while concurring that the ordered learning encounters of the teachers get affected by how they consider a particular educational program and the themes alongside the issues identifying with tutoring or society. In such manner, the socio-social factors that impact an educational plan and its usage incorporate social characters, populace and expanded expectations for everyday comforts among others. These elements decidedly impact the ordered learning encounters of the instructors by making them center around building up the undeviating educational plan guidelines (SAGE Publications, n.d., p. 2-36). Aside from comprehension the socio-social factors that impact an educational plan and its execution, there additionally lays the need of fathoming the information and systems that help studentsââ¬â¢ commitment with a particular educational plan.
Wednesday, July 15, 2020
How Not to Fail College Test
How Not to Fail College Test 5 Ways Not to Fail College Test HomeâºEducation Postsâº5 Ways Not to Fail College Test Education PostsCollege test is one of the most difficult tasks during the whole year. It is highly important not to fail college test as this may lead to bad consequences. A lot of students are nervous before exams as they are not prepared to it. They are afraid of tests since during the year they laze around. But students should work hard and find time for studying since exams are around the corner.For this very reason, qualitycustomessays.com offers 5 useful ways not to fail college test:⢠Make notes. Students should always make notes during class. Professors give useful information during lectures which will then be in exams. That is why, donât be lazy to take some notes.⢠Be attentive during class. Questions and tasks which will be in the test are always explained during classes. Pay attention to the professorâs words as this will help you to be more prepared and know more informatio n during your exams. This will reduce time for preparing for the test.⢠Do all assignments. If you write all papers and do all needed assignments during the year, this will help you during test. Doing all tasks greatly increases your chances to receive a good grade during exam.⢠Review information a day before the test. A day before the test, read all your notes again, this will help you to remember all essential points. It is very important to review the information as you will easily remember those points which you read yesterday.⢠Relax during test. Donât be nervous during exam. When people are nervous, they forget important things. Take your time, pull yourself together, and everything will be alright.Consider these recommendations and donât forget that college is a place where you should study. If you study during the year, you wonât have to worry about the tests.
Thursday, May 21, 2020
Ethnic Racism And Colonialism Are The Leading Cause Behind...
Ethnic Racism and Colonialism are the leading cause behind Mental Health In Reserves. Mental Health is a universal factor that affects every individual, no matter geographical location, ethnicity, gender or age. Often Mental Health can be the factor that leads to ethnic racism or geographical inequality. But both factors lie hand in hand in regards to Mental Health. In this case ethnic Racism and geographical inequalities is found to be the leading factor in the cause of mental health in Indigenous reserves around the world, especially in Northern Canada. Reserves such as the Indigenous Cree community of Attawapiskat whose land was taken and used as a resource mine and the soil was used as space for a diesel leak or the Slavi-Loucheuxâ⬠¦show more contentâ⬠¦Although many people believe this is the right way to proceed due to the enormous rate of Aboriginal criminals in jail, but often the reason they reside in this situation is due to the limited resources they have resulting in fending themselves and committing street-crimes. We are the cause behind why they s trive to keep their culture and reserve alive and in a livable standards. Because of the geographical inequalities and ethnic racism target towards their culture, they experience increasing rates of mental health thus causing poor health and a declining population. What is Ethnic Inequalities? Ethnic Racism is an occurrence that Indigenous population experience everyday, during work, going off the reserves, attending school or even mundane chores. A striking 97% of Indigenous individuals have experienced racism within a year time span, while 70% have been targets of more then eight counts of racist situations. (Adams et al. 2014) Many of our laws were made to created a set of boundaries that decrease their ability to fit in with out society and voice their opinions and concerns. Non-Aboriginals saw the reserve population to be below us and titled them as ââ¬Å"savagesâ⬠due to the lack of sanitation, intelligence, health, and income. Those factors affect many of the Indigenous tribes because of the inequalities we have placed onto their reserves. Inequalities such as the lack of medical help or the vast amount of
Wednesday, May 6, 2020
Classic Drucker Book Report Free Essays
Classic Drucker Book Report Recently, I had the pleasure of reading ââ¬Å"Classic Druckerâ⬠. The book contains 15 articles from Peter Drucker that were printed in the ââ¬Å"Harvard Business Reviewâ⬠. I chose a few takeaways with an explanation on why I chose them and how they can apply to your career. We will write a custom essay sample on Classic Drucker Book Report or any similar topic only for you Order Now 1. ââ¬Å"Whenever you make a key decision, write it down. â⬠Next to it, write down what you expect the end result will be. â⬠As you compile these decisions, review each on after an extended period of time. You will be surprised of your results and over time you may get increasingly accurate on your expected results. 2. ââ¬Å"Mathematicians are born, but everyone can learn trigonometry. â⬠Some people are just naturally more intelligent than others but at the same time, we can learn some of the components of what they know, and know those components just as much as they can. 3. ââ¬Å"Manners enable two people to work together whether they like each other or not. â⬠The words ââ¬Å"pleaseâ⬠and ââ¬Å"thanksâ⬠go a long way in the business world. I even go as far as saying thanks when someone gives me a new assignment. At times they seem surprised but to be genuinely appreciative will show commitment to the team. 4. ââ¬Å"Too many people work in ways that are not their ways, and that almost guarantees nonperformanceâ⬠. Your peers may have work habits that are not the same as yours but that doesnââ¬â¢t make them non productive. Productivity revolves around results, not oneââ¬â¢s arrival time, or the fact that a person prefers to wear headphones while they work. 5. ââ¬Å"To be effective in an organization, a personââ¬â¢s values must be compatible with the organizationââ¬â¢s valuesâ⬠. I interpreted this to mean, I am going to be much more successful if my values are aligned with my companies. Doing so will ensure that I am committed and passionate about my work, which has a better chance of leading to success. I wouldnââ¬â¢t feel comfortable working for a company that practiced in lying and cheating to achieve its objectives. 6. ââ¬Å"It is incumbent on the people who work with them (bosses) to observer them, to find out how they work, and to adapt themselves to what makes their bosses more effectiveâ⬠. It has always been a goal of mine to keep all of my work off my bossââ¬â¢s plate, and to take responsibility for everything involving the products that I work on. The entire product might not be my responsibility but the more I can take on, the more my boss can be strategic. 7. ââ¬Å"The theory of business becomes ââ¬Å"culture. â⬠But culture is no substitute for discipline, and the theory of the business is a disciplineâ⬠. A company with a good culture that you are comfortable with might not necessarily relate to results. Culture doesnââ¬â¢t necessarily meet deadlines. Tasks and rules seem to have a better chance of meeting guidelines than ââ¬Å"family businessâ⬠. 8. ââ¬Å"All events but the truly unique require a generic solutionâ⬠. I think of how the Product Development Process that has recently been applied to all of the products where I work and how every single one fits in at some phase of that process. The products had a problem being completed. Now we see the end with the implementation of a generic process. 9. Temps are a good way to avoid rules and regulations for employers. A highly trained temp can do the job without the corporate commitment and the need to adhere to hiring/firing HR standards that apply to every day employees. The employees are also easily manageable since many of them are already managed by their agencies. 10. ââ¬Å"Leadership knows something someone else doesnââ¬â¢tâ⬠. This is the most important takeaway for me. Some people think leadership means type-a personality or being stern, but knowledge truly is power. Knowing something someone else doesnââ¬â¢t puts you in the front, with an opportunity to teach and display, some functions of what many people consider leaders. How to cite Classic Drucker Book Report, Essay examples
Saturday, April 25, 2020
Stories of Your Life and Others Review Essay Example
Stories of Your Life and Others Review Paper Essay on Stories of Your Life and Others Ethans main thesis is that people who do not love the Lord, just do not understand it; God really merciless, unkind and unjust, and those who do not recognize this truth, never fail to fall in love with his true love. And if you aspire sincerely love the Lord, he must be ready to do it, regardless of any of its intentions with respect to you. Well, what can I say, I seem to have found another favorite science fiction. They became simple American boy with a simple American name Chan . Hell is the absence of God the next experiment the author of a small adjustment we okurazhayuschey reality. Imagine that you live in a world where the issue of trust / do not believe in God not worth it. He does not exist for one simple reason God is. People are constantly see angels (they are even part of mass culture), and each departure of the soul rendered and you can see whether the person flew to Paradise, or opened up the solid and nizvegnulsya it into Hell. Oh, hell do cool stuff. From time to time arranged hellish presentation. The earth under the feet of passers-by becomes transparent and you can watch a hell of life-being, which is not much different from the life of the earth We will write a custom essay sample on Stories of Your Life and Others Review specifically for you for only $16.38 $13.9/page Order now We will write a custom essay sample on Stories of Your Life and Others Review specifically for you FOR ONLY $16.38 $13.9/page Hire Writer We will write a custom essay sample on Stories of Your Life and Others Review specifically for you FOR ONLY $16.38 $13.9/page Hire Writer Each of the angels coming accompanied by equally as miracles and misfortunes.. Appear some Nathaniel in all its radiant mosche and beauty and hand of his heal the suffering, but on the other hand, the exhaust from a reactive metaphysical engine, by which the angelic carcass moves may well bring down the house and the ruins of the people will die . Here is a harmony. And, of course, each time after these visits, people are divided into bestow benefits and those who murmur, not realizing the inscrutability of the ways of the Lord. One of these denied and became our protagonist Neil Fisk whose wife died rugged glass windows exploded, when the angel appeared. Oh, miracle! one of those who was there no one was hurt! The main dilemma Fisk becomes the ascension of his beloved wife in Paradise. Rather, he wanted her to descend into Hell then do not hesitate for a second, he would have committed suicide to cast into hell for his beloved. But the knock on the pearly gates more difficult. But love is pushing on madness, and even in the gates you can find a loophole Stories Ted Chan is undoubtedly good for its grotesque scenes, deep thoughts, and ideas -. Which can be happy to stop and think. Good and language (translation). Very poetic. But what is especially good Ted Chiang the fact that he technician by training. And because, in his stories all logical narrative goes smoothly one comes from another and there are no contradictions, better still immerses the reader in the space of the work, though in reality Read the story of Ted Chan. : Hell is the absence of God
Wednesday, March 18, 2020
Solar Power essays
Solar Power essays It is the year 2032. The world we live in is not that much different from the one that we occupied no more than thirty years ago. We still have schools, we still have crime and we still share love as much as we do hate. Things are better off for the most part. One prominent difference is the disappearance of fossil fuels. They are so rare that the government has stockpiled all that is left and has gone in favor of a new source of energy. The source is solar power. After a little refinement and condensation of the materials involved, solar power is now our most prominent form of energy. But how did it happen? How did solar power prove to be the wave of the future? We live in a day and age where resources are slowly becoming fewer and more far between. With the combination of gas being burned up in our vehicles at an alarming rate and the United States relations with the Middle East not being as superb as they used to be we are being faced with a growing concern. What can we do about our energy shortage? The short term answer is the reserves that are loaded into Alaska. That's all fine and good for the time being but what about even a hundred years in the future? Can we depend on Alaska's supplies to be there? The smart answer is 'no'. So new sources of energy will be required. Nuclear fusion and fission are not viable answers yet and hydro power may not have what it takes. The changes of a water powered car are not that good. Solar power seems to be the answer. Solar powered cars are already being developed and a few million of so dollar in research money tossed in its development could be all that is needed to make it a reality. The development of photovoltaic conversion is what will make solar energy a viable source of power.1 Photovoltaic conversion is utilized in solar cells that can be easily installed in developmental cars. They harness energy directly from the sun and power the vehicle. There a ...
Sunday, March 1, 2020
Finding Time to Write in High School
Finding Time to Write in High School Finding Time to Write in High School Finding Time to Write in High School By Maeve Maddox I am still in high school and therefore (due to AP classes) have little or no time to write. à I have tried to make time to write at least half a page every day (not a continuing story, just whatever comes to mind at the time) and I cannot even find time to do THAT! à I really want to continue my writing and I want to improve, but I just cant find the time. Do you have any suggestions as to what I can do to improve my vocabulary, grammar, writing and my flow of ideas that will not take up too much time? NOTE: This reader is referring to Advanced Placement classes. AP courses are college courses made available to high school students. They are generally considered to be more rigorous than general high school courses and usually require more reading and writing. This note from a young reader made me think of the story about the young man who was in love with a young woman. Her family moved to another town a thousand miles away. Distraught, the young man went to the local sage and told him his sad story. The sage looked at him thoughtfully and then spoke. ââ¬Å"How is it, young man, that you love this young woman and she is a thousand miles away?â⬠Writing is like love. You go the distance. You find the time. High School Students Have More Time Than Adults One of my greatest regrets as I head into my retirement years is that I wasted so much time because of the petrifying notion that I had to wait to get serious about writing until after Iââ¬â¢d met all my domestic responsibilities. Women caring for husbands and pre-schoolers, and men working two jobs to keep their children in clothes and school supplies are certainly at a disadvantage if professional writing is their goal. Nevertheless if the desire is strong enough, theyââ¬â¢ll steal hours from their sleep to find the time to put words to paper. Unlike an adult caught up in the necessities of providing for the needs of others, a high school AP student has opportunities built into the work day. Every situation differs, I know, but it seems to me that an AP student would find plenty of opportunity to ââ¬Å"improve vocabulary, grammar, writing and flow of ideasâ⬠in the process of doing the AP course work. Vocabulary A course in any discipline, even math, can provide vocabulary growth as the student learns the specialized terms of the subject. An AP English course is a gift for the budding writer. It provides the opportunity for close reading of serious literature. Not only will such reading add to the studentââ¬â¢s vocabulary, it will do it in a way that cramming on vocabulary lists will never do because the words are presented in context. AP History will not only provide new vocabulary, it will furnish the studentââ¬â¢s mind with ideas and information that one day can be distilled into fiction or personal essay writing. Nothing is lost to the writer. Thatââ¬â¢s where writers have it all over non-writers. Even a tedious wait in a doctorââ¬â¢s office provides material. Grammar Like vocabulary, grammar is better learned from reading than from doing isolated exercises. A common fault that I see in the writing of many young people is the uncertain grasp of prepositions. Many young native English speakers use prepositions as if English were their second language. If they read widely, theyââ¬â¢d absorb the idioms. Writing and Flow of Ideas An AP English syllabus I pulled up on the web requires eleven essays. How is this not a built-in opportunity for writing practice? Some of the works of literature being studied for this class are The Canterbury Tales, The Inferno and All Quiet on the Western Front. Like I said, a gift. Courses other than AP English offer plenty of opportunity for improving writing and flow of ideas. For example, not all textbooks are well-written. Some seem designed to put the reader to sleep. Students of writing can read textbooks on any subject not just for information, but for style. They can compare the interesting parts with the soporific ones. What makes the writing slow down? Is it sentence length? Is it unnecessarily erudite vocabulary? What about transitions? What words does the writer use to get from one idea to the next? How could the writing be improved? Make Your Courses Work for You The young writer who set me this question is to be admired for recognizing the fact that writing must be cultivated. My advice, try to stop seeing the AP coursework as an impediment to writing and make it work for you. The practice of writing half a page a day was a great idea. Resume it if at all possible. If all you can find is ten minutes, write a few lines. If nothing else, take the time to write the words ââ¬Å"I am a writerâ⬠before you drop off to sleep. Want to improve your English in five minutes a day? Get a subscription and start receiving our writing tips and exercises daily! Keep learning! Browse the Writing Basics category, check our popular posts, or choose a related post below:20 Great Similes from Literature to Inspire YouBroadcast vs Broadcasted as Past FormWords That Begin with Q
Friday, February 14, 2020
Topics in Literature English Essay Example | Topics and Well Written Essays - 1000 words
Topics in Literature English - Essay Example Characterization can be a simple or a complex process. Basically, characterization is what characters "say" and "do" (The National Library Literacy Strategy, 2001, p. 2). Each character is seen as being made up of a number of dimensions: sense of identity, age, gender, religious persuasion, temperament, physical appearance, values, expectations, dreams, disappointments, inadequacies and loss, to name a few. The Shreklisch Onion Layer Model of characterization stresses that the psychological profile of the fictional character must incorporate emotions, back-story, beliefs, practices and intentions (Wikipedia, 2006). It is by way of the language and actions of the character within the text that the reader is able to understand what are happening and why, without having to be told directly (i.e. indirect characterization). Although, with fiction that presents a completely new dimension of existence it may be necessary to spell out character specifics to the reader, due to the ambiguity inherent in novel texts (i.e., direct characterization). In most novels, plays, and essays, characterization develops along with the storyline and functions to support the fictional themes. Characters take time to create for an author, as they are getting to know another person, and aspects of who they are and how they interpret their world and respond to it in a way that is contingent on their values, requires the author to reflect on their own ways of thinking and behaving. A story may be completed driven by its characters; they are the key to unlocking the story. In such cases, the plot tends to come first, like a seed crystal of an idea that radiates out patterns of complexity and beauty in storylines as it creates the possibilities for characters to arise from the situations or settings (The National Library Literacy Strategy, 2001).The physical description of a character provides the reader with a general framework about the 'person': age, gender, ethnicity, physical appearance, style of dress, geo-historical location, and the way t he character moves. The reactions and responses of the character give the reader insight into the character's core values and attitudes (English Online, 1998). The dialogue of each character can provide the reader with deeper psychological insight of the character. The language that a character uses, their use of intonation, as well as use of pauses and silences, can instil in the reader the true feelings of what that character is experiencing. The surroundings enrich the background for the reader, making the characters more believable and understandable. This detail needs to incorporate all of the character's senses and perceptions of the setting. It is the author's ability to sew together the dialogue, reactions and descriptions that enables characterization to occur (The National Library Literacy Strategy, 2001). It is important that the author be aware that characters need to develop due to their fictional experiences, in order to come to life and 'be real". However, it is also essential that each character have a consistency of character as well, and it is this balance that leads the author through the characterization process.Ultimately, characterization requires the author develop characters by giving them; identity (e.g., have a name, appearance, values, temperament); creating
Saturday, February 1, 2020
Introduction to statistics Essay Example | Topics and Well Written Essays - 500 words
Introduction to statistics - Essay Example Line graphs also allow us to see overall trends such as an increase or decrease in data over time. Clearly, looking at the graph we donââ¬â¢t observe any disparity in the data given The intuition can further be confirmed from the t-test significance analysis conducted. From the table below, the percent of goods moved in the year 2000 was 16.53 while that moved in the year 2009 was 15.69, this shows no significant difference. Also from the same table (table 2), we observe that the p-value=0.206>0.05 (significance level), we thus fail to reject the null hypothesis and conclude that indeed there is no significant difference in the goods moved in the year 2000 and those moved in the year 2009. In this part we regressed the 2009 data on the 2000 data since the data was found to follow a normal distribution we opted to use a parametric test (Bivariate regression analysis), we used bivariate because we only had two variables to test (simple linear regression) and the model produced
Friday, January 24, 2020
Jimmy Carters Presidency :: Free Essays
à à à à à James Earl Carter Jr. had become the 39th president of the United States in 1976. The Democrat and once Georgia senator had promised to bring a fresh, new approach to the White House in hopes to break peopleââ¬â¢s doubts about the presidency that were left from the Nixon/Ford era. In the election of 1976 Carter squeaked by the republican, Gerald Ford by a 49.9% vote to a 46.9% vote. à à à à à Carter had differed greatly from all of the previous presidents in several ways. He brought a more informal, ââ¬Å"homeyâ⬠feeling to the White House. Instead of the tradition suit wearing he wore jeans around the White House and once gave a speech on national TV. At first this was liked by the American public, but his image later suffered because he dropped the ceremonial style of the presidency. à à à à à Carter had made many advances in his foreign policy. To resolve the conflict in the Middle East, he invited Anwar el-Sadat of Egypt and Menachem Begin of Israel to sign the Camp David Accords. Under the accords it was agreed that Israel would pull out of the Sinai Peninsula in exchange for Egyptââ¬â¢s recognizing them as a country. Carter also had made a deal with the Panamanian government on the situation of the Panama Canal. It was agreed upon that the canal would be given back to Panama in 2000. Relations with China and Russia were also improved upon during Carterââ¬â¢s presidency. There was one situation that had permanently damaged Carterââ¬â¢s reputation and ruined his chances of re-election. This was the Iran hostage situation. The former ruler of Iran was given medical treatment in the U.S. This had angered the people of Iran and they stormed the U.S. embassy, taking all of the people working there hostage. This lasted for 400 days and destroyed Carterââ¬â¢s reputation politically. à à à à à During his presidency, Carter had several problems domestically. There was an oil shortage, forcing gas prices to skyrocket. Jimmy Carter's Presidency :: Free Essays à à à à à James Earl Carter Jr. had become the 39th president of the United States in 1976. The Democrat and once Georgia senator had promised to bring a fresh, new approach to the White House in hopes to break peopleââ¬â¢s doubts about the presidency that were left from the Nixon/Ford era. In the election of 1976 Carter squeaked by the republican, Gerald Ford by a 49.9% vote to a 46.9% vote. à à à à à Carter had differed greatly from all of the previous presidents in several ways. He brought a more informal, ââ¬Å"homeyâ⬠feeling to the White House. Instead of the tradition suit wearing he wore jeans around the White House and once gave a speech on national TV. At first this was liked by the American public, but his image later suffered because he dropped the ceremonial style of the presidency. à à à à à Carter had made many advances in his foreign policy. To resolve the conflict in the Middle East, he invited Anwar el-Sadat of Egypt and Menachem Begin of Israel to sign the Camp David Accords. Under the accords it was agreed that Israel would pull out of the Sinai Peninsula in exchange for Egyptââ¬â¢s recognizing them as a country. Carter also had made a deal with the Panamanian government on the situation of the Panama Canal. It was agreed upon that the canal would be given back to Panama in 2000. Relations with China and Russia were also improved upon during Carterââ¬â¢s presidency. There was one situation that had permanently damaged Carterââ¬â¢s reputation and ruined his chances of re-election. This was the Iran hostage situation. The former ruler of Iran was given medical treatment in the U.S. This had angered the people of Iran and they stormed the U.S. embassy, taking all of the people working there hostage. This lasted for 400 days and destroyed Carterââ¬â¢s reputation politically. à à à à à During his presidency, Carter had several problems domestically. There was an oil shortage, forcing gas prices to skyrocket.
Thursday, January 16, 2020
Nflpa Player Safety
NFLPA Player Safety The National Football League has become the most exciting and thrilling sports league to watch in the last few decades. Most recently players have become much faster and bigger than in the past and the safety of their lives have become a risk. Recently the NFL has been subjected to a large amount of controversy and criticism dealing with how they have handled player safety. This issue has come to the forefront because concussions have become a weekly occurrence.In the last few years it has been studied then proven by doctors that former players have suffered traumatic brain injuries from hits to the head during their NFL careers. As a fan of the NFL, I believe itââ¬â¢s best for the game that the NFL makes some change so players are protected for their safety but then again you canââ¬â¢t take away what the nature of this sport is which is a hard hitting dangerous sport. The NFL who is led by league commissioner Roger Goodell needs to find a way to make the ga me safer by keeping the players safe, fans entertained, and team ownerââ¬â¢s content.As one of the biggest issues in todayââ¬â¢s NFL, I decided to pursue the question, are major changes needed to be taken towards player safety for the wellbeing of the NFL and the players? There is a high probability that a mutual agreement will never happen between the two but that doesnââ¬â¢t mean that new rules and policies wonââ¬â¢t continue to be implemented for testing. The NFL has recently tried to implement new rules and policies to delay and prevent the highly rising concussion rate.They have changed to shorter kickoffs to reduce high impact hits and have also introduced stricter guidelines for player conduct on the field which includes fines for illegal helmet-to-helmet hits deemed inappropriate by the NFL. Are these changes the answer though? There is more needed to be done then just changing a few rules that will ultimately have a small impact on this large scale problem. Many other strong options for change include equipment improvements, concussion research, and enforcing penalties to illegal hits. Roger Goodell said throughout history, football has evolved and become safer and better, and the future of the sport relies on the ability to continue to do so. When it comes to the priority of the league, Goodell made it clear safety comes firstâ⬠(SBNation). However the NFLPA does not believe the NFL is doing enough to protect its members. NFLPA Executive Director DeMaurice Smith has been demanding the placement of doctors on every sideline during games to help diagnose and treat concussions.This issue has to be taken seriously because within the past year nearly one hundred former players have filed pleas against the NFL and want them held responsible for the players suffering from traumatic head injuries. Concussions are serious and they happen weekly in the NFL to players of all positions due to the tremendous force these players are hit with. The short and long term effects of concussions can be devastating to the human mind. Not only does the brain suffer long term physical damage but many players often suffer from long term mental problems.A prime example of someone who had been affected by head trauma was former linebacker Junior Seau. Recently ââ¬Å"a team of scientists who analyzed the brain tissue of renowned NFL linebacker Junior Seau after his suicide last year have concluded the football player suffered a debilitating brain disease caused by two decades worth of hits to the headâ⬠(ABCNews). Junior Seau who had a 20 year NFL career was diagnosed with chronic traumatic encephalopathy (CTE) after his death. The real question is what couldââ¬â¢ve the NFL done to prevent such a terrible tragedy or did they not have the capability to control what happened to him?The NFL has said many times that it did not intentionally hide the dangers of concussions from players and is doing everything it can to protect them. W ith the focus on head injuries in football being put under a microscope the past few seasons, the NFL is taking drastic measures trying to find solutions that will help in the future. New helmet designs are a needed advancement to help create a safer NFL. With improvements to helmets that will help reduce head injuries gradually but it is still not the lone solution if players continue to tackle improperly and go for head shots.During 2012 there was an estimate of nearly 160 NFL players who suffered concussions during this season. Thatââ¬â¢s a huge problem because recent studies link concussions to causing mental problems and has also been shown to lead to Alzheimerââ¬â¢s disease. In reaction to this issue the NFL has become concerned about head injuries and has commanded the tests of 11 new helmet designs from five manufacturers in the last couple years. On the other hand, there is a belief that helmets can only do so much as oncussions are mostly caused because of the gladia tor mentality that the players play with because they want to make an EPSN top play. ââ¬Å"While helmets are being designed larger and more protective, concussions still occur regularly. Itââ¬â¢s unlikely that they will ever be eliminated completely. Indeed, helmet technology has come a long way since the leather caps worn by old-time footballers, but helmet makers believe their products can only do so much to keep players safe in a culture that glorifies the big hitâ⬠(SmartPlanet).New technology in helmets and equipment is much needed for the protection of the players and should continue to be a building block for player safety. Rule changing has become a yearly tradition for the NFL as they try and create new ways to make the game safer even if the players and NFLPA donââ¬â¢t agree upon it. Most recently, Roger Goodell implemented shorter kickoffs which moved the kickoff spot up five yards from the 30 to the 35 yard line to decrease injuries, but would now largely inc rease the number of touchbacks.This rule change could have a negative effect by eliminating the job prospects of special teamââ¬â¢s players. ââ¬Å"Cleveland Browns kick returner Josh Cribbs, the league's career leader with eight kickoff returns for touchdowns, has been irate since owners, citing the need to protect players from violent collisions, announced the change during the lockout in March. â⬠ââ¬Å"I don't see (injury) stats behind it, and that's what the issue was,â⬠Cribbs said last week. ââ¬Å"There's no stats to back it up. Their intentions are good, but the stats aren't there to back up the reasoningâ⬠(ESPN).During the last month a rule change that the NFL has implemented was met with high opposition as former and current players disagree with the intention of changing the game. The new rule states that ball carriers would be penalized if they lower their head to deliver a blow. ââ¬Å"The proposed rule change for running backs might be the most abs urd suggestion of a rule change I've ever heard of. In order to lower ur shoulder u obviously have to lower ur head. It's a way of protecting ur self from a tackler and a way to break tacklesâ⬠(Matt Forte twitter).The real question is has the NFL become too overprotective? Yes delivering a blow with the crown of your helmet can be the starting point of a concussion but is it worth taking away important parts of the game. The NFL is the greatest sports league in North America, but there are major decisions to be made in the next decade that could decide the future of the NFL. Ultimately, how sustainable is the NFL? With the hits becoming more and more violent and with players getting bigger, faster and stronger every year, how can the NFL survive long-term with such violence?It might take something horribly tragic before the NFL will act upon the state of the game and make genuine changes to aid player safety. But then again NFL players understand the risks of the profession th ey chose, nobody forces them to play football. At some point, the NFL is going to have to force players to accept the risks associated with playing football. Nothing can make football a completely safe game no matter what rules or innovations are created. There will always be physical athletes forcing violent collisions.The NFL canââ¬â¢t take away the heart and soul of the game just to make it safer. In my opinion the NFL has to embrace the physicality of the game and assume the risks that run along with promoting a violent sport but they should still continue researching the causes of concussions for a future solution. The years ahead will show if the NFLPA and NFL can ever meet a mutual agreement to satisfy the needs of their players and their safety in the long and short term future.
Wednesday, January 8, 2020
Swot Analysis Strategic Management - 1585 Words
Strategic Management is a set of upper level management decisions and actions that will determines the long term objectives and performance of a corporation. It accomplishes this task by including a variety of tools and analysis techniques, which will implement, evaluate and control the general direction of a company. This is done through strategy formulation which begins with a situational analysis that emphasizes the monitoring and evaluating of external opportunities and threats in light of a corporationà ´s strengths and weaknesses (Wheelen and Hunger, 2006; Saloner et al., 2001). The objective of this paper is to describe, analyze and discuss advantages and disadvantages of a concept named SWOT, which stands for Strengths, Weaknesses, Opportunities and Threats. These are the concepts that are frequently used as tools for the analyzing of all external environments of an organization including their internal factors that constitutes its structure (Wheelen and Hunger, 2006). SWO T analysis came first came about from research that was conducted at the Stanford Research Institute in the late 1960à ´s. The idealization of SWOT analysis came from the necessity to discover why some corporate planning continued to failed. Many fortune 500 companies wanted to find out what could they do with the research discovered in Stanford. Albert Humphrey Along with a select few from his research team began testing SWOT as a tool and when it became practical SWOT became a corporate planningShow MoreRelatedSwots: Strategic Management and Swot Analysis10122 Words à |à 41 Pages SWOT usage SWOT has been used by countless practitioners, marketing researchers, and is a frequent and popular tool for business marketing and strategy students. Its simplicity and catchy acronym perpetuates its usage in business and beyond as the tool is used to assess alternatives and complex decision situations. In the business arena the grouping of internal and external issues is a frequent starting point for strategic planning. It can be constructed quickly and can benefit from multiple viewpointsRead MoreSwots: Strategic Management and Swot Analysis10111 Words à |à 41 Pages SWOT usage SWOT has been used by countless practitioners, marketing researchers, and is a frequent and popular tool for business marketing and strategy students. Its simplicity and catchy acronym perpetuates its usage in business and beyond as the tool is used to assess alternatives and complex decision situations. In the business arena the grouping of internal and external issues is a frequent starting point for strategic planning. It can be constructed quickly and can benefit from multiple viewpointsRead MoreStrategic Management and Swot Analysis1633 Words à |à 7 Pagesï » ¿ Amongst all the novelties, trends, and fashions appearing in the field of strategic management during the last decades, the SWOT analysis, standing for: strengths, weaknesses opportunities, and threats has enjoyed a long lasting popularity among both practitioners and researchers.à The purpose of this essay is to demonstrate that SWOT analysis can be used for both businesses and individuals. In the 60s swot analysis was invented at the Harvard business School for the purpose of analysing caseRead MoreSwot Analysis : Strategic Management1152 Words à |à 5 PagesStrategic management is an approach to help leaders forecast the direction of their organization. This approach helps organizational leaders gauge the quality of its services, products, and/or internal systems by performing internal and external audits. These audits help leaders identify the internal strengths and weakness, and the external threats and opportunities (SWOT) within a given market. This analytic framework helps leaders forecast contingencies and help leaders develop strategies toRead MoreSwot Analysis : Strategic Management1390 Words à |à 6 PagesContext Analysis Strategic management is an important part of business planning. It helps create strategies for better performance, profit, and future success. Analysis of both internal and external factors is vital for a companyââ¬â¢s proper growth. Culture, the perspectives of the companyââ¬â¢s employees, managers, owners and clientele, and the structural and environmental elements that effect the operation of the business are all examined in the strategic management process. The purpose of this paperRead MoreSwot Analysis : Strategic Management Essay1152 Words à |à 5 PagesThe term strategic management refers to the recognition and portrayal of the strategies that are pursued by the managers for the achievement of better performance goals and having a competitive advantage. To determine if an organisation has a competitive advantage, its profitability should be focused and analysed if it the measure if above average of all the businesses in the industry. The decisions taken by the managem ent committee of the organization and the acts to decide the outcomes of the businessââ¬â¢sRead MoreSwot Analysis : Strategic Management1547 Words à |à 7 PagesPESTEL analysis is a tool or framework for marketers. It is very effective when seeking to analyze and screen the external marketing environment of the company. Strategic management tool gauges the macro environmental factors. It is prudent to follow PESTEL framework since different macro-environmental factors can affect a business strategy. PESTEL framework are interdependent of each other, they are dependent factors. Understanding PESTEL is critical prior to entry into a new country. The factRead MoreCango: Strategic Management and Swot Analysis1501 Words à |à 7 Pagesmeetings. We prepared a SWOT analysis to show what the company needs to improve on and what the company can expect in the future. According to Jaja Suteja (2003) ââ¬Å"The SWOT analysis provides information that is helpful in matching the firm s resources and a capability to the competitive environment in which it operates. As such, it is instrumental in strategy formulation and selection. A scan of the internal and external environment is an important part of the strategic planning process. EnvironmentalRead MoreSwot Analysis : Organizational Strategic Management1744 Words à |à 7 Pages SWOT Analysis: Organizational Strategic Management Calvin McLemore St. Thomas University, Miami, FL May 27, 2017 Introduction For this is a SWOT Analysis, this author chose to explore the international retailer IKEA. This organization was chosen because of the emphasis on globalization, international interests and overall functionality of the products. Crandall, Parnell, and Spillan (2013) states that a SWOT Analysis is ââ¬Å"based on a systematic, comprehensive analysis of internalRead MoreSwot Analysis : Strategic Planning And Management Essay1304 Words à |à 6 PagesCHAPTER IX STRENGTHS, WEAKNESSES, OPPORTUNITIES, AND THREATS ANALYSIS Strengths, Weaknesses, Opportunities, and Threats of a particular business venture are the four elements that is being evaluated in the SWOT Analysis. It is a planning method that is usually carried out by a company or organization specifying the objective of the business and identifying internal strengths and weaknesses plus external opportunities and threats that are both favorable and unfavorable to attain that certain objective
Tuesday, December 31, 2019
Self Assessment Of Leadership Practices - 1019 Words
Self-Assessment of Leadership Practices The road to becoming an exceptional leader while rewarding, is one filled with numerous challenges. Developing the necessary skills required in order to successfully lead others is a life-long process. In this paper, I will discuss in details my leadership qualities. I will include results from my Seven Habits Profile, evaluate my strength and weaknesses and adopt leadership theories that will help guide my self-evaluation. In addition, I will analyze proven theories that will help me address skills, weaknesses, and behaviors in my leadership skills. These theories-based changes will help form and guide my set of SMART goals. I will draft a plan for success in my journey towards becoming a great leader. Reflection on Seven Habits Profile and Findings The Seven Habits Profile is a tool created by Dr. Stephen Covey, bestselling author of ââ¬Å"The 7 Habits of Highly Effective Peopleâ⬠. In his book, Dr. Covey describes important characteristics of people who are not only great citizens of this world, but ââ¬Å"highly effectiveâ⬠leaders and role models. It is imperative to understand that these characteristics or traits can be developed or acquired by everyone who wishes to obtain them. Covey (2004) Leaders should strive to attain each of the following character traits; by using this tool, I gained useful information that will evaluate my leadership skills. The areas measured by the Seven Habits Profile are the following: 1. Be proactiveShow MoreRelatedSelf-Evaluation and Assessment in Contemporary Leadership1397 Words à |à 6 PagesSelf Evaluation and Assessment in Contemporary Leadership What makes a good leader? Is it the ability to execute tasks, or manage teams? There are seriously a myriad of answers to such questions. Yet, one notable answer is the ability to learn from ones mistakes and use effective self-evaluation and assessment in order to increase overall performance. Self assessment is a fundamental character found within effective leadership because it invokes continual learning, ensures positive rises inRead MoreReflective Reflection895 Words à |à 4 PagesI do not recall learning about reflective practice in my undergraduate studies. Reflective practice according to Barbour (2013), ââ¬Å"is the cyclic process of internally examining and exploring an issue of concern, triggered by an experience, which creates and clarifies meaning in terms of self, existing knowledge, and experience; resulting in a changed conceptual perceptive and practiceâ⬠(p. 7). According to Barbour (2013), reflective process has many positive outcomes to help guide the n urse to becomeRead MoreReflection On Leadership Competency1453 Words à |à 6 Pages Ã¢â¬Æ' Introduction This reflection on my leadership development was key to understand the fundamentals of leadership development. Having already acknowledged that leadership development is a self-development on-going process, I now realize that it requires deliberate practice based on a serious self-assessment to become a better learner before to become a better leader (Smith, 2017). As learning how to learn can be challenging, the NCHL Leadership Competency Model seems to be the perfect method to teachRead MoreLeadership Theory And Practice Of Leadership874 Words à |à 4 Pages Throughout the entire course of this class, I have been asked to fill out different self-assessments related to whatever topic or approach to leadership Peter Northouse (2013) was discussing in his book Leadership Theory and Practice. Each one of these self-assessments were intended to help me in discovering who I was as a person and a leader. Some of the leadership self-assessments included the Least Preferred Coworker Measu re from the Contingency Theory chapter, the Leader-Member Exchange QuestionnaireRead MoreA Discussion Of Conscious Leadership1180 Words à |à 5 PagesIn this discussion of conscious leadership, I present leadership theories. I emphasize the role that emotional intelligence plays in conscious leadership. A summary of a series of assessments and an analysis of the results highlights the values, attitudes, behaviors and approaches I have within groups and the organization. More importantly, the assessments and discussion on conscious leadership serves as direction to be an effective leader. Conscious leaders are aware of the world around them. TheRead MoreDeveloping Studentsself Awareness1733 Words à |à 7 PagesDeveloping Students Self-Awareness to Improve Leadership Qualities Students of leadership courses typically emerge with an understanding of how various leaders faced difficult situations, implemented tools and strategies, and experienced the results. Scholars and practitioners have suggested that this outside-in method to understanding what it means to be a leader is not serving our graduates, organizations, and society well. Several recommend an inside-out approach whereby the student is encouragedRead MoreEssay On Periodic Evaluation And Evaluation1013 Words à |à 5 PagesPittsburgh has been using periodic evaluation and assessment of their academic programs for many years. It is done in a consistent way and according to the standards expected from some accreditation bodies like Middle States Commission. The university aims at ensuring the high-quality provision of academic programs and services. According to a Self-Study Submitted in April 2012 to the Middle States Commission on Higher Education, The evaluation practice include many elements li ke the quality of the programRead MoreLeadership Development : A Strategic Approach820 Words à |à 4 PagesFuture Leadership Development Consequently, leadership development requires that organizations take a strategic approach such as coaching, training programs, mentoring, and/or virtual learning. A critical analysis and evaluation of what I learned regarding leadership development is that organizations must evaluate organizational needs and individual skills and competencies; assess an individual readiness to learn; create performance measures and evaluation criteria to measure training and learningRead MoreThe Leadership Journey Of Ronda Harlan1535 Words à |à 7 PagesIntroduction to a Leadership Journey This paper outlines the leadership journey of Ronda Harlan; an Organizational Leadership student, at Colorado State University (CSU) and how the CSU Masters of Science in Organizational Leadership (MSOL) program helped Ronda to evaluate human behavior within organizations to understand ethical practices, effective leadership, organizational communication, and cogent decision-making principles. Ronda Harlan reflects how the masterââ¬â¢s program at CSU aligned withRead MoreLeadership For An Advanced Practice Nurse997 Words à |à 4 PagesIndividual Leadership Assessment Paper Meta Cristiano NUR 604-QM2: Leadership in Advanced Nursing Practice Roles School of Nursing University of Alabama at Birmingham Fall, 2016 Individual Leadership Assessment Leadership is a very important role for an advanced practice nurse. There are many leadership styles a person can utilize when working in a collaborative team environment. It is the responsibility of an advance practice nurse to take on a leadership role and finding
Sunday, December 22, 2019
Hesters Psychological Alienation in The Scarlet Letter...
Hesters Psychological Alienation in The Scarlet Letter Throughout his book The Scarlet Letter Nathaniel Hawthorne is preoccupied with the relationship between the individual and society. Hesters sin and subsequent condemnation alienate her. No where is this alienation more apparent than in Chapter 5, Hester at her Needle. Condemned by her sin of passion, Hester is separated from her community, not only physically, as she lives on the edge of the town, but also socially. In this chapter, Hawthorne presents the most profoundly destructive aspect of her estrangement in her psychological condition. Hester, deemed a social pariah, is left alone in the world, with only her thoughts to keep herâ⬠¦show more contentâ⬠¦Hesters own dress was of the coarsest materials and most sombre hue. Through her sewing, the wretched outcast makes enough money to live in a good deal of luxury but she feels she does not deserve it. She sought not to acquire anything beyond subsistence, of the plainest and most ascetic description. All her superfluous means were bestowed... in charity, given to wretches unappreciative of her talents, who not unfrequently insulted the hand that fed them. Hesters isolation from others causes her to concoct her own demons that are a constant haunting reminder of her sin and her punishment. She feels she is bound by iron chains that surround her heart and soul. Through the terrible ordeal of her ignominy, while she was in prison, the iron arm of the law held her up. Unable to free herself of the guilt, in her heart Hester perceives herself to be trapped by a chain...of iron links, which galling to her inmost soul...could never be broken. Hester begins to believe that all nature knew of [her sin] and her surroundings take on manifestations of evil. The sunshine, usually accepted as a pleasing omen ...seemed...as if meant for no other purpose than to reveal the scarlet letter on herShow MoreRelatedComparing The Scarlet Letter and A Streetcar Named Desire1833 Words à |à 8 PagesCompare the ways in which isolation or alienation from society are presented in any two of the texts you have studied. We witness cases of alienation in the texts The Scarlet Letter and A Streetcar Named Desire, which are presented mainly in the female protagonists Hester Prynne and Blanche DuBois. However, although both characters experience isolation from their respective societies, it is my contention that the causes for their isolation are different. While Hesterââ¬â¢s isolation is largely societal, BlancheRead More Characterization through Imagery and Metaphor in The Scarlet Letter1274 Words à |à 6 PagesCharacterization through Imagery and Metaphor in The Scarlet Letter à à à à à à Throughout his novel, The Scarlet Letter, Hawthorne reveals character through the use of imagery and metaphor. à In the first Chapter of The Scarlet Letter, The Prison-Door, the reader is immediately introduced to the people of Puritan Boston. Hawthorne begins to develop the character of the common people in order to build the mood of the story. The first sentence begins, A throng of bearded men, in sad-coloredRead MoreForms of Violence in the Scarlet Letter, by Nathaniel Hawthorne3958 Words à |à 16 Pagesviolence is not only physical, it may also imply a moral dimension. In other words, it plays both on the field of the outer and inner worlds. In all cases, violence stages a relation between domination and subjection which are entangled in it. In The Scarlet Letter, violence seems to be the leading string of the plot: Hester Prynne has to undergo the ordeal of penance in a Puritan society that harshly condemns adultery. One can see here the atmosphere of violence she is plunged into. More generally, or ratherRead MoreSymbolism in the Scarlet Letter3886 Words à |à 16 PagesSymbolism of Th e Scarlet Letter A symbol is a literary device which is employed to portray another object or individual. In the Scarlet Letter by Nathaniel Hawthorne, it is most often a tangible object he uses to represent an undefined idea, complex in scope and significance. More times than not, it represents reverent, profound, or virtuous concepts of merit. From the substitution of one idea or object for another, to creations as massive, complex, and perplexing as the veil in the Ministers BlackRead MoreRelationship Between Society And The Individual2194 Words à |à 9 Pagesdevelopment of capitalism, there has always been a relationship between the individual and society that is reflected in the written pieces of each time, revealing the connection between oneself and the collective spanning across the centuries. ââ¬ËThe Scarlet Letterââ¬â¢, written in a Puritan world, and ââ¬ËBartleby, The Scrivenerââ¬â¢, written in capitalist America, are two key examples of literature that expo se, detail and discuss the relationship between society and the individual in American history. Alexis deRead MoreEssay Sin, Guilt, and the Mind of Nathaniel Hawthorne1490 Words à |à 6 Pagesdescendants remarks on him in The Custom House introduction to The Scarlet Letter mix pride in Hawthornes prominence and a sense of inherited guilt for his deeds as judge. Hawthornes guilt of wrongs committed by his ancestors was paramount in the development of his literary career. He investigates human weaknesses through the time period of his ancestors. Generally Hawthornes writings contained powerful symbolic and psychological effects of pride, guilt, sin and punishment. à à à à The theme ofRead More Sinfulness of the Puritans in Hawthornes The Scarlet Letter2040 Words à |à 9 PagesSinfulness of the Puritans in Hawthornes The Scarlet Letter Nathaniel Hawthorne brings to The Scarlet Letter a notion of sin and guilt that seems to stem from his experience and knowledge of Puritan theology and religious practice. In The Custom House Hawthorne communicates his apprehension for the persecutory impulses of his ancestors who have mingled their earthly substance with the soil, until no small portion of it must necessarily be akin to the moral frame wherewith, for a littleRead MoreAmerican Literature11652 Words à |à 47 Pagesnature Historical Context: ï⠷ writers reflect the ideas of Darwin (survival of the fittest) and Karl Marx (how money and class structure control a nation) Modernism period of American Literature - 1900-1946 Content: ï⠷ ï⠷ ï⠷ dominant mood: alienation and disconnection people unable to communicate effectively fear of eroding traditions and grief over loss of the past Genre/Style: ï⠷ ï⠷ ï⠷ ï⠷ highly experimental allusions in writing often refer to classical Greek and Roman writings use of fragments
Saturday, December 14, 2019
Sql Study Matetial Free Essays
Oracle/SQL Tutorial1 Michael Gertz Database and Information Systems Group Department of Computer Science University of California, Davis gertz@cs. ucdavis. edu http://www. We will write a custom essay sample on Sql Study Matetial or any similar topic only for you Order Now db. cs. ucdavis. edu This Oracle/SQL tutorial provides a detailed introduction to the SQL query language and the Oracle Relational Database Management System. Further information about Oracle and SQL can be found on the web site www. db. cs. ucdavis. edu/dbs. Comments, corrections, or additions to these notes are welcome. Many thanks to Christina Chung for comments on the previous version. Recommended Literature George Koch and Kevin Loney: Oracle8 The Complete Reference (The Single Most Comprehensive Sourcebook for Oracle Server, Includes CD with electronic version of the book), 1299 pages, McGraw-Hill/Osborne, 1997. Michael Abbey and Michael Corey: Oracle8 : A Beginnerââ¬â¢s Guide [A Thorough Introduction for First-time Users], 767 pages, McGraw-Hill/Osborne, 1997. Steven Feuerstein, Bill Pribyl, Debby Russell: Oracle PL/SQL Programming (2nd Edition), Oââ¬â¢Reilly Associates, 1028 pages, 1997. C. J. Date and Hugh Darwen: A Guide to the SQL Standard (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 Data Management Systems, 2000. 1 revised Version 1. 01, January 2000, Michael Gertz, Copyright 2000. Contents 1. SQL ââ¬â Structured Query Language 1. 1. Tables 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*Plus (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 Column- and Table Constraints 5. 2. Triggers 5. 2. 1 Overview 5. 2. 2 Structure of Triggers 5. 2. 3 Example Triggers 5. 2. 4 Programming Triggers 6. System Architecture 6. 1. Storage Management and Processes 6. 2. Logical Database Structures 6. 3. Physical Database Structures 6. 4. Steps in Processing 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 relational database systems (DBS) data are represented using tables (relations ). A query issued against the DBS also results in a table. A table has the following structure: Column 1 Column 2 . . . Column n â⬠¦ â⬠¦ â⬠¦ â⬠¦ A table is uniquely identi? ed by its name and consists of rows that contain the stored information, each row containing exactly one tuple (or record ). A table can have one or more columns. A column is made up of a column name and a data type, and it describes an attribute of the tuples. The structure of a table, also called relation schema, thus is de? ned by its attributes. The type of information to be stored in a table is de? ned by the data types of the attributes at table creation time. SQL uses the terms table, row, and column for relation, tuple, and attribute, respectively. In this tutorial we will use the terms interchangeably. A table can have up to 254 columns which may have di? erent or same data types and sets of values (domains), respectively. Possible domains are alphanumeric data (strings), numbers and date formats. Oracle o? ers the following basic data types: â⬠¢ char(n): Fixed-length character data (string), n characters long. The maximum size for n is 255 bytes (2000 in Oracle8). Note that a string of type char is always padded on right with blanks to full length of n. ( can be memory consuming). Example: char(40) â⬠¢ varchar2(n): Variable-length character string. The maximum size for n is 2000 (4000 in Oracle8). Only the bytes used for a string require storage. Example: varchar2(80) â⬠¢ number(o, d): Numeric data type for integers and reals. = overall number of digits, d = number of digits to the right of the decimal point. Maximum values: o =38, d= ? 84 to +127. Examples: number(8), number(5,2) Note that, e. g. , number(5,2) cannot contain anything larger than 999. 99 without resulting in an error. Data types derived from number are int[eger], dec[imal], smallint and real. â⬠¢ date: Date data type for storing date and time. The default format for a date 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 allowed per table. Note: In Oracle-SQL there is no data type boolean. It can, however, be simulated by using either char(1) or number(1). As long as no constraint restricts the possible values of an attribute, it may have the special value null (for unknown). This value is di? erent from the number 0, and it is also di? erent from the empty string ââ¬â¢Ã¢â¬â¢. Further properties of tables are: â⬠¢ the order in which tuples appear in a table is not relevant (unless a query requires an explicit sorting). â⬠¢ a table has no duplicate tuples (depending on the query, however, duplicate tuples can appear in the query result). A database schema is a set of relation schemas. The extension 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 examples we use an example database to manage information about employees, departments and salary scales. The corresponding tables can be created under the UNIX shell using the command demobld. The tables can be dropped by issuing the command demodrop under the UNIX shell. The table EMP is used to store information about employees: EMPNO ENAME JOB MGR HIREDATE SAL DEPTNO 7369 SMITH CLERK 7902 17-DEC-80 800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 30 â⬠¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦Ã¢â¬ ¦.. 7698 BLAKE MANAGER 01-MAY-81 3850 30 7902 FORD ANALYST 7566 03-DEC-81 3000 10 For the attributes, the following data types are de? ned: EMPNO:number(4), ENAME:varchar2(30), JOB:char(10), MGR:number(4), HIREDATE:date, SAL:number(7,2), DEPTNO:number(2) Each row (tuple) from the table is interpreted as follows: an employee has a number, a name, a job title and a salary. Furthermore, for each employee the number of his/her manager, the date he/she was hired, and the number of the department where he/she is working are stored. 2 The table DEPT stores information about departments (number, name, and location): DEPTNO 10 20 30 40 DNAME STORE RESEARCH SALES MARKETING LOC CHICAGO DALLAS NEW YORK BOSTON Finally, the table SALGRADE contains all information about the salary scales, more 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 order to retrieve the information stored in the database, the SQL query language is used. In the following we restrict our attention to simple 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 [ ] are optional): select [distinct] from [ where ] [ order by ] 1. 2. 1 Selecting Columns The columns to be selected from a table are speci? ed after the keyword select. This operation is also called projection. For example, the query select LOC, DEPTNO from DEPT; lists only the number an d the location for each tuple from the relation DEPT. If all columns should be selected, the asterisk symbol ââ¬Å"? â⬠can be used to denote all attributes. The query select ? from EMP; retrieves all tuples with all columns from the table EMP. Instead of an attribute name, the select clause may also contain arithmetic expressions involving arithmetic operators etc. select ENAME, DEPTNO, SAL ? 1. 55 from EMP; 3 For the di? erent data types supported in Oracle, several operators and functions are provided: â⬠¢ for numbers: abs, cos, sin, exp, log, power, mod, sqrt, +, ? , ? , /, . . . â⬠¢ for strings: chr, concat(string1, string2), lower, upper, replace(string, search string, replacement string), translate, substr(string, m, n), length, to date, . . . â⬠¢ for the date data type: add month, month between, next day, to char, . . The usage of these operations is described in detail in the SQL*Plus help system (see also Section 2). Consider the query select DEPTNO from EMP; which retrieves the department number for each tuple. Typically, some numbers will appear more than only once in the query result, that is, duplicate result tuples are not automatically eliminated. Inserting the keyword distinct after the keyword select, however, forces the elimination of duplicates from the query result. It is also possible to specify a sorting order in which the result tuples of a query are displayed. For this the order by clause is used and which has one or more attributes listed in the select clause as parameter. desc speci? es a descending order and asc speci? es an ascending order (this is also the default 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 two tuples have the same attribute value for DEPTNO, the sorting criteria is a descending order by the attribute values of HIREDATE. For the above query, we would get the following output: ENAME DEPTNO HIREDATE FORD 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 only focused on selecting (some) attributes of all tuples from a table. If one is interested in tuples that satisfy certain conditions, the where clause is used. In a where clause simple conditions based on comparison operators can be combined using the logical connectives and, or, and not to form complex conditions. Conditions may also include pattern matching operations and even subqueries (Section 1. 5). 4 Example: List the job title and the salary of those employees whose manager has the number 7698 or 7566 and who earn more than 1500: select JOB, 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); â⬠¢ Null value: is [not] null, i. e. , for a tuple to be selected there must (not) exist a de? ned value for this column. Example: select ? from EMP where MGR is not null; Note: the operations = null and ! null are not de? 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 surroun d the string by apostrophes, e. g. , where LOCATION = ââ¬â¢DALLASââ¬â¢. A powerful operator for pattern matching is the like operator. Together 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 test for inequality, the not clause is used. Further string operations are: â⬠¢ upper() takes a string and converts any letters in it to uppercase, 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 o f the string is assumed. substr(ââ¬â¢DATABASE SYSTEMSââ¬â¢, 10, 7) returns the string ââ¬â¢SYSTEMSââ¬â¢. 5 1. 2. 4 Aggregate Functions Aggregate functions are statistical functions such as count, min, max etc. They are used to compute a single value from a set of attribute values 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 EMP? select count(distinct JOB) from EMP; Maximum value for a column Minimum value for a column Example: List 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 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 command for creating an empty table has the following form: create 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. There is no di? rence between names in lower case letters and names 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 can have the same attribute value for this colu mn. 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 create table statement for our EMP table has the form create 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 table may include the speci? cation of integrity 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 can also be formulated 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 ] primary key | unique | not null A constraint can 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 insertion of a tuple that violates the constraint. If no name is speci? ed for the constraint, Oracle automatically 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 type 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 projectââ¬â¢s 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), BUDGET number(8,2) not null, PSTART date, PEND date); A unique constraint can include more than one attribute. In this case the pattern unique(, . . . , ) is used. If it is required, for ex ample, 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 command after both columns PEND and PSTART have been de? ed. A primary key constraint that includes more than only one column can be speci? ed in an analogous 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 inserted. 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 Tables The following provides a small checklist for the issues that need to be considered before 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 instead of char ? â⬠¢ Which columns build the primary key? â⬠¢ Which columns do (not) allow null values? Which columns do (not) allow duplicates ? â⬠¢ Are 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 command, tuples can be inserted into the table, or tuples can be deleted or modi? ed. 1. 4. 1 Insertions 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 insertion 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 instead. 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 other tables, these data can 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 can 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 Updates For modifying attribute values of (some) tuples in a table, we use the update 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 assign 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 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, other tables can be used to retrieve data that are used as new values. In such 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 = 20; Explanation: The query retrieves the minimum salary of all managers. This value 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 still 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 deleted from a table using the delete command: delete from [where ]; If the where clause is omitted, all tuples are deleted from the table. An alternative 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 actual 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 current Oracle session. 1. 4. 4 Commit and Rollback A sequence of database modi? cations, i. e. , a sequence of insert, update, and delete statements, is called a transaction. Modi? cations of tuples are temporarily stored in the database system. They become permanent 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 last commit. To undo modi? cations, one has to issue the statement rollback;. It is advisable to complete 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 internal 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 feature of relational databases, however, is to combine (join) tuples stored in di? erent tables in order to display more meaningful and complete information. In SQL the select state ment is used for this kind of queries joining relations: 11 select [distinct] [. ], . . . , [. ] from [], . . . , [] [where ] The speci? cation of table aliases in the from clause is necessary to refer to columns that have the same name in di? rent tables. For example, the column DEPTNO occurs in both 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 front 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 occurs in the following manner (without optimization): 1. Each row from the table EMP is combined with each row from the table DEPT (this operation is called Cartesian product ). 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. Any 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: List the names 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 () [any|all] () An can either be a column or a computed value. 2. Test for (non)existence [not] exists () In a where clause conditions using subqueries can be combined arbitrarily 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 December 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 known 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 ag ain 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 correlated 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 [any|all] 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 f rom EMP where DEPTNO = 30) and DEPTNO = 10; 14 Note: Also 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 checked 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 tuple in the table EMP, the tuple is not selected. 1. 5. 3 Operations on Result Sets Sometimes it is useful to combine query results from two or more queries into a single result. SQL supports three set operators which have the pattern: The set operators are: union [all] returns a table consisting of all rows either appearing 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 c olumns 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 requires 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 applications require grouping rows that have certain properties and then applying an aggregate function on one column for each group 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 group ed. 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 three rows. This type of condition is speci? ed using the having clause. As for the select clause 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 processed 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. Discard all groups that do not satisfy the condition in the having clause. 4. Apply 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 users Provided that a user has the privilege to access 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 accessed 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 oneââ¬â¢s own tables. Adding Comments to De? nitions For 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 dictionary. They can be accessed using the data dictionary views USER TAB COMMENTS and USER COL COMMENTS (see also 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 need 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 temporary table and to copy respective columns and rows into this new table. Furthermore, it is not possible to rename tables or columns. In the most recent 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 Table A 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 view (virtual table) has the form create [or replace] view [()] 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: create view DEPT20 as elect ENAME, JOB, SAL? 12 ANNUAL SALARY from EMP where DEPTNO = 20; In the select statement the column alias ANNUAL 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 constructs 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 I ntroduction 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 screen. Some of the features of SQL*Plus are: â⬠¢ A built-in command line editor 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 saved 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 shell variables are properly set (shell variables can be checked using the env command, e. g. , env | grep ORACLE): â⬠¢ ORACLE HOME, e. g. , ORACLE HOME=/us r/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: Release 3. 3. 4. 0. 1 ââ¬â Production on Sun Dec 20 19:16:52 1998 Copyright (c) Oracle Corporation 1979, 1996. All rights reserved. Enter user-name: scott Enter password: Connected 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 20 SQL 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 interrupted by using C. To exit SQL*Plus you can either type exit or quit. Editor Commands The most recently issued SQL statement is stored in the SQL bu? er, independent of whether the statement has a correct syntax or not. You can edit the bu? er using the following commands: â⬠¢ l[ist] lists all lines in the SQL bu? er and sets the current line (marked with an â⬠? â⬠) to the last line in the bu? er. â⬠¢ l sets the actual line to â⬠¢ c[hange]// replaces the ? rst occurrence of by (for the actual line) â⬠¢ a[ppend] appends to the current line â⬠¢ del deletes the current line â⬠¢ r[un] 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 loads 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 su ch 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 desc[ribe] lists all columns of the given table together 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 rem[ark] (only allowed between SQL statements), 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, h owever, 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 relabels 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 total 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 vari ables. The command show all displays all variables and their current values. To set a variable, type set . For example, set timing 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 data 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 accessible 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 creation 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 known 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 granted on database objects, â⬠¢ storage structures of the database. The SQL command select ? from DICT[IONARY]; lists all tables and views of the data dictionary that are accessible to the user. The selected information includes the name and a short description of each table and view. Before issuing this query, check the column de? nitions of DICT[IONARY] using desc DICT[IONARY] and set the appropriate 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 oneââ¬â¢s 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 approximately 540) that represent (a portion of the) data from the base tables in a readable 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 gro ups: USER, 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 tables 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 o bjects 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 encompass 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/SQL Introduction The development of database applications typically requires language constructs similar to those that can be found in programming 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 accomplished by using only the provided language elements. PL/SQL (Procedural Language/SQL) is a procedural extension of Oracle-SQL that o? ers language constructs similar to those in imperative programming 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 modules. The basic construct in PL/SQL is a block. Blocks allow designers to combine logically related (SQL-) statements into units. In a block, constants and variables can be declared, and variables can be used to store query results. Statements in a PL/SQL block include SQL statements, control structures (loops), condition statements (if-then-else), exception handling, and calls of other PL/SQL blocks. PL/SQL blocks that specify procedures and functions can be grouped into packages. 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 process query results in a tuple-oriented way, that is, one tuple at a time. For this, cursors are used. A cursor basically is a pointer to a query result and is used to read attribute values of selected tuples into variables. A cursor typically is used in combination with a loop construct such that each tuple read by the cursor can be processed individually. In summary, the major goals of PL/SQL are to â⬠¢ increase the expressiveness 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 [ ] enclose optional parts): [] [declare ] begin [exception ] end; The block header speci? s whether the PL/SQL block is a procedure, a function, or a packa ge. 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 declared 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 with 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 declaration). For example, EMP. Empno%TYPE refers to the data type of the column Empno in the relation EMP. Instead of a single variable, a record 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 sel ect 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 declared cursor can be used in PL/SQL statements, the cursor must be opened, and after processing the selected tuples the cursor must be closed. 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 (loops, 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 packages. 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 counter 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-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 completed 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 referenced like a constant. ay appear in expressions, but one cannot assign a value to . Using the keyword reverse causes the iteration to proceed downwards 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 close 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; 30 Each 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 predicate 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 otherwise. FOUND is the logical opposite 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 fetch ed, 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 course, 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 How to cite Sql Study Matetial, Essay examples
Subscribe to:
Posts (Atom)