oracle学习笔记1-Writing basic sql select statments

摘录学习笔记,铭记前进的每一步.hoho

开始还是蛮简单的哦!

Objectives
 @List the capabilities of sql select staements
 @Exectue a basic select statement
 @Differentiate between sql statements and Isql *plus comamnds

Basic select statement
     selcet identifers what columns
      From identifers which table
Writing sql statements
     Sql statements are  not case sensitive
     Sql statements can be on one or more lines.
      Keywords cannot be abbreviated or split across lines.
     Clauses are usually placed on separate lines.
      Indents are used to enhance readability.
Column heading defaults
    @Isql *plus:
    Default heading justification:Center
    Default heading display:uppercase
    @sql *plus:
   Character and date column headings are left-justified.
    Number column headings are right-justified
  Default heading display:uppercase
Arithmetic expressions
   Create expressions with number and date data by using arithmetic operators.
   Add,subtract,multiply,divide
   e:select name,salary+300 from table;
Operator precedence
   Multiplication and divison take priority over addition and subtraction.
   Operators of the same priority are evaluated from left to right.
   Parentheeses are used to force prioritized evaluation and clarify statements.
  e:select name,salary*3+100 from table;
Defining a null values
   A null is a value that is unavailable,unassigned,unknown,or inapplicable.
   A null is not the same as zero  or a blank space.
Null values in Arithmetic expressions
   Arithmetic expressions containing a null value evaluate to null.
Defining a column alias
   A column alias:
   Renames a column heading.
   Is useful with calculations.
   Immediately follows the column name-there can also be the optional AS keyword between
   the column name and alias.
   e: select au_id author_id from table;  select au_id as autor_id from table;
      select au_id as "author_id" from table;
   Requires double quotation marks if it contains apaces or special characters or is case sensitive.
Concatenation operator
   A concatenation operator:
   Concatenates columns or characters strings to other columns.
   Is represented by two vertical bars(||).
   e:select au_name||' '||au_id from table;
   Create a resultant column that is a character expression.
Literal character strings
   A literal is a character ,a number ,or a date included in the select lis.
   Date and character literal values must be enclosed within single quotation  marks.
   Each character strings is output once for each row returned.
   e:select au_id,''' name si',au_name||' 'au_add from table;
Duplicate rows
   The default display fo queries is all rows,including duplicate rows.
   e:select au_id from table;
      select distinct au_id from table;
Sql and Isql *plus interaction

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值