Oracle Development <<sql Cookbook>> Learning Notes Collation: First chapter Search Records

Source: Internet
Author: User

1. Write the program to list the required columns than direct write select * More intuitive. In this way, the performance of row data retrieval is the same, and the performance of column data retrieval is improved; When you select the required columns, you reduce IO and network transfer time to improve performance.

The 2.WHERE clause filters records with predicates such as =,<,>,<=,>=,!, <> and And,or.

The 3.NULL value is judged by IS null and is not NULL.

4. A column alias is especially important in a subquery.

5. Use | | To stitch the values of the columns.

6. Use the case when end clause to implement IF-ELSE judgment.

7. When top n is taken, it is important to note that rownum can fetch only the first n rows, not the nth row, and the nth row using Row_number ().

8. Random data collection (useful when making data):

SELECT *  from (    SELECT  ename, Job          from  emp          ORDERby  Dbms_random.value ())  WHERE<=5

9. Use the NVL or coalesce or case when end clauses to handle null values, as shown in the following example:

SELECT empno,       ename,        job,         Comm Comm_raw,       coalesce(comm,0-- or NVL (comm,0) Commfrom   emp;        

10. Use a like fuzzy match:% pass with _ placeholder.

Oracle Development <<sql Cookbook>> Learning Notes Collation: First chapter Search Records

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.