ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [学习笔记]SQL Fundamentals I(1)

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

原创 Linux操作系统 作者:quent_t 时间:2008-07-29 21:35:06 0 删除 编辑
[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博客 ” ,链接:https://blog.itpub.net/14210591/viewspace-412245/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: Uninstall DB2 on Linux
请登录后发表评论 登录
全部评论

注册时间:2008-07-26

  • 博文量
    8
  • 访问量
    27691