.

Saturday, August 31, 2019

Informatic Practile Grade 11 Cbse .

A Text Book on INFORMATICS PRACTICES CLASS XI Shiksha Kendra, 2, Community Centre, Preet Vihar, Delhi-110 092 India A text book on Informatics Practices, Class XI. PRICE : Rs. FIRST EDITION 2010 CBSE, India COPIES: â€Å"This book or part thereof may not be reproduced by any person or agency in any manner. † PUBLISHED BY : The Secretary, Central Board of Secondary Education, Shiksha Kendra, 2, Community Centre, Preet Vihar, Delhi-110092 DESIGN, LAYOUT : Multi Graphics, 5745/81, Reghar Pura, Karol Bagh, New Delhi-110005, Phone : 25783846 PRINTED BY : ii Foreword Information and Communication Technology has permeated in every walk of life affecting the technology fields such as launching satellites, managing businesses across the globe and also enabling social networking. The convergence of computer, communication and content technologies, being known as ICT, have attracted attention of academia, business, government and communities to use it for innovative profitable propositions. Year by year it is becoming simpler to use devices such as desktop, palm top, iPod, etc. 21st century is characterized with the emergence of knowledge based society wherein ICT plays a pivotal role. In its vision, the National Policy on ICT in School Education by MHRD, Govt. of India, states â€Å"The ICT policy in School Education aims at preparing youth to participate creatively in the establishment, sustenance and growth of a knowledge society leading to all around socio economic development of the nation and global competitiveness†. The policy envisages three stages of ICT implementations at school level – ICT literacy and Competency Enhancement, ICT enabled teachinglearning, and introduction of ICT related elective subjects at Senior Secondary level. With this backdrop a major paradigm shift is imperative in imparting ICT-enabled instructions, collaborative learning, multidisciplinary problem-solving and promoting critical thinking skills as envisaged in the National curriculum framework 2005. Foundation of these skills is laid at school level. Armed with such skills it is expected that a student will transform knowledge into easy to use systems to the ultimate benefit of the society at large. Syllabus of Informatics Practices has been revisited accordingly with a focus on generic concepts with domain specific practical experiments and projects to ensure conceptual knowledge with practical skills. The societal impact of ICT have been discussed. A new Unit on IT Applications has been added to enhance understanding of the above tools and techniques to solve real life problems by designing both front end and back end with proper data connectivity. Introduction of Open Standards and Open Source to promote Vendor Neutrality of tools. Creativity and Collaborative Learning/Programming is also an added feature. Specifically, a Unit on Networking and Open Standards is introduced in place of Business Computing. For IDE based programming, Java is introduced in place of VB. Relational Database Management System is dealt with using My SQL in place of SQL & PL/SQL using Oracle. The CBSE had been recommending different books in the past. With a total overhauling of the course on Informatics Practices it has ventured to bring out a comprehensive text book for all units for the first time. I am happy to release Part-1 of Informatics Practices for Class – XI. I would like to express my deep appreciation to the text book development team for their contribution and to the convener of the team, Prof. Om Vikas who aptly steered this activity. Appreciation is also due to Mrs. C Gurumurthy, Director (Academic) and Dr. (Smt) Srijata Das, Education Officer, for planning, coordinating and executing this initiative and bringing out this publication. It is hoped that all students and teachers will benefit by making best use of this publication. Their feedback will be highly appreciated for further improvement. VINEET JOSHI CHAIRMAN H l d d H d d x , H d H l lt l h d T d x l x d d l L d l td d d t p D l H l d h L l d h l d , d, l D d d h x d h , d l p d h 100 || ASkills>100 || GK>100) JOptionPane. showMessageDialog(this,†Re-Enter Marks (Out of 100)†); v if the marks input by the user for any of the subjects are greater than 100 Check or not an if they are then display the message â€Å"Re-Enter Marks (Out of 100). Since we have to display the error message if the marks of even one subject are out of limit so we have used the || operator which means OR. So in simple english it means if marks of English are >100 or marks of ASkills >100 or marks of GK > 100, then display the error message. So the message will be displayed even if only one condition evaluates to true. if (ASkills>=90 && GK>=90 ) { JOptionPane. showMessageDialog(this,†** Selected for Achiever's Award **†); jTextField6. setText(â€Å"*†); } 158 INFORMATICS PRACTICES Chapter-6 Control Structures v if the marks of ASkills and GK are both >= 90 or not. If they are then Check display the message â€Å"** Selected for Achiever's Award **† and also display a â€Å"*† in the text field. Since we have to check that both the marks should be greater than 90 so we have use the && operator which in simple English means AND. So the condition will evaluate to true only if both the conditions are satisfied. Let us now write the code for the Grade calculator application as shown in Figure 6. 38 private void jButton1ActionPerformed(java. awt. event. ActionEvent evt) { // Variable Declaration and assignment operations int Total,English,ASkills,GK; English=Integer. parseInt(jTextField1. getText()); ASkills=Integer. parseInt(jTextField2. getText()); GK=Integer. arseInt(jTextField3. getText()); //Validation of Entered Marks if (English>100 || ASkills>100 || GK>100) JOptionPane. showMessageDialog (this,†Re-Enter Marks (Out of 100)†); else { Total=English+ASkills+GK; jTextField4. setText(Integer. toString(Total)); jButton2. setEnabled(true); } } private void jButton2ActionPerformed(java. awt. event. ActionEvent evt) { // Variable Declaration and assignment operations ch ar Grade; int ASkills,GK,Total; ASkills=Integer. parseInt(jTextField2. getText()); GK=Integer. parseInt(jTextField3. getText()); Total=Integer. arseInt(jTextField1. getText()); INFORMATICS PRACTICES 159 Chapter-6 Control Structures //Decision for Achiever's Award if (ASkills;=90 && GK;=90 ) { JOptionPane. showMessageDialog (this,†** Selected for Achiever's Award **†); jTextField6. setText(â€Å"*†); } //Finding Grade if (Total;=80) jTextField5. setText(â€Å"A†); else if (Total;=70) jTextField5. setText(â€Å"B†); else if (Total;=60) jTextField5. setText(â€Å"C†); else if (Total;=50) jTextField5. setText(â€Å"D†); else jTextField5. setText(â€Å"E†); } private void jButton3ActionPerformed(java. awt. event. ActionEvent evt) { // To Exit from application System. exit(0); } Figure 6. 38 Code for the Grade Calculator Application Since in this application we had to test for multiple conditions in a if statement, so we had to join the conditions using some operators. Such conditions that are formed by joining simple conditions are called complex conditions and they are usually joined using the logical operators. Logical Operator A logical operator denotes a logical operation. Logical operators and relational operators are used together to form a complex condition. Logical operators are: 160 INFORMATICS PRACTICES Chapter-6 Control Structures Operator && || ! Use a;10 && b10 || bMySQL Command Line Client OR Goto the folder C:Program FilesMySQLMySQL Server 5. 1in as the drive having MySQL] And Click on the file MySQL. EXE MySQL will prompt a message to provide password (it requires the same password which was entered during the installation) Enter Password:**** Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 4 Server version: (GPL) 5. 0. 51a-community-nt MySQL Community Edition [Assuming C: drive Type ‘help;' or ‘h' for help. Type ‘c' to clear the buffer. Mysql; To exit from MySQL, type QUIT or EXIT Mysql;QUIT The above steps ensure successful installation and configuration of MySQL database server. Next time in the MySQL prompt, one can create and use databases, create tables and execute SQL queries. Downloading MySQL [Linux Environment]: Installation of the binary version of MySQL, release 4. 0. 20, to run on Linux is as follows: Installation file for MySQL may be downloaded from the link: INFORMATICS PRACTICES 203 Chapter-8 Introduction to MySQL http://dev. mysql. com/downloads/mysql/5. 1. tml#downloads (Choose appropriate download link as per the desired operating system) Create MySQL User Account: # cd /usr/local # groupadd mysql # useradd -c â€Å"MySQL Software Owner† -g mysql mysql # passwd mysql Changing password for user mysql. password: all authentication tokens updated successfully. Installing Binary Version: Unzip the files and change the directory to mysql # cd mysql # scripts/m ysql_install_db –user=mysql Preparing db table Preparing host table Preparing user table Preparing func table †¦ †¦ †¦ The latest information about MySQL is available on the web at http://www. ysql. com Support MySQL by buying support/licenses at https://order. mysql. com 204 INFORMATICS PRACTICES Chapter-8 Introduction to MySQL Start and Stop The Database Software: Starting the MySQL Database # su # cd /usr/local/mysql # bin/mysqld_safe –user=mysql & Starting mysqld daemon with databases from /usr/local/mysql/data Stopping the MySQL Database # su # cd /usr/local/mysql # bin/mysqladmin -u root shutdown 040803 23:36:27 mysqld ended [1]+ Done Know more Visit the following website to find a vast list of free and open source softwares available: http://en. wikipedia. rg/wiki/List_of_free_and_open_source_software_packages bin/mysqld_safe –user=mysql Summary A database is an organised collection of data. v Data vis stored in a relational database in one or more tables. A group v of rows and columns forms a Table. The horizontal subset of a Table is known as a Row/Tuple. v The vertical subset of a Table is known as a Column/Attribute. v A Candidate key is an attribute (or a set of attributes) that uniquely identifies a v row. A Primary Key is one of the candidate keys. Only v one of the Candidate keys is selected as the primary key of a table. All other candidate keys are called Alternate keys. INFORMATICS PRACTICES 205 Chapter-8 Introduction to MySQL Multiple Choice Questions 1. A relation can have only one ________ key and may have more than one _______ keys. a) b) c) d) 2. Primary, Candidate Candidate, Alternate Candidate, Primary Alternate, Candidate The vertical subset of a table is known as: a) b) c) d) Tuple Row Attribute Relation 3. If software is released under open source, it means: a) b) c) d) It is expensive. Its source code is available to the user. It belongs to a company. It is a DBMS. 4. Which of the following columns in a Student table can be used as the primary key? ) b) c) d) Class Section First Name Admission No 5. A tuple is also known as a ___________________________ . a) b) c) d) table relation row field INFORMATICS PRACTICES 206 Chapter-8 Introduction to MySQL 6. An attribute is also known as a_________________________. a) b) c) d) table relation row column 7. A field or a combination of fields in a table that has a unique value for each row is calle d: a) b) c) d) Candidate key. Foreign key. Main key. Alternate key. Exercises 1. Answer the following questions: a) Define the following terms: i) ii) Database Table iii) Primary key iv) v) b) c) d) e) f) 2. Candidate key Alternate key What is the relationship between a Database and a Table? What is DBMS? Write names of any two DBMSs. How is data organized in a table? What is a Primary key? What is its purpose in a table? What is MySQL? Distinguish between the following pairs a) b) Row and Column Primary key and Candidate key. INFORMATICS PRACTICES 207 9 Learning Objectives After studying this lesson the students will be able to: State vcategories of SQL statements. Create v a database Create v a table. Add rows to a table. v MySQL Retrieve v data in various ways from table using SELECT statement. Display v data in a sorted way using ORDER BY clause. Modify v data stored in a table. View v structure of a table Modify v structure of table Delete v rows from a table In the previous lesson, you have learnt that Relational Databases use tables to store data. A table simply refers to a two dimensional representation of data using columns and rows. MySQL lets us manipulate and manage these tables in an efficient way. We have learnt that MySQL is a Relational Database Management System. In this lesson we will learn about SQL (Structured Query Language). It is a Standard language used for accessing and manipulating relational databases. Ms. Sujata is a Class teacher of Class XI. She wants to store data of her students i. e. Names and marks secured, in a database. A database is used to house data in the form of tables. She uses a CREATE DATABASE statement to create a new database named School. 208 INFORMATICS PRACTICES Chapter-9 MySQL mysql; CREATE DATABASE School; Once the above mentioned statement gets executed, a database with the name School is created on her system. Now she has to open the database to work on it. For this USE statement is required. She opens the School database: Statement entered by user mysql; USE School; Database Changed Display by system Now, MySQL prompt can accept any query related to the database School. ! Semicolon is standard way to end SQL statement. Creating a table After creating a database, the next step is creation of tables in the database. For this CREATE TABLE statement is used. Syntax: CREATE TABLE ( , ,†¦ , ); Since Ms. Sujata is just learning, she initially creates a simple table named Learner with only two columns RollNo and Name in the School database. To do this, she enters the following statement: mysql; CREATE TABLE Learner ( RollNo INTEGER, Name VARCHAR(25) ); INFORMATICS PRACTICES 209 Chapter-9 MySQL v Give meaningful name to a table. If a table will store information about students, name it STUDENTS, not Abc or Person. vnames and column names are not case sensitive. For example, Table STUDENTS is treated the same as STuDents or students. We will study about the CREATE TABLE statement in detail later in this lesson. What if Ms. Sujata wants to see the names of all the tab les in the database? At any point of time, she can view names of all the tables contained in the current database by using SHOW TABLES statement as shown below: mysql; SHOW TABLES; +——————+ | Tables_in_school | +——————+ | Learner | ——————+ 1 row in set (0. 00 sec) Once the table named Learner is created, Ms. Sujata would like to add data of students in the table, which is also known as populating table with rows. To add row(s) in the table she uses the INSERT INTO statement: Syntax: INSERT INTO VALUES (,,†¦ ,); 210 INFORMATICS PRACTICES Chapter-9 MySQL She inserts 4 rows : mysql> INSERT INTO Learner VALUES (14,'Aruna Asaf Ali'); mysql> INSERT INTO Learner VALUES (12,'Tarun Sinha'); mysql> INSERT INTO Learner VALUES (16,'John Fedrick'); mysql> INSERT INTO Learner VALUES (10,'Yogi Raj Desai'); ! In INSERT statement: Character, date and Time data should be enclosed in Quotes. Numeric values should not be enclosed in quotes. Now that she has added 4 rows in the table, she wants to view the contents of the table. How can she do that? To view the contents of the table, she uses the following SELECT statement. In the simplest way, SELECT statement is used like this: Syntax: SELECT * FROM ; So, she types the statement: mysql; SELECT * FROM Learner; +—————————+ |RollNo | Name | +—————————+ | 14 | 12 | 16 | 10 | Aruna Asaf Ali | Tarun Sinha | John Fedrick | Yogi Raj Desai | | | | —————————+ In the above statement, FROM clause states which table to look in for data. Any time to know the database currently in use, the SELECT DATABASE() statement can be used. INFORMATICS PRACTICES 211 Chapter-9 MySQL mysql> SELECT DATABASE(); DATABASE() school 1 row in set (0. 0 sec) ! Statements in MySQL are not case sensitive. It means select DATABASE(); or SELECT DATABASE(); or SELECT database(); would all work the same way. Some Terminologies Keyword: A keyword refers to a special word that has a special meaning to SQL. For example, SELECT and FROM are keywords. Clause : A clause is a portion of an SQL statement. Each clause is identified by a keyword. For example, consider the statement SELECT name FROM Learner; Here SELECT name is a clause. SELECT is a statement as well as a clause. SELECT clause is everything from keyword SELECT until keyword FROM. SELECT statement is the entire command. FROM Learner is a FROM clause, which specifies the table from which data has to be selected. Statement : A statement is a combination of two or more clauses. For example, SELECT name FROM Learner; is a statement. 212 INFORMATICS PRACTICES Chapter-9 MySQL MySQL Data Types Well, before we learn more about making a table, there is one thing we need to understand first: Data Types. They indicate the type of data that you are storing in a given table column. So, what are the different Data Types available in MySQL? Here is a list of some of the most common ones and what type of values they hold: Class Text Data Type CHAR(size) Description A fixed-length string from 1 to 255 characters in length right-padded with spaces to the specified length when stored. Values must be enclosed in single quotes or double quotes. Example ‘Maths' â€Å"TexT† VARCHAR(size) A variable-length string from 1 to 255 characters in length; for example VARCHAR(25). Values must be enclosed in single quotes or double quotes. ‘Computer' â€Å"Me and u† Numeric DECIMAL(size,d) It can represent number with or without the fractional part. The maximum number of digits may be specified in the size parameter. The maximum number of digits to the right of the decimal point is specified in the d parameter INT Or INTEGER It is used for storing integer values. You can specify a width upto 11 digits. 17. 32 345 76 INFORMATICS PRACTICES 213 Chapter-9 MySQL Date DATE It represents the date including day, month and year It represents time. Format: HH:MM:SS Note: The supported range is from ‘-838:59:59' to ‘838:59:59' ‘2009-0702' TIME() TIME Categories of SQL Commands SQL commands can be classified into the following categories: 1. Data Definition Language (DDL) Commands The DDL part of SQL permits database tables to be created or deleted. It also defines indices (keys), specifies links between tables, and imposes constraints on tables. Examples of DDL commands in SQL are: v CREATE DATABASE – creates a new database v CREATE TABLE – creates a new table v TABLE – modifies a table ALTER v TABLE – deletes a table DROP 2. The Data Manipulation Language (DML) Commands The query and update commands form the DML part of SQL: Examples of DDL commands are: v SELECT – extracts data from a table v UPDATE – updates data in a table v DELETE – deletes data from a table v INSERT INTO – inserts new data into a table CREATE TABLE Ms. Sujata feels good that she has successfully created a table named Learner with 2 columns using CREATE TABLE statement. She now creates a table named Student with 214 INFORMATICS PRACTICES Chapter-9 MySQL four columns. When tables are created its columns are named, data types and sizes are supplied for each column. While creating a table at least one column must be specified. Syntax: CREATE TABLE (; column name; [ ], (; column name; [ ], †¦); Example: mysql; USE school; Database changed mysql; CREATE TABLE Student( Rollno INTEGER, Name VARCHAR(25), Gender CHAR(1), Marks1 DECIMAL(4,1)); Query OK, 0 rows affected (0. 16 sec) ! If table Student already exists in database school, then the error message â€Å"Table Student already exists† is displayed. Each column in the table is given a unique name. In the example above the column names are Rollno, Name etc. This doesn't mean each column that is named has to be unique within the entire database. It only has to be unique within the table where it exists. Also notice that the names do not use any spaces. !When naming tables and columns be sure to keep it simple with letters and numbers. Spaces and symbols are invalid characters except for underscore(_). Column names like first_name,last_name,email are valid column names. Viewing Structure of Table The DESCRIBE statement can be used to see the structure of a table as indicated in the Create Statement. It displays the Column names, their data types, whether Column must contain data ,whether the Column is a Primary key etc. INFORMATICS PRACTICES 215 Chapter-9 MySQL Syntax: DESCRIBE ; OR DESC ; mysql> DESCRIBE Student; Statement entered by user +——–+————–+——+—–+———+——-+ | Field | Type | Null | Key | Default | Extra | +——–+————–+——+—–+———+——-+ | Rollno | int(11) | Name | varchar(25) | YES | YES | YES | | | | | NULL | NULL | NULL | NULL | | | | | | | | Output shown by system | Gender | char(1) | Marks1 | decimal(4,1) | YES +——–+————–+——+—–+———+——-+ 4 rows in set (0. 01 sec) Ms. Sujata adds some rows in the Student table using the INSERT INTO statement: INSERT INTO Student VALUES (1,'Siddharth Sehgal','M',93); INSERT INTO Student VALUES (2,'Gurpreet Kaur','F',91); INSERT INTO Student VALUES (3,'Monica Rana','F',93); INSERT INTO Student VALUES (4,'Jatinder Sen','M',78); INSERT INTO Student VALUES (5,'George Jacob','M',76); INSERT INTO Student VALUES (6,'Deepa Bhandari','F',77); INSERT INTO Student VALUES (7,'Akshay Nath','M',65); Changing Structure of table When we create a table we define its structure. We can also change its structure i. e. add, remove or change its column(s) using the ALTER TABLE statement. Syntax: ALTER TABLE ADD/DROP [datatype]; ALTER TABLE MODIFY ; 216 INFORMATICS PRACTICES Chapter-9 MySQL Example: Ms. Sujata adds a column named Games. mysql> ALTER TABLE Student ADD Games VARCHAR(20); Now she wants to check the structure of the table to see that the new column Games is added. mysql> DESCRIBE Student; +——–+————–+——+—–+———+——-+ | Field | Type | Null | Key | Default | Extra | +——–+————–+——+—–+———+——-+ | Rollno | int(11) | Name | varchar(25) | YES | YES | YES | | | | | | NULL | NULL | NULL | NULL | NULL | | | | | | | | | | Gender | char(1) | Marks1 | decimal(4,1) | YES | Games | varchar(20) | YES +——–+————–+——+—–+———+——- + 5 rows in set (0. 00 sec) After execution of the above ALTER TABLE statement, the Games column is added and a NULL value is assigned to all the rows in this column. mysql> SELECT * FROM Student; +——–+——————+——–+——–+——-+ | Rollno | Name | | | | | | | 1 | Siddharth Sehgal 2 | Gurpreet Kaur 3 | Monica Rana 4 | Jatinder Sen 5 | George Jacob 6 | Deepa Bhandari 7 | Akshay Nath | Gender | Marks1 |M |F |F |M |M |F |M | | | | | | | 93. 91. 0 93. 0 78. 0 76. 0 77. 0 65. 0 | Games | | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | | | | | | +——–+——————+——–+——–+——-+ +——–+——————+——–+——–+——-+ INFORMATICS PRACTICES 217 Chapter-9 MySQL Now, s uppose we want to change the newly added Games column to hold integers(in place of character data) using ALTER TABLE statement: mysql> ALTER TABLE Student MODIFY games INTEGER; To delete a column of a table the ALTER TABLE statement is used with Drop clause. Ms. Sujata deletes the Games column using the ALTER TABLE statement: mysql> ALTER TABLE Student DROP Games; mysql> DESC student; +——–+————–+——+—–+———+——-+ | Field | Type | Null | Key | Default | Extra | +——–+————–+——+—–+———+——-+ | Rollno | int(11) | Name | varchar(25) | YES | YES | YES | | | | | NULL | NULL | NULL | NULL | | | | | | | | | Gender | char(1) | Marks1 | decimal(4,1) | YES +——–+————–+——+—–+———+——-+ 4 rows in set (0. 00 sec) The above display shows that Games column is removed from the table. The word â€Å"DESC† can also be used in place of â€Å"DESCRIBE† Retrieving Information with SELECT Statement The SELECT statement is used to fetch data from one or more database tables. Retrieving Single Column Here is the syntax of SELECT statement to retrieve a single column from a table: Syntax: SELECT FROM ; 218 INFORMATICS PRACTICES Chapter-9 MySQL Example: Ms. Sujata wants to display Roll numbers of all her students. She uses the following statement: mysql> SELECT Rollno FROM Student; +———- + | Rollno | +———- + | | | | | | | 1 2 3 4 5 6 7 | | | | | | | ———- + 7 rows in set (0. 00 sec) Retrieving Multiple Columns We can display more than one column(s) from a table using SELECT statement: Syntax: SELECT , FROM ; Example: Now, Ms. Sujata displays two columns :Roll numbers and names of all the students. mysql> SELECT Rollno, Name FROM Student; +———- +——————+ | Rollno | Name | +———- +——————+ | | 1 2 | Siddharth Se hgal | Gurpreet Kaur | | 219 INFORMATICS PRACTICES Chapter-9 MySQL | | | | | 3 4 5 6 7 | Monica Rana | Jatinder Sen | George Jacob | Deepa Bhandari | Akshay Nath | | | | +———- +——————+ 7 rows in set (0. 00 sec) Changing the order of display of Columns We can display columns in any order by specifying the columns in that order in SELECT statement . The following statement displays Names first and then Roll numbers from the table Student. mysql> SELECT Name,Rollno FROM Student; +——————+——–+ | Name | Rollno | +——————+——–+ | Siddharth Sehgal | Gurpreet Kaur | Monica Rana | Jatinder Sen | George Jacob | Deepa Bhandari | Akshay Nath | | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ——————+——–+ 7 rows in set (0. 00 sec) In the Output, notice that the first column displaying names is left-justified and the second column displaying roll numbers is right justified. The format of output follows the pattern that character data is left justified and numeric data is right justified. 220 INFORMATICS PRACTICES Chapter-9 MySQL Retrieving all Columns To see all the columns of the table, we can write * in place of names of all the columns. The columns are displayed in the order in which they are stored in the table. Ms. Sujata uses the following statement to see all the columns of her table: mysql> SELECT * FROM Student; +——–+——————+——–+——–+ | Rollno | Name | Gender | Marks1 | +——–+——————+——–+——–+ | | | | | | | 1 2 3 4 5 6 7 | Siddharth Sehgal | Gurpreet Kaur | Monica Rana | Jatinder Sen | George Jacob | Deepa Bhandari | Akshay Nath |M |F |F |M |M |F |M | | | | | | | 93. 0 | 91. 0 | 93. 0 | 78. 0 | 76. 0 | 77. 0 | 65. 0 | +——–+——————+——–+——–+ 7 rows in set (0. 00 sec) ! The asterisk (*) means â€Å"All†. SELECT * means display all columns Eliminating duplicate values By default data is displayed from all the rows of the table, even if the data in the result is duplicated. Using the keyword DISTINCT, the duplicate values can be eliminated in the result. When DISTINCT keyword is specified, only one instance of the duplicated data is shown. The following query without the DISTINCT keyword shows 7 rows while the same query with DISTINCT keyword shows 6 rows as duplicate data 93 is displayed only once. INFORMATICS PRACTICES 221 Chapter-9 MySQL mysql> SELECT Marks1 FROM Student; +——–+ | Marks1 | +——–+ | | | | | | | 93. | 91. 0 | 93. 0 | 78. 0 | 76. 0 | 77. 0 | 65. 0 | 93 displayed twice +——–+ 7 rows in set (0. 00 sec) mysql> SELECT DISTINCT Marks1 FROM Student; +——–+ | Marks1 | +——–+ | | | | | | 93. 0 | 91. 0 | 78. 0 | 76. 0 | 77. 0 | 65. 0 | +——–+ 6 rows in set (0. 00 sec) 222 INFORMATICS PRACTICES Chapter-9 MySQL Retrieving Data From All Rows If we write the keyword ALL in place of DISTINCT, then the result of SELECT query displays all the values including duplicate values. The output is the same as what we get when we do not write DISTINCT keyword in the SELECT query. Using Arithmetic Operators with SELECT Arithmetic operators perform mathematical calculations. In SQL the following arithmetic operators are used: Operator + * / % What it does Addition Subtraction Multiplication Division Modulus (or remainder) Modulus operator (%) returns the remainder of a division. We can perform simple arithmetic computations on data using SELECT statement. Ms. Sujata thinks what if all my students had secured 5 marks more. She enters the following statement to display marks of all students increased by 5. mysql> SELECT Marks1+5 FROM Student; +———-+ | Marks1+5 | +———-+ | | | | | | | 98. 96. 0 98. 0 83. 0 81. 0 82. 0 70. 0 | | | | | | | +———-+ 7 rows in set (0. 02 sec) INFORMATICS PRACTICES 223 Chapter-9 MySQL Marks1 column is displayed increased by 5. The actual values are not increased in the table. Here are some more examples: mysql> SELECT Name,Marks1+0. 05*Marks1 FROM Student ; mysql> SELECT Name, Marks1-10 FROM Student ; mysql> SELECT Name,Marks1/2 FROM Student ; ! Using these operators on tables does not create new columns in the tables or change the actual data values. The results of the calculations appear only in the output. In the above examples, arithmetic calculations were based on Student table. Arithmetic calculations may not always be based on tables. For example when we want to compute 7*3+1, there is no table to be referenced. In such queries no FROM clause is used : mysql> SELECT 7*3+1; +——-+ | 7*3+1 | +——-+ | 22 | +——-+ 1 row in set (0. 09 sec) mysql> SELECT 71+34; +——-+ | 71+34 | +——-+ | 105 | +——-+ 1 row in set (0. 00 sec) 224 INFORMATICS PRACTICES Chapter-9 MySQL Using Column Alias Till now, we have seen that when the result of an SQL statement is displayed, the heading displayed at the top of column is same s the column name in the table or the arithmetic operation being done on the Column. While displaying marks from the table Student, Ms. Sujata wants the output to display a column heading (for Marks) that is easier to understand and is more meaningful and presentable like â€Å"Marks Secured† inste ad of Marks1. Column alias lets different name (heading) to appear for a column than the actual one in the output. She enters the statement like this: mysql> SELECT Marks1 AS â€Å"Marks Secured† FROM Student; +—————+ | Marks Secured | +—————+ | | | | | | | 93. | 91. 0 | 93. 0 | 78. 0 | 76. 0 | 77. 0 | 65. 0 | +—————+ 7 rows in set (0. 00 sec) Notice that the column Marks1 has been given the column heading â€Å"Marks Secured† . If a column alias consists of more than one word ,then it should be enclosed in quotes as in â€Å"Marks Secured†,otherwise error message is displayed. ! Using Column Alias does not rename a column. It simply displays a different column name in the output. The AS keyword between the column name and alias is optional. We can also write SELECT Marks1 â€Å"Marks Secured† FROM Student; INFORMATICS PRACTICES 225 Chapter-9 MySQL Putting text in Query output Can Ms. Sujata make the query output more presentable by inserting items such as symbols or text in the query output ? Yes. She can. She uses the following statement. mysql> SELECT Rollno,Name,'has secured marks',marks1 FROM student; +——–+——————+——————-+——–+ | Rollno | Name | has secured marks | marks1 | +——–+——————+——————-+——–+ | | | | | | | 1 | Siddharth Sehgal | has secured marks 2 | Gurpreet Kaur 3 | Monica Rana 4 | Jatinder Sen 5 | George Jacob 6 | Deepa Bhandari 7 | Akshay Nath | has secured marks | has secured marks | has secured marks | has secured marks | has secured marks | has secured marks | | | | | | | 93. 0 | 91. 0 | 93. 0 | 78. 0 | 76. 0 | 77. 0 | 65. 0 | +——–+——————+——————-+——–+ 7 rows in set (0. 00 sec) The text ‘has secured marks' is displayed with every row of the table. Retrieving specific rows – WHERE clause Tables usually contain many rows. Mostly, we do not want to display all the rows of a table. Certain rows can be displayed based on the criteria for selection of rows using the keyword WHERE. The WHERE clause is used to filter records. It is used to extract only those records that fulfill a specified criterion. Syntax: SELECT [, ,†¦. ] FROM WHERE ; Ms. Sujata wants to display the names and marks of all those students who have secured marks above 80, she enters: 226 INFORMATICS PRACTICES Chapter-9 MySQL mysql> SELECT Name,Marks1 FROM Student WHERE Marks1 > 80; +——————+———-+ | Name | Marks1 | +——————+———-+ | Siddharth Sehgal | Gurpreet Kaur | Monica Rana | | | 93. 91. 0 93. 0 | | | +——————+———-+ 3 rows in set (0. 00 sec) She thinks â€Å"What would be the marks of my students if they were increased by 5 for all those students who secured marks below 80? † She enters the statement : mysql> SELECT Name,Marks1+5 FROM Student WHERE marks1 < >= SELECT * FROM Student WHERE Marks1>=93; +——–+——————+——–+——–+ | Rollno | Name | Gender | Marks1 | +——–+——————+——–+——–+ | | 1 3 | Siddharth Sehgal | Monica Rana |M |F | | 93. 0 93. 0 | | +——–+——————+——–+——–+ 2 rows in set (0. 6 sec) ! When we use relational operators with character data type, < means earlier in the alphabet and > means later in the alphabet. ‘Aman' < ‘Ayan' as ‘m' comes before ‘y' in alphabet. Some more examples of queries involving relational expressions: mysql> SELECT Name,Marks1 FROM Student WHERE Marks1 SELECT * FROM Student WHERE Name = ‘Gurpreet Kaur'; mysql> SELE CT RollNo,Marks1 FROM Student WHERE Rollno SELECT RollNo,Marks1 FROM Student WHERE Rollno 3; mysql> SELECT RollNo,Marks1 FROM Student WHERE Name ‘Mani Kumar'; 228 INFORMATICS PRACTICES Chapter-9 MySQL Logical Operators OR, AND, NOT logical operators are used in SQL. Logical operators OR and AND are used to connect relational expressions in the WHERE clause. If any of the comparisons are true, OR returns TRUE. AND requires both conditions to be true in order to return TRUE. NOT negates a condition. If a condition returns a True value, adding NOT causes the condition to return a False value and vice versa. The symbol || can be used in place of OR, && can be used in place of AND, ! can be used in place of NOT operator. Ms. Sujata uses the following statement (with Logical operator AND) to display Roll numbers and names of students who have secured marks above 70 but below 80. mysql> SELECT Rollno, Name,Marks1 FROM Student WHERE Marks1 > 70 AND Marks1 < 80; +——–+—————-+——–+ | Rollno | Name | Marks1 | +——–+—————-+——–+ | | | 4 5 6 | Jatinder Sen | George Jacob | Deepa Bhandari | | | 78. 0 | 76. 0 | 77. 0 | +——–+—————-+——–+ 3 rows in set (0. 01 sec) Some example of SQL statements with Logical operators are shown below. ysql> SELECT Empnumber, EmpName FROM Employee WHERE Department = ‘Accoumts' OR Department = ‘Personnel'; mysql> SELECT Empnumber, EmpName FROM Employee WHERE Department = ‘Accoumts' AND Designation = ‘Manager'; mysql> SELECT Empnumber, EmpNa me FROM Employee WHERE NOT(Designation = ‘Manager'); mysql> SELECT Name,TotalMarks FROM Candidate WHERE writtenmarks>80 || Interviewmarks>10; SELECT Name,TotalMarks FROM Candidate WHERE writtenmarks>80 && Interviewmarks>10; INFORMATICS PRACTICES 229 Chapter-9 MySQL Using Parenthesis in WHERE clause Sometimes we have to write a criterion using a combination of AND and OR. The parentheses not only help us visually see how things are grouped together but they also let the DBMS know exactly what to do. SELECT * FROM Emp WHERE first_name='Amit' AND (last_name='Sharma' OR last_name='Verma'); So, how does that work? It simply states that we are looking for anyone with the first name as Amit and the last name as Sharma or Verma. They must have the first name as Amit but can have the last name as either Sharma or Verma. Condition based on Range The BETWEEN operator defines the range of values within which the column values must fall into to make the condition true. The range includes both the upper and lower values. Ms. Sujata uses the following statement to display roll numbers and marks of students who have secured marks in the range 70 to 80 (including 70 and 80). mysql> SELECT Rollno,Name,Marks1 FROM Student WHERE Marks1 BETWEEN 70 AND 80; +——–+—————-+——–+ | Rollno | Name | Marks1 | +——–+—————-+——–+ | | | 4 5 6 | Jatinder Sen | George Jacob | Deepa Bhandari | | | 78. 0 | 76. 0 | 77. 0 | +——–+—————-+——–+ 3 rows in set (0. 06 sec) The following statement displays roll numbers and marks of students who have secured marks other than the ones in the range 70 to 80(including 70 and 80). 30 INFORMATICS PRACTICES Chapter-9 MySQL mysql> SELECT Rollno,Name,Marks1 FROM Student WHERE Marks1 NOT BETWEEN 70 AND 80; ! BETWEEN displays all values between the lower and the upper va lues including the lower and the upper values. To display marks in the range 70 to 80, Ms. Sujata could have used the following statement to give the same output as the one using BETWEEN operator. mysql> SELECT Rollno,Name,Marks1 FROM Student WHERE Marks1>=70 AND Marks1 SELECT Rollno, Name, Marks1 FROM Student WHERE Marks1 IN (68,76,78); +————-+———————+————–+ | Rollno | Name | Marks1 | ————-+———————+————–+ | | 4 5 | Jatinder Sen | 78. 0 76. 0 | | | George Jacob | +————-+———————+————–+ 2 rows in set (0. 00 sec) In an Employee table, to display rows where State is ‘DELHI' or ‘MUMBAI' or ‘UP', we write the query like this: SELECT * FROM E mployee WHERE State IN (‘DELHI','MUMBAI','UP'); In an Employee table, to display all rows except those that have State as ‘DELHI' or ‘MUMBAI' or ‘UP', we write the query like this: INFORMATICS PRACTICES 231 Chapter-9 MySQL SELECT * FROM Employee WHERE State NOT IN (‘DELHI','MUMBAI','UP'); Till now Ms. Sujata's table Student has 7 rows. She wants to populate it with some more rows. She uses the following INSERT INTO statement. INSERT INTO Student VALUES (8,'Samdisha Sen','F',76); INSERT INTO Student VALUES (9,'Geeta Sen Sharma','F',91); INSERT INTO Student VALUES (10,'Geet Kadamb','M',66); INSERT INTO Student VALUES (11,'Aman Ali','M',92); INSERT INTO Student VALUES (12,'Ayan Ali','M',87); She checks that the table has the new rows inserted by using the following SELECT statement: SELECT * FROM Student; +——–+——————+——–+——–+ | Rollno | name | Gender | Marks1 | ——–+——————+——–+——–+ | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | Siddharth Sehgal | | Gurpreet Kaur | Monica Rana | Jatinder Sen | George Jacob | Deepa Bhandari | Akshay Nath | Samdisha Sen | Geeta Sen Sharma | G eet Kadamb | Aman Ali | Ayan Ali | | | | | | | | | | | M F F M M F M F F M M M | | | | | | | | | | | | 93 91 93 78 76 77 65 76 91 66 92 87 | | | | | | | | | | | | +——–+——————+——–+——–+ 12 rows in set (0. 00 sec) 232 INFORMATICS PRACTICES Chapter-9 MySQL Condition based on pattern matches Sometimes while trying to remember somebody's name, you remember a part of his/her name but not the exact name. In such cases, MySQL has wildcards to help you out. % and _ are two wild card characters. The percent (%) symbol is used to represent any sequence of zero or more characters. The underscore (_) symbol is used to represent a single character. LIKE clause is used to fetch data which matches the specified pattern from a table. The LIKE clause tells the DBMS that we won't be doing a strict comparison like = or ; or ; but we will be using wildcards in our comparison. Syntax: SELECT , [†¦] WHERE LIKE Pattern [AND [OR]] ; For example, Ms. Sujata wants to display details of students who have their names ending with ‘Sen', she enters: mysql; SELECT * FROM Student WHERE Name LIKE ‘%Sen'; +——–+————–+——–+———-+ | Rollno | Name | Gender | Marks1 | +——–+————–+——–+———-+ | | 4 | Jatinder Sen | M 8 | Samdisha Sen | F | | 78. | 76. 0 | +——–+————–+——–+———-+ 2 rows in set (0. 00 sec) To display rows from the table Student with names starting with ‘G', she enters: mysql> SELECT * FROM Student WHERE Name LIKE †˜G%'; +——–+——————+——–+———-+ | Rollno | name | Gender | Marks1 | +——–+——————+——–+———-+ | 2 | Gurpreet Kaur |F | 91. 0 | 233 INFORMATICS PRACTICES Chapter-9 MySQL | | | 5 | George Jacob 9 | Geeta Sen Sharma 10 | Geet Kadamb |M |F |M | | | 76. 0 | 91. | 66. 0 | +——–+——————+——–+———-+ 4 rows in set (0. 02 sec) To display rows that have names starting with ‘G' and ending with ‘b', she enters: mysql> SELECT * FROM Student WHERE Name LIKE ‘G%b'; +———-+——————+————-+———–+ | Rollno | name | Gender | Marks1 | +———-+—â€⠀Ã¢â‚¬â€Ã¢â‚¬â€Ã¢â‚¬â€Ã¢â‚¬â€+————-+———–+ | | 5 10 | George Jacob | Geet Kadamb |M |M | | 76. 0 66. 0 | | +———-+——————+————-+———–+ 2 rows in set (0. 0 sec) To display rows from the table Student that have ‘Sen' anywhere in their names, she enters: mysql> SELECT * FROM Student WHERE Name LIKE ‘%Sen%'; +———-+——————+————-+———–+ | Rollno | name | Gender | Marks1 | +———-+——————+————-+———–+ | | | 4 8 9 | Jatinder Sen | Samdisha Sen | Geeta Sen Sharma |M |F |F | | | 78 76 91 | | | +———-+——————+—â₠¬â€Ã¢â‚¬â€Ã¢â‚¬â€-+———–+ 3 rows in set (0. 00 sec) 234 INFORMATICS PRACTICES Chapter-9 MySQL To display rows that have names starting with ‘A' and then having any 4 characters and ending with ‘Ali', she uses underscore wild card like this: mysql; SELECT * FROM Student WHERE Name LIKE ‘A_ _ _ _ Ali'; +———-+——————+————-+———–+ | Rollno | name | Gender | Marks1 | +———-+——————+————-+———–+ | | 11 12 | Aman Ali | Ayan Ali |M |M | | 92. 0 87. 0 | | +———-+——————+————-+———–+ 2 rows in set (0. 00 sec) Some more examples ‘Am%' matches any string starting with Am. %Singh%' matches any string containing ‘Singh' ‘%a' matches any string ending with ‘a' ‘_ _ _' matches any string that is exactl y 3 characters long. ‘_ _ %' matches any string that has at least 2 characters. ‘_ _ _ g' matches any string that is 4 characters long with any 3 characters in the beginning but ‘g' as the 4th character. The keyword NOT LIKE is used to select the rows that do not match the specified pattern. To display rows from the table Student that have names not starting with ‘G', she enters: mysql> SELECT * FROM Student WHERE Name NOT LIKE ‘G%'; Precedence of Operators All the operators have precedence. Precedence is the order in which different operators are evaluated in the same expression. When evaluating an expression containing INFORMATICS PRACTICES 235 Chapter-9 MySQL multiple operators, operators with higher precedence are evaluated before evaluating those with lower precedence. Operators with equal precedence are evaluated from left to right within the expression. Parenthesis can be used to change the preference of an operator. Various operators in descending order of precedence (top to bottom) are listed below: ! (unary minus) ^ *, /, DIV, %, MOD -, + =, , ;=, ;, INSERT INTO Student(Rollno,Marks1) VALUES (14,45); Query OK, 1 row affected (0. 05 sec) Since values are provided only for Roll number and marks, Ms. Sujata uses the SELECT statement and notices the word NULL displayed for Name and Gender for Roll number 14 : mysql; SELECT * FROM Student WHERE Rollno =14; +——–+——+——–+———-+ | Rollno | name | Gender | Marks1 | +——–+——+——–+———-+ | 14 | NULL | NULL | 45. 0 | +——–+——+——–+———-+ 1 row in set (0. 0 sec) Explicitly Inserting NULL Values We have learnt that if a column can hold NULL values, it can be omitted from the INSERT INTO statement. INSERT INTO statement will automatically insert a null value in that column. This is called Implicitly inserting a NULL value. mysql> INSERT INTO Student(Rollno,Name,Gender) Values(15,'Charvi Chanana','F'); Query OK, 1 row affected (0. 11 sec) In the above INSERT INTO statement Marks1 column is omitted, therefore NULL value will be inserted for it. We can also explicitly add NULL value by using the NULL keyword in the VALUES list for those columns that can hold null values. ysql> INSERT INTO Student Values(14,'Siddharth Sehgal','M',NULL); Query OK, 1 row affected (0. 11 sec) 242 INFORMATICS PRACTICES Chapter-9 MySQL ! A NULL value means no value has been entered for that column i. e. the value for that column is not known. Inserting Date Values The default way to store a date in MySQL is with the type DATE. Below is the format of a DATE. YYYY-MM-DD To insert the current date into a table, MySQL's built-in function CURDATE() can be used in the query. Following are some examples of inserting date values. ysql> INSERT INTO my_table (idate) VALUES (19970505); mysql> INSERT INTO my_table (idate) VALUES ('97-05-05†²); mysql> INSERT INTO my_table (idate) VALUES (‘1997. 05. 05'); mysql> INSERT INTO my_table (idate) VALUES (‘0000-00-00'); ! While Inserting data: v Text values must be enclosed in quotes. v Standard date format is â€Å"yyyy-mm-dd†. v Standard time format is â€Å"hh:mm:ss†. v are required around the standard date and time formats. Quotes UPDATE STATEMENT In the table student, Ms. Sujata entered a student's marks as 93. Suppose, that student found out that one of her answers was unchecked and got her marks increased by 1. How would Ms. Sujata change it in the table? She can use the UPDATE statement to modify existing data in the table. (a) Syntax: UPDATE SET = , [ = , †¦] [WHERE ]; INFORMATICS PRACTICES 243 Chapter-9 MySQL The statement can be used to update one or more columns together. WHERE clause helps in updation of particular rows in a table. The following statement sets the marks(Mark1) of all the rows to 94. UPDATE Student SET Marks1 = 94; The following statement sets the marks(Mark1) of the row with name as ‘Monica Rana' to 94. ysql; UPDATE Student SET Marks1 = 94 WHERE name = ‘Monica Rana'; Query OK, 1 row affected (0. 03 sec) Rows matched: 1 Changed: 1 Warnings: 0 The marks displayed from the table shows 94 marks now: mysql; SELECT Name,Marks1 FROM Student WHERE Name = ‘Monica Rana'; Output: +—————+——–+ | Name | Marks1 | +—————+——–+ | Monica Rana | 94 | +—————+——–+ 1 row in set (0. 00 sec) What if Ms. Sujata wants to change the name and marks both at the same time? Multiple columns can also be updated at one time. The following statement changes the name to â€Å"Chhavi Chanana† and Marks to 90 for the roll number 15. mysql; UPDATE Student SET name = ‘Chhavi Marks1= 90 WHERE Rollno = 15; Output: Query OK , 1 row affected (0. 8 sec) 244 INFORMATICS PRACTICES Chanana', Chapter-9 MySQL DELETE STATEMENT Sometimes students leave school or an employee leaves an organization. Their rows have to be deleted from the table. Deleting data from a table is very simple. DELETE statement is used to delete rows from a table. DELETE removes the entire row, not the individual column values. Care must be taken while using this statement as accidentally important data may get deleted. Syntax: mysql; DELETE FROM ; tablename; [ Where ; condn;]; One of the students with Roll number 14 has left the school and Ms. Sujata wants to delete his/her row. She uses the following statement to delete the row with roll number 14. mysql; DELETE FROM Student WHERE Rollno = 14; Query OK, 1 row affected (0. 03 sec) DELETE statement can be used to delete all rows of the table also . The following statement can be used to delete all the rows from Student table. ysql; DELETE from Student; mysql ; Select * FROM Student; +——–+———+——–+——-+ |Rollno | | Name | | Gender |Marks1 | | | | +——–+———+——–+——-+ +——–+———+——–+——-+ 0 row in set (0. 01 sec) Know more The MySQL databas e management system contains an enormous amount of functionality and power. Using a simple set of statements for inserting, retrieving, deleting and updating data, we can develop quite a useful set of databases and tables. To learn more about MySQL you may visit the website: http://www. mysqltutorial. org INFORMATICS PRACTICES 245 Chapter-9 MySQL Summary 1. 2. 3. 4. 5. 6. 7. 8. CREATE DATABASE statement is used to create a new database. CREATE TABLE statement is used to create a new table. INSERT INTO statement is used to insert a new row in a table. The SELECT statement is used to fetch data from one or more database tables. SELECT * means display all columns. The WHERE clause is used to select specific rows. The DESCRIBE statement is used to see the structure of a table. We can change the structure of a table ie. add, remove or change its column(s) using the ALTER TABLE statement. The keyword DISTINCT is used to eliminate redundant data from display. a) Logical operators OR and AND are used to connect relational expressions in the WHERE clause. Logical operator NOT is used to negate a condition. 9. 10. (b) 11. The BETWEEN operator defines the range of values that the column values must fall into to make the condition true. The IN operator selects values that match any value in the given list of values. % and _ are two wild card characters. The percent (%) symbol is used to represent any sequence of zero or more characters. The underscore (_) symbol is used to represent a single character. NULL represents a value that is unavailable, unassigned, unknown or inapplicable. The results of the SELECT statement can be displayed in the ascending or descending order of a single column or columns using ORDER BY clause. UPDATE statement is used to modify existing data in a table. DELETE statement is used to delete rows from a table. 12. 13. 14. 15. 16. 17. 246 INFORMATICS PRACTICES Chapter-9 MySQL Multiple Choice questions 1. Which statement is used to extract data from a table? A. B. C. D. 2. SELECT DISPLAY READ EXTRACT How do you select all the columns from a table named â€Å"Employee†? A. B. C. D. SELECT [all] FROM Employee; SELECT Employee; SELECT * BY Employee; SELECT * FROM Employee ; . How do you select a column named â€Å"IName† from a table named â€Å"Inventory†? A. B. C. D. SELECT Inventory FROM Iname; DISPLAY Iname SELECT Iname FROM Inventory; FROM Inventory; SELECT Iname, Inventory FROM Iname; 4. Which of the following are valid column names? A. B. C. D. Marks Eng 66_Marks Marks_Eng #Eng_Marks 5. SELECT statement can be use d to perform these functions. A. B. C. D. Insert rows into a table. Choose and display columns from a table. Modify data in a table. Select and display structure of a table INFORMATICS PRACTICES 247 Chapter-9 MySQL 6. Which statement is used to insert new data in a table? A. B. C. D. ADD RECORD INSERT RECORD INSERT INTO INSERT ROW 7. How would you display all those rows from a table named â€Å"Friends† where the value of the column â€Å"Hobbies† is â€Å"SWIMMING† A. B. C. D. SELECT ALL FROM Friends WHERE Hobbies IS ‘SWIMMING'; SELECT * FROM Friends WHERE Hobbies='SWIMMING'; SELECT * FROM Friends WHERE Hobbies = ‘Swimming† ; SELECT ALL FROM Friends WHERE Hobbies ‘SWIMMING' ; 8. Which statement is used to modify data in a table? A. B. C. D. CHANGE MODIFY UPDATE SAVE AS 9. Which SQL statement is used to delete data from a table? A. B. C. D. DELETE DROP TRUNCATE REMOVE 10. How do you select all the rows from a table named â€Å"Student† where the value of the column â€Å"FName† starts with â€Å"G†? A. B. C. D. SELECT * FROM Student WHERE FName LIKE ‘G_' ; SELECT * FROM Student WHERE FName='G'; SELECT * FROM Student WHERE FName LIKE ‘G%' ; SELECT * WHERE Student WHERE FName='%G%' ; INFORMATICS PRACTICES 248 Chapter-9 MySQL 11. The OR operator displays a record if ANY of the conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true A. B. False True 12. Which keyword is used to return only different values in a column? A. B. C. D. DIFFERENT EXCLUSIVE DISTINCT UNIQUE 3. Which SQL keyword(s) is/are used to sort the rows in the output: A. B. C. D. SORTED ORDER SORT SORT BY ORDER BY 14. How would you return all the rows from a table named â€Å"Item† sorted in descending order on the column â€Å"IName†? A. B. C. D. SELECT * FROM Item SORT ‘IName' DESC; SELECT * FROM Item ORDER BY IName DESC ; SELECT * FROM Item ORDER IName DESC ; SELECT * FROM Item SORT BY ‘IName' DESC ; 15. How can you insert a new row into the â€Å"Store† table? A. B. C. D. INSERT (1,'Abc Rice') INTO Store; INSERT VALUES (1,'Abc Rice') INTO Store ; INSERT INTO Store VALUES (1,'Abc Rice'); ADD ROW Store values(1,'Abc Rice'); INFORMATICS PRACTICES 249 Chapter-9 MySQL 16. Which statement is appropriate to change the first name â€Å"Madhur† to â€Å"Mridul† in the â€Å"FName† column in the ‘Student' table? A. B. C. D. UPDATE Student SET FName='Mridul' WHERE FName='Madhur' ; MODIFY Student SET FName='Madhur' INTO FName='Mridul ; UPDATE Student SET FName='Madhur' INTO FName='Mridul' ; UPDATE Student SET FName='Madhur' WHERE FName='Mridul' ; 17. How can you delete the rows with marks below 33 in the ‘Student' Table? A. B. C. D. DELETE FROM Student WHERE marks

Friday, August 30, 2019

A Rose for Emily: Themes

Miss Emily Grierson is a character that stands out in the minds of most Americans.   Almost all American Literature teachers and professors have assigned A Rose for Emily by William Faulkner to students for generations. The story of Miss Emily has enthralled readers to the point that most will never forget her or her story.They feel sorry for her because they see a woman so greatly by her society that she is driven to do appalling acts.   Faulkner captures his readers with three major themes of obsession, changes in the community, and the setting of the time period.Obsessions can be dangerous and in the story A Rose for Emily obsessions lead to death and destruction.   Her father and society have destroyed Miss Emily.   Her father is obsessed with preserving his daughter from the world.None of the young men were quite good enough for Miss Emily and such. We had long thought of them as a tableau; Miss Emily a slender figure in white in the background, her father a spraddled si lhouette in the foreground, his back to her and clutching a horsewhip, the two of them framed by the back-flung front door. (Faulkner)He was so fixated on keeping her to himself that he ruined the chances of her finding love and marriage, which is what society expected her to do to Society was also obsessed with the idea that all women should marry and become the property of her husband.So when she got to be thirty and was still single, we were not pleased exactly, but vindicated; even with insanity in the family she wouldn't have turned down all of her chances if they had really materialized. (Faulkner)Miss Emily had lost her chances and was beyond retrieving them by the time that her father died.   She was a woman without a man to take care of her, which was an obsession of society.The people of the town feel sorry for her because she has not married, yet when she starts to see Homer Baron, the Yankee day laborer who is passing through the town due to a job, they criticize Miss Emily because of the way that she conducts herself.   Because of their view of the obsession, she could do no right.Times change and there is nothing that anyone can do about it.   However, there are always those who get left behind when times do change.   Miss Emily is a perfect example of a person who is left by time.   She cannot understand that the names that were once so prominent are now just names in the history of the town.   The former mayor who had remitted her taxes because of her family name did not have the same values of the new generation.When the next generation, with its more modern ideas, became mayors and aldermen, this arrangement created some little dissatisfaction. On the first of the year they mailed her a tax notice. (Faulkner)The new generation wanted to confront her when a rancid smell developed at her home, but the older alderman opposed them, who were still dictated by the august names.   Had the newer generation been allowed to investigate, a murder might have been solved and justice served.The setting and time period was explored by Faulkner as one who lived in the culture.   The setting is Jefferson Mississippi, which is in the Deep South during the early part of the twentieth century.   The south is known for its chivalrous society.   These ways may seem romantic, but it can also lead to some being held back.Miss Emily was a perfect example. Her life was dictated to her by this society that was still reeling from the Civil War.   In the early twentieth century south when family names were important, laws were overlooked just because of who a person was.   Miss Emily was not expected to pay taxes, did not have to follow health codes when it came to the smell that developed at her home, and she was sold arsenic without signing for it just because of who she was.A middle or lower class person would not have gotten away with any of the things that Miss Emily did. Had it been someone rather than Miss Emily, Home r Barron would still be alive and if she had somehow still managed to murder him, she was have been caught and brought to justice.Miss Emily would not have been so condemned by her society when Homer left her, but since it made her feel that she was less of a person, she felt that she had to make him pay.   Even though southern society is not something that everyone can identify, A Rose for Emily makes the reader evaluate the society in which they live.

Thursday, August 29, 2019

Marketing Managment Essay Example | Topics and Well Written Essays - 2000 words

Marketing Managment - Essay Example Today’s world of marketing is filled with a lot of competitors. For identifying about the competitive strategy, it is essential to depends on the environmental scanning, a concept derived from Business Management itself. For ensuring the competitive advantage, it is necessary to make certain variation in to the strategies and relevant policies maintained by the business concern. Environmental scanning is a perception about the external environment, which provides a considerable idea to the management authority of an entity to take the most appropriate decisions relating to the business in ensuing future. This scanning is beneficial for analyzing various opportunities, attaining the sustainable competitive advantage and also to accomplish various goals of the entity. The prediction of environmental factors is uncertain; then there should be a tendency to undertake more scanning. In addition to the scrutinization of environmental performance, it is necessary to examine the strategies of the organization also; it will lead towards the organizational scanning. While undertaking the scanning of an environment, it is necessary to collect various in formations affecting the marketing areas. But on the other hand, in case of organizational scanning, number of information is available, but stress should be given only for own sources of the entity. Both these in formations or sources so collected are utilizing for developing the strategic plans. In addition to this, as far as the scanning procedure is taken in to consideration, the top level managers are undertaking the scan concept than the operational or bottom level managers. While undertaking strategic planning, it is essential to conduct both internal and external analysis. Environmental scanning is an important external analysis concept, which is necessary to evaluate the

Wednesday, August 28, 2019

Argue whether or not paying students for good grades is the best Essay

Argue whether or not paying students for good grades is the best motivational tool - Essay Example This means that the school and educational system should seek appropriate ways for motivating their students. In some instances, parents and school provide money for good grades. Intrinsic motivation is the best approach of motivation among students since it promotes self-drive and hard work, qualities which are beneficial for the life of a student in the long term. Grades should reflect the intrinsic values of education and learning. This means that education and learning should not be viewed as work that requires payment after the accomplishment of agreed objectives. This does not mean that education is not tied to work. Education is tied to work because it leads to work that rewards on monetary basis (Rosenbaum 4). Though money for grades is a motivational tool, it is not an effective motivational tool because it is not based on the actual capabilities of the student. In addition, the monetary value attached to grades is not relative to the nature of the examination. This is becau se examinations are not standardized and they vary with years or school sessions. Money for grades diminishes the real value of the educational system. In this case, students do not study with the aim of gaining theoretical experiences, but they study with their focus on the examination. The student do not prepare adequately for class work, and in most case, they do not participate in schoolwork (Rosenbaum 7). There only focus in the school environment is to pass the examinations and not to gain the aspects of education that can create an effective platform for their education. Paying student for good grades should be discouraged since it may lead to cheating. In the scenario that parents or other stakeholder resort to give monetary rewards for students in order to encourage good grades, the students will link academic success with financial incentives (Wiseman and Hunt 62). For instance, a parent may give $10 for As, $5 for Bs and $3 for Cs (Rosenbaum 2). In average, students who t hen keep their grades above 90 earn the equivalent of $15 each month (Ivanova 1). This will have a detrimental effect on the students since it will influence the learning process negatively. The students will be preoccupied with attaining the financial incentive. This may lead to frustrations for the students when they do not achieve the required threshold in their academic work. In such instances, the student may resort to shortcuts in order to enhance their academic performance. This urges may encourage cheating in order to achieve good grades. This will impede the learning process rather than encourage the child to acquire new knowledge. This means that children should be encouraged to seek academic success intrinsically as opposed to external motivations like cash rewards (Wiseman and Hunt 62). Students who are intrinsically motivated to study will be able to achieve good grades without cheating. These students will be aware that the skills learned in school are essential for th eir future in the society and career wise. Therefore, if cash incentives are involved, the student’s motivation will be blurred and it will be majored on financial incentives. Offering financial rewards for good performance will have a negative effect on the values of the student. Education has the role to shape the morals and values of an individual. This means that a student should be able to pick positive behaviors and

Tuesday, August 27, 2019

Exit strategy in monetary economics Essay Example | Topics and Well Written Essays - 750 words

Exit strategy in monetary economics - Essay Example It emphasizes on the significance of the models in determining the uncertain future expectations by incorporating the current macroeconomic outlook. Primarily, the general equilibrium of the model presents the connection between the agents’ behavior and policy action (25). Similarly, the comprehensive specification of the stochastic shocks contributes to the economic fluctuations that facilitate the identification of the transmission of the shocks to the economy (23). The monetary policymakers employ the dynamic stochastic general equilibrium models in conjunction with other statistical tools to determine policies quantitatively. The main characteristic of the DSGE models is the generality in nature. The implication of the general nature of the DSGE is evident in prices and interest rates. In effect, the price and interest rate tend to adjust to the point where the supply and demand in a given market become equal. For instance, the demand of services equals the supply of the same. Similarly, the incorporation of the random components in the model is critically significant in expounding on the cyclical patterns of the economy. The common behaviors in the economy encompass shocks that affect the patterns of financial markets and adjustments in the economic production (28). In turn, the shocks influence the efficiency of production. The dynamic stochastic general equilibrium models estimate the shocks, as well as the proportions adjustments in economic activity that emanate from certain market disturbances. For instance, the models can be crucial in assisting the economists to decipher the nature of the shocks during economic downturns. Notably, the DSGE models can offer answers to the recent economic recession by determining whether the economic downturn was due to financial or fiscal shocks. The supply and demand blocks, as well as the rate, comprise the structure of DSGE models. The central banks employ the models to

Monday, August 26, 2019

Bauhaus School Essay Example | Topics and Well Written Essays - 1000 words

Bauhaus School - Essay Example After an introduction into color theory, students commenced specialized workshops that included metal work, cabinet making, pottery, weaving, typography and wall painting. Bauhaus faced financial challenges that made some aspects of unifying art through craft impractical. To counter these challenges, Gropius repositioned Bauhaus goals in 1923 in order to operate on mass production of art designs. Following the repositioning, the company acquired a new slogan, ‘Art into industry’, to stress the benefits of ass production. In 1925, Bauhaus relocated from Weimar to Dessau where he designed a new structure to accommodate the school. The building had state of art facilities and features, making it a hallmark of modern art and architecture. Modern architecture included steel-frame structures, glass curtain walls, and asymmetrical pinwheel plan. Through these structures, Gropius distributed classrooms, studios, and administrative spaces in order to maximally utilize the availab le space. The cabinet making workshop was a main creation at the Bauhaus. Under the management of Marcel Breuer, the studio designed and produced furniture by dematerializing conventional forms such as chairs in order to develop creative furniture. Breuer used the theory that eventually, all chairs would become obsolete, replaced.. He was inspired by his bicycle’s steel tubes to experiment with metal chairs, leading to creation of light-weight metallic chairs. Some of the metallic chairs were used in the theatre.

Sunday, August 25, 2019

Advantages and Disadvantages of Using Emissions Permit System Essay - 1

Advantages and Disadvantages of Using Emissions Permit System - Essay Example A broad spectrum of concerned individuals and corporations are in agreement over one basic fact: a price-tagged emission of global-warming greenhouse gases is an idea whose time is ripe. Whether not available for now, legal, binding pricing mechanism on the use of traditional fossil fuels seems all but inevitable in the 21st century. Nevertheless, pricing carbon emissions remain in dispute among policymakers and academics voicing backing to the old command controls. Evidently, nations only possess limited experience with the cap-and-trade system in controlling greenhouse emissions. This paper endeavors to highlight the intrinsic worth and costs of implementing a cap and trade policy in pollution abatement. Emission trading permits with a pricing scheme on carbon usually strives to achieve two interrelated but beneficial ends: discouraging— with increasingly inhibitive economic costs — the use of traditional sources of energy such as oil, natural gas and coal, to inspire the development of innovative renewable sources of energy that are less costly to the environment (Wills, 2006). Cap-and-trade policy instruments place progressive harsher limits on the usage of fossil fuels by conditioning pollution limits from industrial power plants among other major emitters of greenhouse gases through licensing. Extra emissions above the prescribed limits are surcharged prohibitively. In contrast to the traditionally regulatory command models that were rather rigid with regards to the requirements specified outcomes irrespective of the costs incurred, the prohibitive costs in cap and trade systems provide the needed incentives to either shift to the best alternative sources or to make more than necessary steps for compliance.

Saturday, August 24, 2019

International Business Essay Example | Topics and Well Written Essays - 500 words - 2

International Business - Essay Example that are very well suited to the regions they operate, the cultural difference in different in different nations may not be found with the small business enterprise as we see in with large companies with high volume of operations. Create logistic support for the small companies or enable them to use the economical logistic resources with funding their activities through the public owned means of transport. Liberalization of aviation policies for transport among the regional trading block countries. The governments should form forums and communities for developing the multinational business etiquettes and cultural knowledge to enable the small companies’ leadership team to be more constructive in enhancing the business terms. Governments should provide consulting advisory boards on the industries, functions specific to enhance the knowledge about the opportunities for the small companies with respect to business volumes, clientele and consumer

Special education student placement Essay Example | Topics and Well Written Essays - 500 words

Special education student placement - Essay Example the students with disabilities attend the same schools as their grade peers in that the education programs seek to serve all the students as a single unit regardless of the needs of individual students. Inclusion classrooms have no major difference with the conventional general classroom with the only notable difference being in the individualized support given to students that require special needs. Inclusion provides a chance to students with disabilities to interact with their non-disabled peers. There are several advantages for adopting this placement over others: This is the exact opposite of the inclusion class, whereby students with disabilities are provided with individualized education programs. This is done in separate classes from other students and, therefore, allows their teachers to work and monitor these students closely (Katz and Mirenda 2002). This is a classroom where students with special needs spend a part of their class time receiving more individualized attention and help away from their general classrooms. In this placement, it is assumed that the students receive primary instructions from the general class while they receive their supplementary instructions from the resource room Katz and Mirenda 2002). Patterns of learning and development- This refers to the student’s academic ability level and needs. Teachers and parents alike should formulate a way in which the student best receives academic information. Cultural and linguistic factors- it is important to avoid stressing students with disabilities may suffer more if placed amongst other people of contradicting culture and language as theirs. It is, therefore, important to consider having their placement in an area or school that has a familiar culture to theirs (Gartner and Lipsky 1987). In order to achieve successful integration of students into the placement programs discussed above, parents and teachers should collaborate to make proper decisions. Factors such as their cultural

Friday, August 23, 2019

Create a Security Policy Essay Example | Topics and Well Written Essays - 500 words

Create a Security Policy - Essay Example Keeping of the customers’ information and records will be the major responsibility of the workers. The security and loan application will cover a number of portions in the company. This are; The physical control of the customers in the company will be solved by the introduction of the electronic cards for withdrawal and access purposes. In doing so, security will be enhanced by controlling the members from having access to the wrong places at the company. If a member will be caught violating the rule of accessing unauthorized areas, he or she will be dealt with in relation to the rule of non compliance. If any of the electronic cards is lost, stolen or contain wrong key, it will be deactivated immediately by the database management system. This will be followed by the issuing of a new card replaced with the lost card and all the information be recorded down for security purposes. The company is supposed to collect all the important information from a customer in the application of the online application of loans. Some of the important information to be collected is financial statement of the customer, the current loan state of the customer, the credit report of the customer and the property owned information of the customers. All this should be well documented and be recorded in the financial files of the customers. The information recorded in the financial file should be kept off from fire, theft, flood and lightning. For the proper maintenance and retrieval of the company’s vital information, the database must be backed up periodically incase of data loss. Access of the customers’ accounts should be well managed and be maintained. This will be done by creating protective ways that are very sensitive. The passwords should be unique mixed with other valuables along with the encryption. Users will be assigned with a confidential

Thursday, August 22, 2019

Regulation and Criminal Liability Essay Example for Free

Regulation and Criminal Liability Essay Currently in the United States, the Americans continue to face unfair treatments of health care professionals within the work place. Regulates and laws have been created and set forth to help individuals’ feel protected and to know their rights as a victim of such criminal acts. People deserve to be treated with respect, especially in the care of health professionals. In this paper will contain information on criminal liabilities of health professionals and show people who may have been violated by health care providers the steps of filing a civil complaint. In addition, the paper will go into investigating allegations and disciplinary actions. Up-to-date regulatory policy regarding health care professionals is based on the speculation that the market for resources in health care is unsuccessful because consumers do not have complete facts about the nature of services these professionals offer. The outcome of some professionals possibly will exploit consumers on the condition lesser-quality services. The theory of economics proposes that in the absence of order, many health care professionals might offer minimum quality services at expensive quality prices to uneducated consumers. Therefore, the main justification for managing health professionals is to expand the quality of their services and to guard the interests of unaware health care consumers. Health care professional guidelines restrict access into the profession by setting the least possible measures of education and experience mandatory to practice. Furthermore, those regulations identify the legal acceptable boundaries of training for the health care provider or the permissible scope of health care professionals training and state the permitted business training of health care professionals. In the United States the federal system of government, regulates every states health care professional practice. Health professional training performances are statutory laws that create regulatory or licensing agencies or boarding to promote rules that order medical  practice. State licensing laws initiating the lesser level of education and experience needed to practice, explain the roles of the profession and bound the act of these roles to licensed individuals. State occupation practice limits restrictions on the services of professionals by for-profit firms, limitations on the operation of trade names, restrictions on the process of numerous workplaces, and boundaries on the place of health care professionals workplaces. Earlier in 1977 state companies practice limitations on frequently incorporated restrictions on marketing by professionals. Principles of Medical Ethics, the American Medical Association (AMA) declare a physician shall obey the law† and â€Å"record doctors’ insufficient in character or ability, or engaging in deception or fraud. AMA could refuse membership to doctors guilty of criminal activity, in addition to physicians charged with crimes in different countries. Reference to petition for licensure, the Federation of State Medical Boards, in connection of state medical boards’ responsibility for punishing physicians, suggests that every state medical board run criminal record review as part of licensure application practice and all candidates with a criminal background, comes before the committee for questioning to examine the candidates ability for licensure. AMA recognizes that doctors can be criminally arraigned merely to the degree of statue, and these regulations unlike state to state. Although illustrations from our data demonstrate the regular ordinary sanctions by state medical boards after the doctors have been criminally found guilty. According to AMA recent data less than 80 percent of doctors who carried out sexual acts offenses the physicians’ licenses would be revoked, suspended, or surrendered. Merely 53 % of doctors convicted of criminally possessing, using, or prescribing controlled substances and only 40% of doctors were guilty of criminal wrongdoing connected to the practice of medicine had their licenses surrendered, revoked, or suspended. The statistics show a system that permits questionable physicians to remain practicing medicine after displaying clear unethical and risky behavior. If an individual thinks that a health care provider, local or state government agency, has discriminated against he/she based on national origin, race, age, or disability, one can file a civil rights complaint. OCR can examine disability-based discrimination complaints against programs ran by HHS. Below certain regulations and statue, OCR has  slight authority to explore complaints of discrimination based on religion and sex. If an individual believe his/her health care provider moral safety rights have been breached, individuals can file a complaint with OCR. The Case Resolution Manual for Civil Rights Investigations (CRM) offers OCR managers and staff with the strategies and process designed to effectively and promptly investigate, evaluate and settle compliance and complaint evaluation, and to implement violation locations where guaranteed. When filling a complaint an individual have to follow the complaint requirements and that is followed by: (http://www.hhs.gov) Be filed in writing, either electronically via or paper the OCR Complaint Portal, by email, fax, or mail. Social service provider or health care provider involved, and describe the acts or omissions, that one believed over stepped the civil rights regulations or law. Must be filed in 180 days of when the omission complained of or act occurred. OCR could prolong the 180-day period if individual can provide a worthy reason. In conclusion individuals need to educate themselves on the laws which supposed to protect them from mistreatment of any health care provider and learn the appropriate ways to handle the situation in case of becoming a victim to any type of neglect or abuse. Physicians’ and nurses should follow the quality standards. Patients are treated with kindness, dignity, compassion, respect, honesty and understanding. References Article in Health Matrix: United States Physicians’ Disciplined for Criminal Activity, Retrieved on April 22, 2014 from: http://www.citizen.org/page.aspx?pid=696 Principles of Medical Ethics, Retrieved on April 22, 2014 from; http:// http://www.ama-assn.org/ama/pub/physician-resources/medical-ethics/code-medical-ethics/principles-medical-ethics.page United States Department of Health and Human Resources, Retrieved on April 22, 2014 from: http://www. hhs.gov/ocr/civilrights/complaints/index.html#file Wilson,D., The Regulation of Health Care professionals other than Physicians, Retrieved on April 22, 2014 from;

Wednesday, August 21, 2019

Issues Of Deviance And Social Control Sociology Essay

Issues Of Deviance And Social Control Sociology Essay Deviance is a term used by society to define behaviors that differ from the everyday social norm, this means that majority of people in a society must agree or conform to a certain action or behavior. In 1906, William Sumner came up with the concept to categorize norm into three different groups: folkways, mores, and laws. He defines folkway as the simple day-to-day norm which was based on customs, traditions and mannerisms. If one were not to follow the way of folkway norm it would probably cause others to believe that they are strange or abnormal but would not cause fury. Typical folkway norms include style of dressing, character, physical distance or closeness with others, and eating patterns. Moving on, mores are norms which reflect wide-ranging social ethics. Interracial marriage, having an illegitimate child, and abusing drugs and alcohol would violate the mores laws and would cause a havoc and produce more serious social denunciation. Being in an interracial marriage may make one seem racially impure, bearing an illegitimate child can threaten social definition of a marriage, and abusing or being addicted to drugs and alcohol shows victory of hedonism over prudence. Those who dont comply with mores norm may seem sinful, and set themselves up as a potential threat to society. Furthermore, the laws norm is the strongest custom out of the other two norms. This is because it is backed up by codified social approval. Those who infringe this norm are punished in ways ranging from a fine to imprisonment. Although one may break laws and regulations, it wouldnt necessarily label the offender as deviant. With this said, deviance and crime can respectively fall into one category. Consider this, if certain individual decides to burglarize or vandalize someones property, or even causing harm to another being, it considered both deviant and a crime. Also, there are many other deviant acts that are not considered criminal, such as being over or underweight, being physi cally or mentally handicapped, being in an interracial marriage, and having an illegitimate child. To restate a prior point, these can be considered deviant because although it is not considered a crime, it violates the norm accepted by society. With that said, we can consider crime and deviance as overlapping categorizes with its own individual magnitudes. Attitude, behavior, and condition are the ABCs of deviance. People may be labeled deviant based on their attitudes or belief system which includes religion, political views and beliefs in the supernatural. Having a mental sickness can also fall into the deviant category. The B in the deviant ABCs stands for behavior which people are the most familiar with. Deviant behavior can happen intentionally or unintentionally, for example, one might unintentionally violate a dress-code, or a couple may intentionally engage in bizarre sexual activities, or one may commit murder. Lastly, the C stands for condition. Those who are considered d eviant because of their condition probably acquired it from birth such as being born un-wealthy, being a person of color in a mainly Caucasian dominated community, being born physically handicapped, or being height deviant. In this case, the individual has done nothing wrong or taken any negative actions to be labeled deviant; this also makes it almost impossible to change their deviant status. Although some actions that an individual chooses to take will be universally labeled as deviant behavior, others are judged strictly based on social customs. Heckerts idea of positive deviance would primarily refer to engaging in less selfish actions and more devotion toward the society. Heckert has defined many different ways in which positive deviance is evitable such as altruism, pacifism, cooperation, temperance and many more. Altruism is one of the most cherished form of positive deviance because it brings out the loyalty. All the martyrs fall under this category as they sacrificed themselves for their nation and they can never be forgotten. Those who spread the sign of peace throughout the societies also fall under positive deviance such as Gandhi. Positive deviance is clearly evident in every community where certain individuals or groups are more successful than other when everyone has received same resources but the approaches were different. Positive deviance is how successfully a person, a group or a community move forward to a better future and creates an example for other. Societies require positive deviance so they could move on with the rest of the world. Example of positive deviance could be to move forward and stop child labor in developing countries and putting them in a school for education. Labeling theory which is also known as social reaction theory suggests that deviance is not an inherit to act instead its the people who obtain labels from how other view their tendency or behavior. Its the society that makes the criminals by keep being either unfair or by false accusations. Suppose a person does commit a crime under very difficult circumstances and later on gets the label of a criminal will have negative effect on his personality and this person will be always considered as a criminal. If the society has choose to consider a person dangerous for reasons such as past criminal record or the color of his/her skin than perhaps it wont be any harder next time for this person to commit crime. Our societies also look for auxiliary traits within a position or career. For example, a doctor is consider as an white male, upper middle class and more. On other hand, black people were more attached to criminal activities and those who turned out to be doctors were hard to believe by the society because they were never seen in that form. Basically , an individuals past action create or shape his/her future and this lacks the fairness in sense this person could have adopted better human traits. Students who study deviance should not make an assumption if the person is actually a criminal or broken rule because the process of labeling may not be infallible. According to the conflict perspective, deviance is a social creation and the power structure in any society defines what to be consider normal and what is not. So basically there is no such thing as human nature, hence deviance is the creation of the social structure rather than something build into our nature. On the other hand, functional deviance approach believes that its the majority members of the society who defines what is normal and what is not. Both approaches look at the society as a whole rather than on individual level. Conflict theory mainly defines societies made up of powerful or powerless. Powerful has no right to be in power but manipulates other convince public about their legitimacy. This can be related to Durkheims state of anomie. Anomie is the result of collective conscious being collapsed. In this situation, people tend to look away from fundamental social expectations and solely focus on their self-interest. The long term collapse of order and harmony in both approaches are harmful to the society. In conclusion, Human norms refer to the set behavioral standards on which human are supposed to act. Deviance is a study that helps understand the reason behind violation of human norms. There is not one particular answer that is enough to justify human norms violation, hence many sociological scholars have presented different set of theories that can help us understand deviance with broad perspectives. Some of the scholars that have played tremendous part in understanding deviance are Erikson, Hackerts and lastly the father of Sociology Emile Durkheim. Deviance will be present no matter how perfect the society is, as Durkheim explained about the society of saints which is perfect but the identification of deviance level would be so high that even smallest error can be regarded as a strong disapproval from the society.

Tuesday, August 20, 2019

Stem Cell Research and Utilitarianism

Stem Cell Research and Utilitarianism Janelle Akomah What if there was an opportunity to develop a cure for diabetes, HIV, or cancer? However, in order to achieve such a task, research and manipulation of embryonic cells are required. One may question the viability of the cells and if the embryos or fetuses are regarded as human lives. Stem cell research advances the knowledge about how an organism develops from a single cell and how healthy cells replace damaged cells in adult organisms. This paper will focus on the support of stem cell research and its importance in the future of medicine. Stem cells are undifferentiated cells that and renew itself and differentiate to yield some or all major cell types of tissues or organs. The potential in regenerating or manipulating stem cells for future treatment of genetic conditions or chronic diseases is profound and is needed for treatment of medical conditions. Utilitarianism is the theory of justice that is supportive of stem cell research. The foundation of this theory is â€Å"the great est happiness† principle. The lives that can be saved are immeasurable. But what about the embryos and fetuses that are destroyed in the process? If embryos are considered lives, stem cell research can be essentially considered as murder. The primary objection that may apply is that utilitarianism makes no room for individual rights. Sacrificing the life of one to save millions may be worth it and this paper will state the major points of support for stem cell research. Stem Cell Research Controversy Stem cells are undifferentiated cells in tissue that serve as an internal repair system that divide to replenish other cells within the body. These cells are capable of renewing themselves through cell division and can divide and repair damaged or worn out tissue. Human embryonic stem cells are stem cells that are derived from human embryos. Stem cells are able to divide and renew themselves for a long period of time, unspecialized and can give rise to specialized cell types (US Department of Health and Human Services, 2009). Current research of stem cells includes controlling cell proliferation and differentiation through identification of how undifferentiated stem cells convert to differentiated cells that form the tissues and organs. Then controversy in stem cell research involves the creation, usage, and destruction of embryos. Creation of human embryo stem cell line requires destruction of the human embryo. At Harvard University, researchers attempted to transfer the nucleus of a somatic cell into an existing embryonic stem cell to create a new stem cell line. The ethical issue of manipulation and destruction of the human embryo and its stem cells center the debate on stem cell research. The pro-life movement is stemmed from the concern of the rights and status of the embryo as human life. Until recent years, stem cell research included removing tissue from an aborted embryo to get material to evaluate and study. Researchers are now reverting to obtain and manipulate pluripotent stem cells without th e use of embryos. In the past, ethical issues of scientific research on aborted fetuses did not justify medical benefits. Researchers began evaluating embryonic stem cells because they represent the earliest stage of later cell lineages and provide information on how development of tissues arise and treatments to cure or prevent chronic diseases (Robertson, 2010). Those against embryonic stem cell research believe that fertilized eggs used in the laboratory are human beings or individuals with rights, moral and legal statuses of fully born persons. These individuals view destruction of embryos as murder or a sacrifice of the weakest for the interest of others. Those that support stem cell research do not view embryos to have interests or rights and should not be protected at the cost of scientific research. They also do not believe that fetuses develop any neurological capacity to feel pain. Support of Stem Cell Research Stem cell research has the potential to save millions of lives and give a new start to those that may have been threatened by chronic and/or fatal conditions. The conditions considered for potential cures include spinal cord injuries, multiple sclerosis, diabetes, Parkinson’s disease, cancer and Alzheimer’s disease. The possibility of reversing the effects of aging and prolonging life is beneficial for those who are interested. It may also increase the quality of life among many individuals. It is difficult to determine if embryonic stem cells are considered human life. So why not research the early stages of human development to facilitate medical advances for mankind? If we can improve the quality of life for individuals with chronic conditions by exploring the use of embryonic stem cells, why not research them? There can be a comparison of stem cell research of embryonic stem cells to that of individuals in the military. People are recruited, trained, and deployed to protect the country from harm or terror. In the end, it is all done for the greater good and to save lives. In stem cell research, embryonic stem cells are researched by manipulation or destruction to develop a stem cell line or cure for many progressive and fatal chronic conditions. This research is done to provide a line of defense against diseases that are harmful to the human being. When we look at the two examples, although different approaches, the overall goal is to protect the human race. I look at stem cell research as a way to protect human life against many harmful invaders that decrease the overall quality of life and may cause death. Utilitarianism It is known as the â€Å"greatest happiness† principle and utilitarianism argues that justice is maximizing individuals’ happiness and minimizing pain. John Stuart Mill, an English philosopher, stated acts should be considered as morally right or wrong if the consequences are of significance that an individual would wish to act in a preferred manner (West, 2012). These actions support the greater good for the greatest number. Utilitarianism defines morality as the maximization of total net expectable utility for individuals affected by an action or decision. There were multiple philosophers of utilitarianism including John Stuart Mill and Jeremy Bentham. Both philosophers proposed this theory as a form of consequentialism which states that consequences are the ultimate basis for judgment about right or wrong conduct. Bentham stated that every moral argument should draw on the idea of maximizing happiness (Sandel, 2009, pg 32). He notes that the highest principle of mora lity is to maximize happiness and the overall balance of pleasure over pain. Bentham argued that every moral argument should draw on maximizing happiness (Sandel, 2009, pg 32). It is the foundation of moral and political life. When there is a choice to be made between actions, utilitarianism’s theory states that the choice with the greatest utility is the right choice. Utilitarianism can definitely be applied to the controversial issue of embryonic stem cell research. Research of embryonic stem cells is conducted to develop cures and treatments of chronic conditions for the greater good of the human race. When we look at the overall goal and purpose of stem cell research, we can determine it as a morally right consequence. This is determined because the research is conducted in search of a cure for diseases and a treatment course that will increase an individual’s quality of life thus increasing their overall happiness. The definition of justice can be considered as granting each person what they are morally due. Is it not fair to grant each individual a maximization of life and the most quality of life available? Stem cell research seeks to uphold that goal by looking for answers to a growing issue. Many people succumb to chronic conditions for various reasons. If cures or treatment plans that prolong the lifespan are developed, many lives will be saved and healthcare expenditures can decline. The costs for maintenance of diseases such as diabetes, heart failure, Alzheimer’s disease would decrease because if cured, there will be no need for maintenance. The Objection There is no room for individual rights when utilitarianism is in place. This theory explains justice as saving the most lives. If we look at stem cell research and utilitarianism, then this objection can apply. If embryos used in stem cell research are considered the beginning of human life, then we look at individual rights. There are none. The rights of the embryos that are manipulated and destroyed are not taken into account when looking at the overall purpose of stem cell research. The supporter of this objection states that everyone is created equally and no one individual is better or is worth more than another. There is question on how the individual is treated under the theory of utilitarianism. Non-supporters of utilitarianism state that each individual is counted as one on an equal basis; however, it fails to respect the integrity of each person (Seehy, 2002). The objection states that the overall function of the treatment of individuals contribute to the greater good which in turn reflects impartiality. How can the individual rights of embryos/fetuses be taken into account if they are manipulated and destroyed for the goal of researching a cure for a chronic condition? Is it fair to play God and pick and choose which embryo or fetus will be chosen for research purposes? Another example in comparison to stem cell research includes the controversial issue of abortion. If an embryo/fetus is considered the beginning of human life, could we not consider the destruction of them as murder? How are the individual rights of these embryos taken into account? With utilitarianism, they are not beca use the benefits of research outweigh the risks and harm of that individual cell. Is this a fair statement? Is the sacrifice of few worth the greater good of many? Response to Objection Rule – utilitarianism is a term that determines the right or wrongness by finding the best rule of conduct followed by the majority of society (Seehy, 2002). John Mill attempted to respond to the objection mentioned above by presenting a rule and stating that individual liberties should be respected. He mentions that there is room for personal commitments without having to give up everything to help others. Maximizing utility in the long run by respecting individual liberties will lead to the greatest human happiness (Sandel, 2009, pg 47). Is happiness the only thing that matters in response to the objection? In stem cell research, is the only thing that is important is the potential number of lives that will be saved? Happiness is not the only issue when evaluating utilitarianism and stem cell research. Healthcare costs of treatment plans for chronic conditions continue to increase. The potential for cures of chronic diseases from stem cell research can save millions. But why support stem cell research after stating the objection of individual rights? There has not been any research scientifically verifying human life beginning at the embryonic stage. So this research cannot be harming human life. Some individuals believe that morally stem cell research reflects the act of â€Å"playing God† and it is an act that destroys human life. To answer that statement, who is to judge that manipulation of cells is morally wrong? There is no evidence that human life is being harmed and individual rights are not being subjected to foul play. With this not only will happiness occur but the overall consequence reflects the stages it took to achieve an end. Basically, the ending is virtue. Supporters of stem cell research can see no wrongdoing in the act itself. The objection cannot really apply if human life has not been determined. Let’s look at rule-utilitarianism and apply it to stem cell research. Can we maximize utility over a longer period of time in stem cell research to make the topic acceptable? This means, is it possible to do research on limited number of cells over a period of time rather than all at once for the same ending result? Does this make the issue better and can maximum utility be achieved? Conclusion Stem cell research has been a topic of controversy for quite some time. Those who object the idea believe that there is manipulation and destruction of human life and murder is being committed. They believe that human life begins at the embryonic stage. In support of stem cell research, utilitarianism can be applied. Stem cell research seeks to achieve the greatest happiness and maximize utility by saving lives. The primary objection to this issue was the neglect of individual rights. However, if human life has not been determined, individual rights have not been compromised. In support of the greater good, stem cell research is needed in healthcare for medical advancement. References Robertson, J. (2010). Embryo Stem Cell Research: Ten Years of Controversy. Journal of Law, Medicine, and Ethics, 191-203. Sandel, M. (2009). Justice: Whats the right thing to do? New York: Farrar, Straus, and Giroux. Seehy, P. (2002). Doing the Right Thing (Part II): Challenges to Utilitarianism. Retrieved July 9, 2014, from The Richmond Journal of Philosophy: http://www.richmond-philosophy.net/rjp/rjp20_sheehy.php US Department of Health and Human Services. (2009, April 28). What are the unique properties of stem cells? Retrieved July 08, 2014, from Stem Cell Information: http://stemcells.nih.gov/info/basics/pages/basics2.aspx West, H. (2012). Utilitarianism. Retrieved July 4, 2014, from Encyclopedia Britannica: http://www.utilitarianism.com/utilitarianism.html