Featured Post
God of carnage Essay Example | Topics and Well Written Essays - 500 words
Divine force of massacre - Essay Example They would have most likely never met one another if not their children. The thing is on Novembe...
Sunday, November 10, 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, November 8, 2019
The primary purpose of the art essays
The primary purpose of the art essays The statement is truly an over simplification. That first thing that cannot be agreed to is that casting together of music, painting, drama and literature together. There that that convenient heading of calling them art they have little in common with each other. One of the purposes of music, painting and drama and literature may be entertainment but it is hardly justified to say that it is the main purpose In the world of music there are several sub worlds. There is music catering to the grossest of the tastes to the sublime and spiritual. Some musicians spend half their lifetimes learning to compose or play music properly. Is often in the later stages of their lives that they begin to play. To listen to some of them like Pundit Ravi Shankar or Yehudi Menuhin is nothing less than of music, which is composed, based on the popularity. They are composed based on the fads and following and quite often market surveys are conducted before recording. Such music may be called just entertainment, but certainly not all music. To call painting an entertainment borders on the ridiculous. Some painters have spent lifetimes in there lifetimes in there art and most often they paint without knowing whether their work will be welcomed by the public or just laughed at. Certainly artists do not mean to entertain, as most art shows are free. Perhaps we can point a finger at the artist to say that he is trying to make a living by painting to entertain as a main reason. Drama is certainly entertainment. But the question is , is it the mainly entertainment? To put a good play takes on enormous amount of energy and hard work. drama often makes a statement sometimes political sometimes societal. The playwrights, directors and actors want to say what they think world is as they see it. It is the joint expression of the souls of several people who have come together to express themselves. Of course it is entertainment to those who go to see the play. B ...
Wednesday, November 6, 2019
What Are the ICD-10 Codes for Diabetes Complete List
What Are the ICD-10 Codes for Diabetes Complete List SAT / ACT Prep Online Guides and Tips Have you come across a form of diabetes with an unusual presentation or a rare underlying cause? Luckily, the ICD-10 codes for diabetes cover every manifestation of the disease imaginable in very specific terms. In this article, I'll go through the full range of diabetes ICD-10 codes and provide some guidelines for how to use them appropriately in your medical records. What Are the ICD-10 Codes for Diabetes? These lists cover all of the ICD-10 codes for diabetes mellitus. You can use the following links to navigate to the codes you need depending on which type of diabetes you're looking for: Diabetes due to underlying conditions (codes that start with E08) Drug or chemical induced diabetes (codes that start with E09) Type 1 diabetes (codes that start with E10) Type 2 diabetes (codes that start with E11) Diabetes related to pregnancy (codes that start with 024) Other types of diabetes not covered by the previous categories (codes that start with E13) The more characters in the code, the more specific the diagnosis, so when writing a code on a medical record you should give the longest code possible while retaining accuracy. ICD-10 Codes for Diabetes Due to an Underlying Condition Diabetes mellitus due to underlying condition: E08 Diabetes mellitus due to underlying condition with hyperosmolarity: E08.0 â⬠¦Ã¢â¬ ¦ without nonketotic hyperglycemic-hyperosmolar coma (NKHHC): E08.00 â⬠¦Ã¢â¬ ¦ with coma: E08.01 Diabetes mellitus due to underlying condition with ketoacidosis: E08.1 â⬠¦Ã¢â¬ ¦ without coma: E08.10 â⬠¦Ã¢â¬ ¦ with coma: E08.11 Diabetes mellitus due to underlying condition with kidney complications: E08.2 Diabetes mellitus due to underlying condition with diabetic nephropathy: E08.21 Diabetes mellitus due to underlying condition with diabetic chronic kidney disease: E08.22 Diabetes mellitus due to underlying condition with other diabetic kidney complication: E08.29 Diabetes mellitus due to underlying condition with ophthalmic complications: E08.3 Diabetes mellitus due to underlying condition with unspecified diabetic retinopathy: E08.31 â⬠¦Ã¢â¬ ¦ with macular edema: E08.311 â⬠¦Ã¢â¬ ¦ without macular edema: E08.319 Diabetes mellitus due to underlying condition with mild nonproliferative diabetic retinopathy: E08.32 â⬠¦Ã¢â¬ ¦ with macular edema: E08.321 â⬠¦Ã¢â¬ ¦ without macular edema: E08.329 Diabetes mellitus due to underlying condition with moderate nonproliferative diabetic retinopathy: E08.33 â⬠¦Ã¢â¬ ¦ with macular edema: E08.331 â⬠¦Ã¢â¬ ¦ without macular edema: E08.339 Diabetes mellitus due to underlying condition with severe nonproliferative diabetic retinopathy: E08.34 â⬠¦Ã¢â¬ ¦ with macular edema: E08.341 â⬠¦Ã¢â¬ ¦ without macular edema: E08.349 Diabetes mellitus due to underlying condition with proliferative diabetic retinopathy: E08.35 â⬠¦Ã¢â¬ ¦ with macular edema: E08.351 â⬠¦Ã¢â¬ ¦ without macular edema: E08.359 Diabetes mellitus due to underlying condition with diabetic cataract: E08.36 Diabetes mellitus due to underlying condition with other diabetic ophthalmic complication: E08.39 Diabetes mellitus due to underlying condition with neurological complications: E08.4 Diabetes mellitus due to underlying condition with diabetic neuropathy, unspecified: E08.40 Diabetes mellitus due to underlying condition with diabetic mononeuropathy: E08.41 Diabetes mellitus due to underlying condition with diabetic polyneuropathy: E08.42 Diabetes mellitus due to underlying condition with diabetic autonomic (poly)neuropathy: E08.43 Diabetes mellitus due to underlying condition with diabetic amyotrophy: E08.44 Diabetes mellitus due to underlying condition with other diabetic neurological complication: E08.49 Diabetes mellitus due to underlying condition with circulatory complications: E08.5 Diabetes mellitus due to underlying condition with diabetic peripheral angiopathy without gangrene: E08.51 Diabetes mellitus due to underlying condition with diabetic peripheral angiopathy with gangrene: E08.52 Diabetes mellitus due to underlying condition with other circulatory complications: E08.59 Diabetes mellitus due to underlying condition with other specified complications: E08.6 Diabetes mellitus due to underlying condition with diabetic arthropathy: E08.61 Diabetes mellitus due to underlying condition with diabetic neuropathic arthropathy: E08.610 Diabetes mellitus due to underlying condition with other diabetic arthropathy: E08.618 Diabetes mellitus due to underlying condition with skin complications: E08.62 Diabetes mellitus due to underlying condition with diabetic dermatitis: E08.620 Diabetes mellitus due to underlying condition with foot ulcer: E08.621 Diabetes mellitus due to underlying condition with other skin ulcer: E08.622 Diabetes mellitus due to underlying condition with other skin complications: E08.628 Diabetes mellitus due to underlying condition with oral complications: E08.63 Diabetes mellitus due to underlying condition with periodontal disease: E08.630 Diabetes mellitus due to underlying condition with other oral complications: E08.638 Diabetes mellitus due to underlying condition with hypoglycemia: E08.64 â⬠¦Ã¢â¬ ¦ with coma: E08.641 â⬠¦Ã¢â¬ ¦ without coma: E08.649 Diabetes mellitus due to underlying condition with hyperglycemia: E08.65 Diabetes mellitus due to underlying condition with other specified complication: E08.69 Diabetes mellitus due to underlying condition with unspecified complications: E08.8 Diabetes mellitus due to underlying condition without complications: E08.9 Diabetes can damage the kidneys as well (Hey Paul Studio/Flickr) ICD-10 Codes for Drug or Chemical Induced Diabetes Drug or chemical induced diabetes mellitus: E09 Drug or chemical induced diabetes mellitus with hyperosmolarity: E09.0 â⬠¦Ã¢â¬ ¦ without nonketotic hyperglycemic-hyperosmolar coma (NKHHC): E09.00 â⬠¦Ã¢â¬ ¦ with coma: E09.01 Drug or chemical induced diabetes mellitus with ketoacidosis: E09.1 â⬠¦Ã¢â¬ ¦ without coma: E09.10 â⬠¦Ã¢â¬ ¦ with coma: E09.11 Drug or chemical induced diabetes mellitus with kidney complications: E09.2 Drug or chemical induced diabetes mellitus with diabetic nephropathy: E09.21 Drug or chemical induced diabetes mellitus with diabetic chronic kidney disease: E09.22 Drug or chemical induced diabetes mellitus with other diabetic kidney complication: E09.29 Drug or chemical induced diabetes mellitus with ophthalmic complications: E09.3 Drug or chemical induced diabetes mellitus with unspecified diabetic retinopathy: E09.31 â⬠¦Ã¢â¬ ¦ with macular edema: E09.311 â⬠¦Ã¢â¬ ¦ without macular edema: E09.319 Drug or chemical induced diabetes mellitus with mild nonproliferative diabetic retinopathy: E09.32 â⬠¦Ã¢â¬ ¦ with macular edema: E09.321 â⬠¦Ã¢â¬ ¦ without macular edema: E09.329 Drug or chemical induced diabetes mellitus with moderate nonproliferative diabetic retinopathy: E09.33 â⬠¦Ã¢â¬ ¦ with macular edema: E09.331 â⬠¦Ã¢â¬ ¦ without macular edema: E09.339 Drug or chemical induced diabetes mellitus with severe nonproliferative diabetic retinopathy: E09.34 â⬠¦Ã¢â¬ ¦ with macular edema: E09.341 â⬠¦Ã¢â¬ ¦ without macular edema: E09.349 Drug or chemical induced diabetes mellitus with proliferative diabetic retinopathy: E09.35 â⬠¦Ã¢â¬ ¦ with macular edema: E09.351 â⬠¦Ã¢â¬ ¦ without macular edema: E09.359 Drug or chemical induced diabetes mellitus with diabetic cataract: E09.36 Drug or chemical induced diabetes mellitus with other diabetic ophthalmic complication: E09.39 Drug or chemical induced diabetes mellitus with neurological complications: E09.4 â⬠¦Ã¢â¬ ¦ with diabetic neuropathy, unspecified: E09.40 â⬠¦Ã¢â¬ ¦ with diabetic mononeuropathy: E09.41 â⬠¦Ã¢â¬ ¦ with diabetic polyneuropathy: E09.42 â⬠¦Ã¢â¬ ¦ with diabetic autonomic (poly)neuropathy: E09.43 â⬠¦Ã¢â¬ ¦ with diabetic amyotrophy: E09.44 â⬠¦Ã¢â¬ ¦ with other diabetic neurological complication: E09.49 Drug or chemical induced diabetes mellitus with circulatory complications: E09.5 Drug or chemical induced diabetes mellitus with diabetic peripheral angiopathy without gangrene: E09.51 Drug or chemical induced diabetes mellitus with diabetic peripheral angiopathy with gangrene: E09.52 Drug or chemical induced diabetes mellitus with other circulatory complications: E09.59 Drug or chemical induced diabetes mellitus with other specified complications: E09.6 Drug or chemical induced diabetes mellitus with diabetic arthropathy: E09.61 Drug or chemical induced diabetes mellitus with diabetic neuropathic arthropathy: E09.610 Drug or chemical induced diabetes mellitus with other diabetic arthropathy: E09.618 Drug or chemical induced diabetes mellitus with skin complications: E09.62 Drug or chemical induced diabetes mellitus with diabetic dermatitis: E09.620 Drug or chemical induced diabetes mellitus with foot ulcer: E09.621 Drug or chemical induced diabetes mellitus with other skin ulcer: E09.622 Drug or chemical induced diabetes mellitus with other skin complications: E09.628 Drug or chemical induced diabetes mellitus with oral complications: E09.63 Drug or chemical induced diabetes mellitus with periodontal disease: E09.630 Drug or chemical induced diabetes mellitus with other oral complications: E09.638 Drug or chemical induced diabetes mellitus with hypoglycemia: E09.64 â⬠¦Ã¢â¬ ¦ with coma: E09.641 â⬠¦Ã¢â¬ ¦ without coma: E09.649 Drug or chemical induced diabetes mellitus with hyperglycemia: E09.65 Drug or chemical induced diabetes mellitus with other specified complication: E09.69 Drug or chemical induced diabetes mellitus with unspecified complications: E09.8 Drug or chemical induced diabetes mellitus without complications: E09.9 Some medications can raise blood glucose levels and ultimately cause the patient to develop diabetes. (Jamie/Flickr) ICD-10 Codes for Type 1 (Juvenile) Diabetes Type 1 diabetes mellitus: E10 Type 1 diabetes mellitus with ketoacidosis: E10.1 â⬠¦Ã¢â¬ ¦ without coma: E10.10 â⬠¦Ã¢â¬ ¦ with coma: E10.11 Type 1 diabetes mellitus with kidney complications: E10.2 Type 1 diabetes mellitus with diabetic nephropathy: E10.21 Type 1 diabetes mellitus with diabetic chronic kidney disease: E10.22 Type 1 diabetes mellitus with other diabetic kidney complication: E10.29 Type 1 diabetes mellitus with ophthalmic complications: E10.3 Type 1 diabetes mellitus with unspecified diabetic retinopathy: E10.31 â⬠¦Ã¢â¬ ¦ with macular edema: E10.311 â⬠¦Ã¢â¬ ¦ without macular edema: E10.319 Type 1 diabetes mellitus with mild nonproliferative diabetic retinopathy: E10.32 â⬠¦Ã¢â¬ ¦ with macular edema: E10.321 â⬠¦Ã¢â¬ ¦ without macular edema: E10.329 Type 1 diabetes mellitus with moderate nonproliferative diabetic retinopathy: E10.33 â⬠¦Ã¢â¬ ¦ with macular edema: E10.331 â⬠¦Ã¢â¬ ¦ without macular edema: E10.339 Type 1 diabetes mellitus with severe nonproliferative diabetic retinopathy: E10.34 â⬠¦Ã¢â¬ ¦ with macular edema: E10.341 â⬠¦Ã¢â¬ ¦ without macular edema: E10.349 Type 1 diabetes mellitus with proliferative diabetic retinopathy: E10.35 â⬠¦Ã¢â¬ ¦ with macular edema: E10.351 â⬠¦Ã¢â¬ ¦ without macular edema: E10.359 Type 1 diabetes mellitus with diabetic cataract: E10.36 Type 1 diabetes mellitus with other diabetic ophthalmic complication: E10.39 Type 1 diabetes mellitus with neurological complications: E10.4 Type 1 diabetes mellitus with diabetic neuropathy, unspecified: E10.40 Type 1 diabetes mellitus with diabetic mononeuropathy: E10.41 Type 1 diabetes mellitus with diabetic polyneuropathy: E10.42 Type 1 diabetes mellitus with diabetic autonomic (poly)neuropathy: E10.43 Type 1 diabetes mellitus with diabetic amyotrophy: E10.44 Type 1 diabetes mellitus with other diabetic neurological complication: E10.49 Type 1 diabetes mellitus with circulatory complications: E10.5 Type 1 diabetes mellitus with diabetic peripheral angiopathy without gangrene: E10.51 Type 1 diabetes mellitus with diabetic peripheral angiopathy with gangrene: E10.52 Type 1 diabetes mellitus with other circulatory complications: E10.59 Type 1 diabetes mellitus with other specified complications: E10.6 Type 1 diabetes mellitus with diabetic arthropathy: E10.61 Type 1 diabetes mellitus with diabetic neuropathic arthropathy: E10.610 Type 1 diabetes mellitus with other diabetic arthropathy: E10.618 Type 1 diabetes mellitus with skin complications: E10.62 Type 1 diabetes mellitus with diabetic dermatitis: E10.620 Type 1 diabetes mellitus with foot ulcer: E10.621 Type 1 diabetes mellitus with other skin ulcer: E10.622 Type 1 diabetes mellitus with other skin complications: E10.628 Type 1 diabetes mellitus with oral complications: E10.63 Type 1 diabetes mellitus with periodontal disease: E10.630 Type 1 diabetes mellitus with other oral complications: E10.638 Type 1 diabetes mellitus with hypoglycemia: E10.64 â⬠¦Ã¢â¬ ¦ with coma: E10.641 â⬠¦Ã¢â¬ ¦ without coma: E10.649 Type 1 diabetes mellitus with hyperglycemia: E10.65 Type 1 diabetes mellitus with other specified complication: E10.69 Type 1 diabetes mellitus with unspecified complications: E10.8 Type 1 diabetes mellitus without complications: E10.9 Reusable access points for insulin make life less painful for type 1 diabetics (Elisa Self /Flickr) ICD-10 Codes for Type 2 Diabetes Type 2 diabetes mellitus: E11 Type 2 diabetes mellitus with hyperosmolarity: E11.0 â⬠¦Ã¢â¬ ¦ without non-ketotic hyperglycemic-hyperosmolar coma (NKHHC): E11.00 â⬠¦Ã¢â¬ ¦ with coma: E11.01 Type 2 diabetes mellitus with kidney complications: E11.2 Type 2 diabetes mellitus with diabetic nephropathy: E11.21 Type 2 diabetes mellitus with diabetic chronic kidney disease: E11.22 Type 2 diabetes mellitus with other diabetic kidney complication: E11.29 Type 2 diabetes mellitus with ophthalmic complications: E11.3 Type 2 diabetes mellitus with unspecified diabetic retinopathy: E11.31 â⬠¦Ã¢â¬ ¦ with macular edema: E11.311 â⬠¦Ã¢â¬ ¦ without macular edema: E11.319 Type 2 diabetes mellitus with mild nonproliferative diabetic retinopathy: E11.32 â⬠¦Ã¢â¬ ¦ with macular edema: E11.321 â⬠¦Ã¢â¬ ¦ without macular edema: E11.329 Type 2 diabetes mellitus with moderate nonproliferative diabetic retinopathy: E11.33 â⬠¦Ã¢â¬ ¦ with macular edema: E11.331 â⬠¦Ã¢â¬ ¦ without macular edema: E11.339 Type 2 diabetes mellitus with severe nonproliferative diabetic retinopathy: E11.34 â⬠¦Ã¢â¬ ¦ with macular edema: E11.341 â⬠¦Ã¢â¬ ¦ without macular edema: E11.349 Type 2 diabetes mellitus with proliferative diabetic retinopathy: E11.35 â⬠¦Ã¢â¬ ¦ with macular edema: E11.351 â⬠¦Ã¢â¬ ¦ without macular edema: E11.359 Type 2 diabetes mellitus with diabetic cataract: E11.36 Type 2 diabetes mellitus with other diabetic ophthalmic complication: E11.39 Type 2 diabetes mellitus with neurological complications: E11.4 Type 2 diabetes mellitus with diabetic neuropathy, unspecified: E11.40 Type 2 diabetes mellitus with diabetic mononeuropathy: E11.41 Type 2 diabetes mellitus with diabetic polyneuropathy: E11.42 Type 2 diabetes mellitus with diabetic autonomic (poly)neuropathy: E11.43 Type 2 diabetes mellitus with diabetic amyotrophy: E11.44 Type 2 diabetes mellitus with other diabetic neurological complication: E11.49 Type 2 diabetes mellitus with circulatory complications: E11.5 Type 2 diabetes mellitus with diabetic peripheral angiopathy without gangrene: E11.51 Type 2 diabetes mellitus with diabetic peripheral angiopathy with gangrene: E11.52 Type 2 diabetes mellitus with other circulatory complications: E11.59 Type 2 diabetes mellitus with other specified complications: E11.6 Type 2 diabetes mellitus with diabetic arthropathy: E11.61 Type 2 diabetes mellitus with diabetic neuropathic arthropathy: E11.610 Type 2 diabetes mellitus with other diabetic arthropathy: E11.618 Type 2 diabetes mellitus with skin complications: E11.62 Type 2 diabetes mellitus with diabetic dermatitis: E11.620 Type 2 diabetes mellitus with foot ulcer: E11.621 Type 2 diabetes mellitus with other skin ulcer: E11.622 Type 2 diabetes mellitus with other skin complications: E11.628 Type 2 diabetes mellitus with oral complications: E11.63 Type 2 diabetes mellitus with periodontal disease: E11.630 Type 2 diabetes mellitus with other oral complications: E11.638 Type 2 diabetes mellitus with hypoglycemia: E11.64 â⬠¦Ã¢â¬ ¦ with coma: E11.641 â⬠¦Ã¢â¬ ¦ without coma: E11.649 Type 2 diabetes mellitus with hyperglycemia: E11.65 Type 2 diabetes mellitus with other specified complication: E11.69 Type 2 diabetes mellitus with unspecified complications: E11.8 Type 2 diabetes mellitus without complications: E11.9 When you start using donuts as bread, it's probably time for an intervention. (stantontcady/Flickr) ICD-10 Codes for Diabetes Related to Pregnancy and Childbirth Diabetes mellitus in pregnancy, childbirth, and the puerperium: 024 Pre-existing diabetes mellitus, type 1, in pregnancy, childbirth and the puerperium: 024.0 Pre-existing diabetes mellitus, type 1, in pregnancy: 024.01 â⬠¦Ã¢â¬ ¦ first trimester: 024.011 â⬠¦Ã¢â¬ ¦ second trimester: 024.012 â⬠¦Ã¢â¬ ¦ third trimester: 024.013 â⬠¦Ã¢â¬ ¦ unspecified trimester: 024.019 Pre-existing diabetes mellitus, type 1, in childbirth: 024.02 Pre-existing diabetes mellitus, type 1, in the puerperium: 024.03 Pre-existing diabetes mellitus, type 2, in pregnancy, childbirth and the puerperium: 024.1 Pre-existing diabetes mellitus, type 2, in pregnancy: 024.11 â⬠¦Ã¢â¬ ¦ first trimester: 024.111 â⬠¦Ã¢â¬ ¦ second trimester: 024.112 â⬠¦Ã¢â¬ ¦ third trimester: 024.113 â⬠¦Ã¢â¬ ¦ unspecified trimester: 024.119 Pre-existing diabetes mellitus, type 2, in childbirth: 024.12 Pre-existing diabetes mellitus, type 2, in the puerperium: 024.13 Unspecified pre-existing diabetes mellitus in pregnancy, childbirth and the puerperium: 024.3 Unspecified pre-existing diabetes mellitus in pregnancy: 024.31 â⬠¦Ã¢â¬ ¦ first trimester: 024.311 â⬠¦Ã¢â¬ ¦ second trimester: 024.312 â⬠¦Ã¢â¬ ¦ third trimester: 024.313 â⬠¦Ã¢â¬ ¦ unspecified trimester: 024.319 Unspecified pre-existing diabetes mellitus in childbirth: 024.32 Unspecified pre-existing diabetes mellitus in the puerperium: 024.33 Gestational diabetes mellitus: 024.4 Gestational diabetes mellitus in pregnancy: 024.41 â⬠¦Ã¢â¬ ¦ diet controlled: 024.410 â⬠¦Ã¢â¬ ¦ insulin controlled: 024.414 â⬠¦Ã¢â¬ ¦ unspecified control: 024.419 Gestational diabetes mellitus in childbirth: 024.42 â⬠¦Ã¢â¬ ¦ diet controlled: 024.420 â⬠¦Ã¢â¬ ¦ insulin controlled: 024.424 â⬠¦Ã¢â¬ ¦ unspecified control: 024.429 Gestational diabetes mellitus in the puerperium: 024.43 â⬠¦Ã¢â¬ ¦ diet controlled: 024.430 â⬠¦Ã¢â¬ ¦ insulin controlled: 024.434 â⬠¦Ã¢â¬ ¦ unspecified control: 024.439 Other pre-existing diabetes mellitus in pregnancy, childbirth, and the puerperium: 024.8 Other pre-existing diabetes mellitus in pregnancy: 024.81 â⬠¦Ã¢â¬ ¦ first trimester: 024.811 â⬠¦Ã¢â¬ ¦ second trimester: 024.812 â⬠¦Ã¢â¬ ¦ third trimester: 024.813 â⬠¦Ã¢â¬ ¦ unspecified trimester: 024.819 Other pre-existing diabetes mellitus in childbirth: 024.82 Other pre-existing diabetes mellitus in the puerperium: 024.83 Unspecified diabetes mellitus in pregnancy, childbirth and the puerperium: 024.9 Unspecified diabetes mellitus in pregnancy: 024.91 â⬠¦Ã¢â¬ ¦ first trimester: 024.911 â⬠¦Ã¢â¬ ¦ second trimester: 024.912 â⬠¦Ã¢â¬ ¦ third trimester: 024.913 â⬠¦Ã¢â¬ ¦ unspecified trimester: 024.919 Unspecified diabetes mellitus in childbirth: 024.92 Unspecified diabetes mellitus in the puerperium: 024.93 Sarah Neff/Flickr ICD-10 Codes for Other Types of Diabetes Other specified diabetes mellitus: E13 Other specified diabetes mellitus with hyperosmolarity: E13.0 â⬠¦Ã¢â¬ ¦ without nonketotic hyperglycemic-hyperosmolar coma (NKHHC): E13.00 â⬠¦Ã¢â¬ ¦ with coma: E13.01 Other specified diabetes mellitus with ketoacidosis: E13.1 â⬠¦Ã¢â¬ ¦ without coma: E13.10 â⬠¦Ã¢â¬ ¦ with coma: E13.11 Other specified diabetes mellitus with kidney complications: E13.2 Other specified diabetes mellitus with diabetic nephropathy: E13.21 Other specified diabetes mellitus with diabetic chronic kidney disease: E13.22 Other specified diabetes mellitus with other diabetic kidney complication: E13.29 Other specified diabetes mellitus with ophthalmic complications: E13.3 Other specified diabetes mellitus with unspecified diabetic retinopathy: E13.31 â⬠¦Ã¢â¬ ¦ with macular edema: E13.311 â⬠¦Ã¢â¬ ¦ without macular edema: E13.319 Other specified diabetes mellitus with mild nonproliferative diabetic retinopathy: E13.32 â⬠¦Ã¢â¬ ¦ with macular edema: E13.321 â⬠¦Ã¢â¬ ¦ without macular edema: E13.329 Other specified diabetes mellitus with moderate nonproliferative diabetic retinopathy: E13.33 â⬠¦Ã¢â¬ ¦ with macular edema: E13.331 â⬠¦Ã¢â¬ ¦ without macular edema: E13.339 Other specified diabetes mellitus with severe nonproliferative diabetic retinopathy: E13.34 â⬠¦Ã¢â¬ ¦ with macular edema: E13.341 â⬠¦Ã¢â¬ ¦ without macular edema: E13.349 Other specified diabetes mellitus with proliferative diabetic retinopathy: E13.35 â⬠¦Ã¢â¬ ¦ with macular edema: E13.351 â⬠¦Ã¢â¬ ¦ without macular edema: E13.359 Other specified diabetes mellitus with diabetic cataract: E13.36 Other specified diabetes mellitus with other diabetic ophthalmic complication: E13.39 Other specified diabetes mellitus with neurological complications: E13.4 Other specified diabetes mellitus with diabetic neuropathy, unspecified: E13.40 Other specified diabetes mellitus with diabetic mononeuropathy: E13.41 Other specified diabetes mellitus with diabetic polyneuropathy: E13.42 Other specified diabetes mellitus with diabetic autonomic (poly)neuropathy: E13.43 Other specified diabetes mellitus with diabetic amyotrophy: E13.44 Other specified diabetes mellitus with other diabetic neurological complication: E13.49 Other specified diabetes mellitus with circulatory complications: E13.5 Other specified diabetes mellitus with diabetic peripheral angiopathy without gangrene: E13.51 Other specified diabetes mellitus with diabetic peripheral angiopathy with gangrene: E13.52 Other specified diabetes mellitus with other circulatory complications: E13.59 Other specified diabetes mellitus with other specified complications: E13.6 Other specified diabetes mellitus with diabetic arthropathy: E13.61 Other specified diabetes mellitus with diabetic neuropathic arthropathy: E13.610 Other specified diabetes mellitus with other diabetic arthropathy: E13.618 Other specified diabetes mellitus with skin complications: E13.62 Other specified diabetes mellitus with diabetic dermatitis: E13.620 Other specified diabetes mellitus with foot ulcer: E13.621 Other specified diabetes mellitus with other skin ulcer: E13.622 Other specified diabetes mellitus with other skin complications: E13.628 Other specified diabetes mellitus with oral complications: E13.63 Other specified diabetes mellitus with periodontal disease: E13.630 Other specified diabetes mellitus with other oral complications: E13.638 Other specified diabetes mellitus with hypoglycemia: E13.64 â⬠¦Ã¢â¬ ¦ with coma: E13.641 â⬠¦Ã¢â¬ ¦ without coma: E13.649 Other specified diabetes mellitus with hyperglycemia: E13.65 Other specified diabetes mellitus with other specified complication: E13.69 Other specified diabetes mellitus with unspecified complications: E13.8 Other specified diabetes mellitus without complications: E13.9 A diabetic cataract (National Eye Institute/Flickr) ICD-9 to ICD-10 Codes for Diabetes Conversion Table Here's a conversion table that translates the old ICD-9 codes for diabetes to ICD-10 codes. There werenââ¬â¢t as many codes to describe different conditions in the ICD-9, so youââ¬â¢ll notice that some of them have more than one possible corresponding ICD-10 code. Some are also translated into a combination of two ICD-10 codes (note the use of the word "and"). ICD-9 ICD-10 249.00 E08.9 or E09.9 or E13.9 249.01 E08.65 or E09.65 249.10 E08.10 or E09.10 or E13.10 249.11 E08.10 or E09.10 or E13.65 249.20 E08.01 or E09.01 or E13.00 249.21 E08.01 or E09.01 or E13.65 249.30 E08.11 or E08.641 or E09.11 or E09.641 or E13.11 or E13.641 249.31 E08.11 or E09.11 or E09.65 249.40 E08.21 or E09.21 249.41 E08.21 or E09.21 or E08.65 249.50 E08.311 or E08.319 or E08.36 or E08.39 or E09.311 or E09.319 or E09.36 or E09.39 or E13.39 249.51 E08.39 or E09.39 249.60 E08.40 or E08.41 or E08.42 or E08.43 or E08.44 or E08.49 or E08.610 or E09.40 or E09.41 or E09.42 or E09.43 or E09.44 or E09.49 or E09.610 or E13.40 or E13.41 or E13.42 or E13.43 or E13.44 or E13.49 249.61 E08.40 or E09.40 AND E08.65 249.70 E08.51 or E09.51 or E13.59 249.71 E08.51 or E09.51 AND E08.65 249.80 E08.618 or E08.620 or E08.621 or E08.622 or E08.628 or E08.630 or E08.638 or E08.65 or E08.69 or E09.618 or E09.620 or E09.621 or E09.622 or E09.628 or E09.630 or E09.638 or E09.649 or E09.65 or E09.69 or E13.620 or E13.621 or E13.622 or E13.628 or E13.638 or E13.649 or E13.65 or E13.69 249.81 E08.69 or E09.69 AND E08.65 249.90 E08.8 or E09.8 or E13.8 249.91 E08.8 or E09.8 or AND E08.65 250.00 E11.9 250.01 E10.9 250.02 E11.65 250.03 E10.65 250.10 E11.69 250.11 E10.10 250.12 E11.69 and E11.65 250.13 E10.10 and E10.65 250.20 E11.00 or E11.01 250.21 E10.69 250.22 E11.00 and E11.65 250.23 E10.69 and E10.65 250.30 E11.641 250.31 E10.11 or E10.641 250.32 E11.01 and E11.65 250.33 E10.11 and E10.65 250.40 E11.29 250.41 E10.29 250.42 E11.21 and E11.65 250.43 E10.21 and E10.65 250.50 E11.311 or E11.319 or E11.36 or E11.39 250.51 E10.311 or E10.319 or E10.36 or E10.39 250.52 E11.311 or E11.319 or E11.36 or E11.39 or E11.65 250.53 E10.311 or E10.319 or E10.36 or E10.39 or E10.65 250.60 E11.40 250.61 E10.40 250.62 E11.40 and E11.65 250.63 E10.40 and E10.65 250.70 E11.51 250.71 E10.51 250.72 E11.51 and E11.65 250.73 E10.51 and E10.65 250.80 E11.618 or E11.620 or E11.621 or E11.622 or E11.628 or E11.630 or E11.638 or E11.649 or E11.65 or E11.69 250.81 E10.618 or E10.620 or E10.621 or E10.622 or E10.628 or E10.630 or E10.638 or E10.649 or E10.65 or E10.69 250.82 E11.65 and E11.69 250.83 E10.65 and E10.69 250.90 E11.8 250.91 E10.8 250.92 E11.8 and E11.65 250.93 E10.8 and E10.65 Updates are temporarily inconvenient but important in the long run (Apple iPhone 6 IOS update, used under CC 2.0) Guidelines on Using ICD-10 Codes for Diabetes As many ICD-10 codes as necessary can be used together to describe the patientââ¬â¢s form of diabetes. Pregnant women who are diabetic should be assigned a code from the 024 category first, followed by the appropriate diabetes codes in the E08 to E13 range. For gestational diabetes (diabetes that occurs during pregnancy) women should be assigned a code under the 024.4 subheading and not any other codes under the 024 category. If the type of diabetes that the patient has is not documented in the medical record, E11 codes for type 2 diabetes should be used as a default. If the medical record doesnââ¬â¢t say what type of diabetes the patient has but indicates that the patient uses insulin, the Type 2 diabetes codes should also be used. The code for long-term use of insulin, Z79.4, should also be used in these cases (unless insulin was just given to the patient as a one-time fix to bring blood sugar under control). Note that the word ââ¬Å"withâ⬠in the code titles always means ââ¬Å"associated withâ⬠or ââ¬Å"due toâ⬠(it doesnââ¬â¢t refer to two disparate conditions). The ââ¬Å"unspecifiedâ⬠codes can be used when not enough information is known to give a more specific diagnosis; in that case, ââ¬Å"unspecifiedâ⬠is technically more accurate than a more specific but as yet unconfirmed diagnosis. For more guidelines on using ICD-10 codes for diabetes mellitus, you can consult this document. What Are ICD-10 Codes? ICD (International Classification of Diseases) codes are a way for doctors to record diagnoses in a succinct universal language. ICD-10 codes refer to the codes from the 10th Revision of the classification system. ICD-10 officially replaced ICD-9 in the US in October of 2015. The switch to ICD-10 was a response to the need for doctors to record more specific and accurate diagnoses based on the most recent advancements in medicine. For this reason, there are five times more ICD-10 codes than there were ICD-9 codes. The ICD-10 codes consist of three to seven characters that may contain both letters and numbers.
Sunday, November 3, 2019
Introduction to Welding Essay Example | Topics and Well Written Essays - 2750 words
Introduction to Welding - Essay Example This causes the metal to melt and on subsequent application of pressure, the liquid regions undergo a process called coalescence. When cooled, this coalesced liquid metal mixture undergoes solidification and the weld is complete, thus giving us one continuous piece of metal. The heat energy required for the process may be obtained from a number of sources. Some options that can be used are gas flames, electric arcs and ultrasound. Most often carried out in an industrial environment in open air, there may arise certain situations where the welding is required to be carried out marine or even in space. The sources of energy will have to be selected accordingly, since certain sources may not work well in certain environments. For instance, an open oxyacetylene flame in a vacuum or even underwater, is obviously impossible. The quality of a weld, its strength and durability are largely dependant on the base metals used in the welding process. Some of the major base metals which can be joined by using the process of welding are The suitability of alloys such as steel to welding depend on the contents, which may be a diverse collection. Steel, or more accurately, plain carbon steel is chosen as a reference material for this. To judge alloys made up of many distinct materials, we make use of a factor called the equivalent carbon content. This is used to compare the relative weldabilities of different alloys by comparing their properties to plain carbon steel. Considerable effects are seen on the weldability of a metal alloy which contains elements like carbon, chromium and vanadium, while copper and nickel have only negligible effects. As the equivalent carbon content rises, the weldability of the alloy decreases (Lincoln Electric, 1994). But this can't be helped, because plain carbon and low-alloy steels have unacceptably low strength levels, especially from an industrial perspective. High strength, low-alloy steels which contain a very small percentage of carbon and include additive elements like manganese, phosphorus, sulphur and small amounts of copper, nickel, niobium, nitrogen, vanadium, chromium, molybdenum, silicon, or zirconium(Schoolscience.co.uk, 2007) were developed especially for welding applications during the 1970s. The high chromium content of stainless steel makes it less preferable for welding. Those varieties which may have been deemed weldable are susceptible to distortion due to their high coefficient of thermal expansion, and hence are prone to cracking and reduced corrosion resistance. Aluminum The chemical composition of aluminum alloys, as with any alloy, decides the weldability. Hot cracking of the alloy on welding is prevented by preheating. This reduces the temperature gradient across the welding area. However, this can reduce the mechanical properties of the base material. Another alternative is to alter the design of the joint, with a more compatible filler alloy to decrease hot cracking. Aluminum alloys should also be cleaned prior to welding, with the goal of removing all oxides, oils, and loose particles from the surface to be welded. This is especially important because of an aluminum weld's susceptibility to porosity due to hydrogen and dross due to oxygen(Lincoln Electric, 1994) Residual stresses Stresses caused in a rigid structure as a result of internal strains are referred to by the term Residual Stresses. These strains are usually of a permanent nature and may have its origins at any stage in the component life cycle. Welding is one of the most significant causes of residual stresses and may cause large tensile stresses whose maximum value is approximately equal to the yield
Friday, November 1, 2019
Walnut Street Jail Research Paper Example | Topics and Well Written Essays - 1000 words
Walnut Street Jail - Research Paper Example Thesis statement: The Walnut Street Jail, especially the concept of penitentiary house, deeply influences the current prison system in US and proves to be effective (special reference to the concept of penitentiary house). Walnut Street Jail: A brief history The history of Walnut Street Jail begins in the year 1774, when the law enforcement authority decided to open a new jail. Earlier, there was another prison in Philadelphia, Pennsylvania Street. As overcrowding was an important problem, the prison authorities decided to construct Walnut Street Jail. In addition, the designer (Robert Smith) decided to construct large rooms for the inmates. Robert Smith decided to construct the new jail in the form of U-shape because more inmates were to be accommodated within the limited space. Gradually, Walnut Street Jail became overcrowded and the prison authorities decided to construct a new cellblock, namely penitentiary house. As the cells in the penitentiary house aimed to accommodate indivi dual prisoners, it became a revolutionary change in prison design. This design, known as Pennsylvania System deeply influenced the construction of other prisons like Pittsburgh prison (1821) and Trenton State Prison (1836). Walnut Street Jailââ¬â¢s role in the development of US penitentiary system One can easily identify that the development of modern prison system is deeply rooted in the innovative measures adopted by the Walnut Street Jail authorities. First of all, the penitentiary house built by the Walnut Street Jail was the most important development within US penitentiary system. Earlier, the prisoners were accommodated in rooms with limited space. This created much tension because new inmates mingled with criminals who were undergoing long-term imprisonment. Moreover, the prison authorities considered managing the prisoners as a tiresome effort. The idea to accommodate the inmates into small cells was helpful to manage the inmates with more ease. In 1970s, the penitentiar y house within the Walnut Street Jail system was considered as an innovative measure to deal with the problems faced by the authorities and the prisoners in general. The vocational workshop was another effective measure adopted by the Walnut Street Jail authorities. Besides, the jail authorities gave less importance to punitive measures. When rehabilitation and penitence became more important than punishment, the other jails/prisons in US began to imitate the measures adopted by the Walnut Street Jail. This is most important because it transformed the scenario of prison system in US. In addition, the Walnut Street Jail paved the way for innovative prison designs like Pennsylvania System and Auburn Prison Scheme. Later, the Auburn Prison Scheme (say, labor during day time and isolation at night time) became more popular than other prison designs in US. So, one can see that Walnut Street Jailââ¬â¢s role in the development of US penitentiary system is utmost important. The key conce pts implemented at the Walnut Street Jail As pointed out, the most important concept implemented at the Walnut Street Jail was penitentiary house or separate cells for the inmates. Roth (2006) states that ââ¬Å"Hence its reputation as the first penitentiary in the world and the first American adoption of the theory of solitary confinement as a major step on the road to repentanceâ⬠(p.293). The separation of women inmates from men is another idea implemented at th
Wednesday, October 30, 2019
There is No universal experience of 'childhood' - it is a construct Essay
There is No universal experience of 'childhood' - it is a construct entirely dependent on patterns of social organisation and cultural conventions Discuss with - Essay Example This is the beginning of shaping a child to think and act like the parent. In this process, children are taught how to behave and how to move within their culture. Depending on how the child is treated they will either develop a strong character and self-esteem or they will develop one that is weak. A child is taught to perceive the world through their parents eyes and they willing accept this teaching. The biggest influence on childhood will be the culture, religion, economic and social aspects of the family. Rodd (1996) says that culture plays a significant role in childhood and it can be the mainstream culture or it can be a subculture (Rodd, p. 31). Shechtman Hiradin and Zina (2003) talked with adolescents in their study to find out whether there was a difference in how these children would disclose about them based on their ethnicity. Their study found that Moslem children were able to disclose easier than Druze children and they thought it may be due to how much acculturation each ethnic group displayed. Druze people re more traditional in their ways and less acculturated to the mainstream than Moslem and Jewish children according to their findings. This information shows that there is some truth to the idea that culture plays a part on how a child learns. It is the opinion of this writer that culture is a very big part of how children accept certain things in their environment. For instance, many children grow up and are abused in their childhood. Often this leads to abusive adults. The culture can also teach a child to love or to hate, to express themselves well or to be introverted and shy. There are a variety of cultural challenges to a child both inside the home and outside because they are constantly being bombarded by cultural situations. Harris (1999) says that what a parent does may not matter to a childs growing up. She gives examples of how one culture (that of the 1950s) taught parents not to spoil their children. Today, parents are
Subscribe to:
Posts (Atom)