This document discusses MySQL operators including:
- Precedence of operators and type conversion
- Arithmetic, bitwise, logical, and comparison operators
- Mathematical, string, and date functions
It provides examples of using each type of operator and function, such as calculating percentages and dates, performing string manipulations, and applying logical conditions. The applications of MySQL operators include calculations on stored values, text search/editing, and electrical applications using bitwise operators.
2. OverviewPrecedence of operators and type conversionArithmetic operatorsBitwise operatorsLogical operatorsComparison operatorsMathematical functionsString functionsDate functions
7. All arithmetic operations are calculated with BIGINT(64-bit) precision.Ex:Mysql>select 4+55;59Mysql>select 4-55;-51;Mysql>select -5;-5 (unary minus)
10. All the operands should be numerals, but they are internally represented as binary.Left shift(<<)Mysql>select 4<<2;16Right shift(>>)Mysql>select 4>>2;1
14. Ex:Mysql>create table employee(Ssn INT NOT NULL,Salary INT,Name VARCHAR(20),Department VARCHAR(20),Primary key(ssn));Mysql>insert into employeeValues(100,10000,’sneha’,’finance’);
21. Returns 1 if the condition is TRUE and returns 0 if the condition is FALSEMysql>select 2.34<=2.34;1Mysql>select 2.34<=1.24;0Mysql>select 4.2>=4;1
32. Mysql>select substring(‘mysql’,3);sql(returns the substring at the given position from the main string)Mysql>select format(233444.564678,3);233,444.565(formats the given string and rounds to the given digits after the decimal point)
37. Mysql>select datediff(‘2009-1-1’,’2009-10-10’);83 (returns the difference between the dates in days)Mysql>select date_add(‘2009-12-29’,interval 3 day);2010-01-01(returns the new date formed after adding the number of days mentioned in the interval)
38. SOME OF THE APPLICATIONS OF MYSQL OPERATORS;1.operators and functions are used for performing calculations on stored values.2.High performance text search, field search and text editing applications.3.NAND,NOR AND XOR operators are are used in electrical applications.
39. Visit more self help tutorialsPick a tutorial of your choice and browse through it at your own pace.The tutorials section is free, self-guiding and will not involve any additional support.Visit us at www.dataminingtools.net