Quick introduction to Oracle SQL

Source: Internet
Author: User

There are many things worth learning about in Oracle. Here we mainly introduce the Oracle SQL language, including the introduction of Plus and so on. In the Visual Window environment of Oracle Enterprise Manager, although we can do these tasks conveniently, in fact, it is more efficient to write data in Oracle SQL !! SQL * Plus provided by Oracle is a good tool. If you like the development environment of Windows, use SQLPlus Worksheet! Let's talk about some basic things!

The Structure Query Language (SQL) is a structured Query Language and the core Language of a database. It is a set-oriented descriptive non-procedural Language. Oracle SQL is divided into four categories: Data Query Language DQL, Data Control Language DML, Data Definition Language DDL, and Database Control Language DCL.

1. The basic structure of the Data Query Language DQL is a query block consisting of the select clause, from clause, and where clause:
Select <field name table> from <Table or view Name> where <query condition>

2. Data manipulation language (DML ):
Insert: add data rows to the table
Delete: delete data rows from a table
Update: change table data

3. Data Definition Language DDL defines the structure of the database, including the database itself, data tables, directories, views, and other database elements (below are some common DDL statements)
Create table: create a table
Create index: create an index
Create view: create a view
Alter table: Add a table column, redefine the table column, and change the storage allocation.
Drop table: delete a table
Drop index: delete an index

4. The Database Control Language DCL is used to grant or revoke certain privileges for accessing the database, control the time and Effect of database operations, and monitor the database. For example:
Grant: grant permissions or roles to users or other roles
Revoke: revoke User Permissions
Roll: rollback refers to the protection action taken by Oracle when a dialog changes the data in the database and the user does not want to submit the change for some reason. This is a state that restores information to the last submitted state before update, insert, and delete.
Commit: Submit. When you insert, delete, and modify a database, it is only after the transaction is committed to the database. Only the database owner can see the transaction before it is committed, only after the final submission is complete can others see it. The preceding four Oracle SQL languages are used.

Next, let's take a look at SQL * Plus to lay a solid foundation for what we will do below. After logging on to SQL * Plus using system, we will perform the following operations:

 
 
  1. SQL>Create user maxuan identified by max; # create a maxuan user with the max password
  2. SQL>Grant connect, resource to maxuan; # authorize maxuan
  3. SQL>Conn maxuan/max; # connect to maxuan
  4. SQL>Create table test (a number); # create A table named test. Only one column with the field name a is created, and the data type is Numeric.
  5. SQL>Insert into test values (1); # insert a record
  6. SQL>Select * from test; # query the record. The first row of column A is 1.
  7. SQL>Update test setA=2; # Change Record. At this time, the first row of column A has been changed to 2
  8. SQL>Commit; # submit
  9. SQL>Delete from test; # delete all records in the test table. At this time, there are no records in the test table.
  10. SQL>Roll; # roll Back to submit, and then query the test table. The value of the first row of column A is returned to 2.
  1. Redo Oracle log files
  2. High theory of Oracle Buffer Optimization
  3. Oracle CPU usage Optimization
  4. Overview operating system Oracle Optimization
  5. How Oracle reduces Shared Server Processes

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.