Oracle (query of data types and tables)

Source: Internet
Author: User


Oracle learning 2 (data type and Table query) oracle Data Type: www.2cto.com character type: the maximum char size is 2000 characters, and the space defined by char will be occupied no matter how much content, char queries are very efficient and fast. Fixed Length. char should be used for the fields to be queried, which is extremely fast. Varchar2 is longer and can save space. However, it is a waste of time to compare data during query. A large object with a maximum of 4000 clob characters is of the numerical type: 38 to the power of-10 in the range of-number, 38 to the power of-10, it can be an integer or a decimal number (5, 2). It can be a decimal number that contains two decimal places. The range is-999.99-999.99: date includes the year, month, day, and hour, minute, and second timestamp extension of the date data type, which is more accurate. Image Type: blob binary data can be used to store images/sounds (in actual projects, the image sounds are placed in folders, while the address is stored in the database. However, for security reasons, in the database) query operations for the www.2cto.com table: 1. set timing on; open time record for the following operation 2. When querying the table, select * from table name takes too much time, it is best not to use this keyword during query. 3. If the query results do not show duplicate content, use the distinct keyword. 4. The content in oracle is case sensitive.
5. Use the column alias select sal * 12 "annual salary" or select sal * 12 as "annual salary" 6. How to Handle null values using nvl function nvl (comm, 0) if comm is empty, 0 is used. If comm is not empty, select ename, sal * 12 + nvl (comm, 0) based on comm Value) * 12 as "annual salary" from emp; 7. like operator %: represents any 0 to multiple characters ,_: it indicates any single character 8, and the query speed can be improved by using in. 9. What sort of order by is output? from small to large, the default value is "asc" from large to small "desc". 10. When two or more items in the table need to be sorted, only one order.
11. When querying by group, items displayed must include items by group. 12. If the select statement contains both group by, having, and order by statements, their order is group by, having, and order.

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.