[学习笔记]SQL Fundamentals I(1)

[29/07/2008 21:33:45 ]

L1. Retrieving data using SELECT statement
1.Tips for writing SQL statement
    a.Clauses are usually placed on separate lines.
    b.In SQL Developer, SQL statements can optionally be terminated by a semicolon. Semicolons are required when you execute multiple SQL statements.
    c.In SQL*Plus, you are required to end each SQL statement with a semicolon.
    
2.Arithmetic expressions in the SELECT statement
    Example:SELECT last_name, salary, 12*(salary+100) FROM employees;
   
3.Column aliases
    Example:SELECT last_name "Name" , salary*12 "Annual Salary" FROM employees;
   
4.Use of concatenation operator, literal character strings, alternative quote operator, and the DISTINCT keyword
    a.Concatenation operator(||)
      Example:SELECT last_name||job_id AS "Employees" FROM employees;
    b.Literal Character Strings(')
      Example:SELECT last_name ||' is a '||job_id AS "Employee Details" FROM employees;
    c.Alternative Quote (q) Operator
      Example:SELECT department_name || ' Department' || q'['s Manager Id: ]' || manager_id AS "Department and Manager" FROM departments;
    d.Duplicate Rows
      Example:SELECT DISTINCT department_id FROM employees;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14210591/viewspace-412245/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/14210591/viewspace-412245/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值