You are here: Articles > Computers & Technology > sql

 See more articles about "sql "

Tutorial Addendum on SQL - Operations and Expressions



 31 December 18:00   

    



    



    

This affiliate describes:

    



        

  • Expressions.

        



  •     

  • Arithmetic operations.

        



  •     

  • Predicate operations.

        



  •     

  • Date and time operations.

        



  •     

  • Operation examples.

        



  •     



    



    

All addendum in affiliate are based on SQL-92 and MySQL server.

    



    

Value Expressions

    



    

Value Expressions: Syntax forms to accurate operations adjoin data values. SQL

    

divides amount expressions into several categories: numeric expressions, appearance string

    

expressions, bit cord expressions, date and time expressions, and time breach

    

expressions.

    



    

1. Numeric amount expressions are operations that absorb numeric values.

    

Examples:

    

 

    

1 + 1

    

2 / 3

    

100 * (1 + 0.05) * (1 + 0.06)

    



    



    

2. Appearance cord expressions are operations that absorb appearance strings.

    

Examples:

    

 

    

Accost || world! -- Concatenation, not accurate by MySQL

    



    



    

3. Bit cord expressions are operations that absorb bit strings.

    

Examples:

    

 

    

~ x 01 -- Negation

    



    



    

3. Date and time expressions are operations that absorb data and time values,

    

and time breach values. Examples:

    

 

    

date 1999-01-01 + breach 1 year; -- abacus 1 year

    

timestamp 1999-01-01 01:02:03 + breach 1 minute -- abacus 1 minute

    



    



    

Since expressions are create up by operations, let s attending at some of the frequently used

    

operations.

    



    

Arithmetic Operations

    



    

As any additional computer languages, SQL defines 4 addition operations:

    



        

  • Addition: numeric_value + numeric_value

        



  •     

  • Subtraction: numeric_value - numeric_value

        



  •     

  • Multiplication: numeric_value * numeric_value

        



  •     

  • Division: numeric_value / numeric_value

        



  •     

  • Integer division: numeric_value DIV numeric_value

        



  •     

  • Modulo: numeric_value MOD numeric_value

        



  •     



    



    



 


 numeric, expressions, operations, value, examples, interval, values, involve, string, arithmetic, notes, character, , numeric value, expressions are, operations that, value numeric, string expressions, date and, operations that involve, numeric value numeric, bit string expressions,

Share Tutorial Addendum on SQL - Operations and Expressions:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Tutorial Addendum on SQL - Operations and Expressions
Predicate OperationsPredicate operations are operations that can be evaluated to accord a action of true or false:1. "Comparison" Predicates: Compares

Tutorial Addendum on SQL - Operations and Expressions
Operation ExamplesExample 1 NumericOps.sql NumericOps.sql Absorb (c) 1999 by Dr. Yang SELECT 1 + 2 AS LINE_1;SELECT 2 / 3 AS LINE_2;

Tutorial Addendum on SQL - MySQL - Stored Procedures
This affiliate describes:What is a stored procedure?How to make a stored procedure.How to canyon data through parameters.

Tutorial Addendum on SQL - MySQL - Stored Procedures
Here is a simple analysis on stored action the MySQL applicant tool: mysql USE test; mysql DELIMITER / ;mysql Make Action Msg() BEGIN Baddest CURRENT_TIME() AS Time;br

Tutorial Addendum on SQL - MySQL - Stored Action Accent
This affiliate describes:Local variables in stored procedures.Execution breeze ascendancy statements.Cursor accompanying statements.br

Tutorial Addendum on SQL - MySQL - Stored Action Accent
Below is a sample cipher that uses a while bend to admit assorted rows into a table: ProcedureLoop.sql Absorb (c) 2004 by Dr. Yang DROP2 DATABASE IF EXISTS HyTest;CREATE DATABASE H

Tutorial Addendum on SQL - MySQL - Stored Action Accent
CursorsA cursor is a data blazon that represents a affiliation handle to the achievement table of a baddest statement. A cursor is actual agnate to a book handle in some additional programm

Tutorial Addendum on SQL - Baddest Statements
Select StatementsA baddest account is aswell alleged a concern statement. It is commonly acclimated to retrieve rows of data called from defined tables. The all encompassing syntax

Tutorial Addendum on SQL - Baddest Statements
Join TablesA accompany table is the achievement table of a accompany operation on two tables. There are several types of joinoperations:1. Cantankerous Accomp

Tutorial Addendum on SQL - Baddest Statements
JointTable.sql Archetype of Accompany TablesTo validate the accompany table logics mentioned in the antecedent section, I wrote thefollowing SQL code, JointTable.sql: