Oracle-07-Data Type example & amp; query Current System Time & amp; Create Table syntax

Source: Internet
Author: User

Oracle-07-Data Type example & query Current System Time & create table syntax

I,

 

Explanation: number (6, 2) specifies four digits for the integer part and two digits for the fractional part. Therefore, the three digits for the integer part 123.45678 meet the requirements, and the decimal part is five digits, therefore, the first two digits of the decimal part are retained and rounded in, so the database stores 123.46. For 12345.678, the error "The number entered exceeds the specified value" is reported, that is, the certificate section is "overflow.

 

Ii. query the current system time


 

Dual is a virtual table, that is, the system time is a data, but must be displayed in the form of a table, so the system time is saved in a virtual table, this virtual table is automatically deleted after use. For example, the example is also a virtual table. Because 'abc' does not belong to any table, it is presented in the form of a table from dual, that is, a virtual table.

 

III,

 

Do not forget the comma !!! In the syntax, brackets indicate that the content can be ignored and not written. The same below !!!

For example, if user A has the permission to create A table for user B, user B's username must be added to user A during table creation. For example, if you are currently logged on to the database as scott, you can create a table for the user lisi, that is, you have this permission, then the password can be written:

Ceate table lisi.

That is, scott creates Table A for lisi.

 

If you only create a table, the syntax is:Create tableTable Name

 

The following briefly introduces the default in the syntax, such as creating a table:

 

Query a table, for example:

 

If the value of the name column is not specified, 'zhang san' is automatically assigned, so we can see that for default, if the value is specified, the new value is stored in the database, otherwise, the default value is stored (the value after default ).

 

IV,

 

V,

 

In the above exampleCopy operationTo copy data from the emp table to the worker table, and the names of the columns in the worker table are the same as those in the emp table.

For example, copy all the contents of Table A to table B:

Step 1: Query Table A, for example:

 

Step 2: Use the subquery syntax to copy Table A to table B, for example:

 

Step 3: query the structure of Table B, for example:

 

Step 4: Query table B content, for example:

 

It is found that table B is exactly the same as Table.

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.