Common Oracle Data Types and integrity constraints

Source: Internet
Author: User
Table records (row) and fields (column) constitute the structure of data stored in the database. To store and manage data, you must first create a table in the database, that is, the word of the table.

Table records (row) and fields (column) constitute the structure of data stored in the database. To store and manage data, you must first create a table in the database, that is, the word of the table.

1. Basic data type

Character Type
Char can be up to 2000 characters in length
Example: char (10) 'database' stores 'database' with the first six characters, followed by 4 spaces.
Varchar2 () is a string of up to 4000 characters.
Char queries are fast but waste space. It is suitable for querying a large amount of data.
Varchar saves space but slow query speed
The maximum size of a Clob complex object is 4 GB.
Number Type
Number range:-power 38 of 10 to power 38 of 10
It can represent an integer or decimal number.
Number (5, 2) indicates that a decimal Number has 5 Valid digits and 2 decimal places.
Range:-999.99 to 999.99
Number (4)
Represents a 4-digit integer
Range:-9999 to 9999
Date type
Date includes year, month, day, hour, minute, and second
Timestamp can be accurate to milliseconds
Binary data type
Blob is used to store pictures and sounds for 4 GB.

2. Data integrity constraints
Table records (row) and fields (column) constitute the structure of data stored in the database. To store and manage data, you must first create a table in the database, that is, the field (column) Structure of the table.

Table data has a certain range of values and relationships, and data between multiple tables sometimes has a certain reference relationship. When creating and modifying tables, you can define constraints to ensure data integrity and consistency. Constraints are rules that must be verified when data is inserted, deleted, or modified to constrain the data.

Integrity includes data integrity and reference integrity. Data Integrity defines the constraints of table data and defines constraints between data by reference integrity. Data integrity is defined by the primary key (primary key), non-NULL (not null), UNIQUE (UNIQUE), and CHECK constraints) constraint condition definition.

Related reading:

Oracle integrity constraints

Oracle constraints and Indexes

From Oracle constraints to Indexes

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.