Oracle Language Foundation

Source: Internet
Author: User

First, language classification

1.DML (Data Manipulation Language): Used for data manipulation.

  DML includes: (1) SELECT: query data

Select *  from temp;

(2) INSERT: Add data to Database

Insert  into Temp Values (4,' Harry ');

(3) UPDATE: Used to modify existing data from the database

Update Temp Set name=' zhu 'where name=' Harry ';

       (4) Delete: Used to delete data from the database

Delete  from Temp where id=3; -- The from can be omitted, and all data in the table is deleted when the WHERE clause is not added. 

2.DDL (data definition Language): A structure used to define data, such as creating, modifying, or deleting database objects.

  DDL includes: (1) Create: creating

Create Table Temp(IDint, namevarchar2( -));--Create a new table from existing data--CREATE table new table name as Select column name from source table name;Create Table Temp  as Select *  fromstudent;--View information for a table User_tablesSelect *  fromuser_table;

(2) Alter: Modify

--modifying the properties of a column--ALTER TABLE table name modify Column Name propertyAlter Table TempModify Namevarchar2( +);--When you change the data type, the column you want to modify must be empty--Add new Column--ALTER TABLE name add column Name propertyAlter Table Temp AddAgeint;--give rename a name--ALTER TABLE name rename column name to new column nameAlter Table TempRenamecolumnName toName--Name is old column name, name is new column name--Delete Column--ALTER TABLE name drop column name;Alter Table Temp Drop columnAge

       (3) Drop: Delete

Drop Table temp;

       (4) MODIFY: Modifying Column Properties

Alter Table Temp varchar2 (a); -- When you change the data type, the column you want to modify must be empty

(5) RENAME: Renaming

-- give rename a name Alter Table Temp column  to name; -- Name is old column name, name is new column name -- Renaming a table -- rename old table name to new table name Temp  to Temp1;

     (6) Comment: Add notes

-- comment on table name is ' Memo info '  on Table Temp  is ' Temp Table ' ; -- --View the table notes: User_tab_comments Select *  from User_tab_comments;

3.DCL (Data Control Language): Used to define permissions for database users.

 The DCL includes: (1) GRANT

Grant  to test;

      (2) REVOKE

Revoke  from Test;

Two. Frequently Asked questions

  1.char differs from VARCHAR2: Char is a fixed-length string that is populated with spaces when the length of the stored string is less than the specified string length. VARCHAR2 is a variable-length string, and the stored string length is less than the specified string length without a space supplement.

2. In Oracle, when you use a query, you must use the "Select ... from ..." full syntax, when querying a single row of data, the dual table is used after the from, and the dual table has only one row in the system, which is used to complete the syntax for outputting a single row of data.

3. The value of the character type is case-sensitive and all the table name names are stored in uppercase.

4. All values of non-numeric types are enclosed in single quotation marks.

Oracle Language Foundation

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.