The ascending order of SQL

Source: Internet
Author: User

The basic database operation simply can't meet the actual need, need to introduce more operation.

Trigger - implicitly, proactively, updates the information in the data table. Two temporary tables with inserted and deleted, representing both new and old operations.


It is a special kind of stored procedure that cannot be called explicitly, but is automatically activated when a change is made to the table. Triggers can be used to implement complex integrity constraints on a table.
The use of trigger statements--a couple of examples that allow you to quickly master the application of triggers.

Index - improve query data for a database


      Indexing is a mechanism for improving database query speed, which is a database of tables or views that are created in ascending or descending order according to the value of a keyword end. When a user queries an indexed object, it can perform a retrieval operation quickly. The
      CREATE INDEX command creates the following indexes:
      Create [unique][clustered|nonclustered]  Index index_name On{table|view} colunm{asc|desc}[,... n][with < index_option > [,... N]]  [on filegroup]

For example:
Create unique clustered index PK_ table name//Note This can be your own attention to name
On table name (column name)
With
PAD_INDEX,FILLFACTOR=10,
Drop_existing

creating indexes can greatly improve the performance of the system, mainly in the following aspects:

1, create a unique index that guarantees the uniqueness of each row of data.
2, through the index, can greatly accelerate the retrieval speed of data.
3, the index can accelerate the connection between the table and the table, so as to effectively achieve the referential integrity of the data.
4, when using grouping and sorting words for data retrieval, you can reduce the query time.
5, by using the index, you can improve the performance of the system by using the optimized hidden device during the query process.

Rollback-database or, when an application error occurs, the databases can be restored.

Rollback performs the opposite operation, and the operation can be undone to ensure the integrity of the data. Rollback refers to restoring the state of a database to the state before it was executed.

Types of data backup


Full backup, differential backup, Thing diary backup, incremental backup.

Cursors - reference


Cursors allow the application to perform the same or different operations on each row in the rows result set returned by the query statement Select, rather than one operation for the entire result set at a time, and it also provides the ability to delete or update data in the table based on the cursor position.
(a bit of divide and conquer means.) )

Its disadvantage is that when dealing with large amounts of data, inefficient, compared to memory. In general, it is best not to use cursors when working with data in other ways, unless you are using a while loop, subqueries, temporary tables, table variables, self-built functions, or other methods to handle an operation, and then consider using cursors

What happens when the database log is full?


Log files record changes to all database data. Once full, only query operations can be performed.

Concurrency environment guarantees data consistency


Concurrency generally refers to multiple users accessing the same data at the same time. Data consistency refers to the fact that every user in the system has access to the data that is consistent, as well as the changes to the data that they or other users commit to the transaction.
In the concurrency environment, there are many mechanisms that can be used to ensure data consistency. For example, transactional-level consistency, row-level locks, table-level locks.
With row-level locks, a wait is generated when an attempt is made to modify a row that does not commit a transaction update. The second transaction waits for another transaction to commit or revoke to release its lock in order to update the given row.

See which user inserts a row of data into the database


1, audit function.
2, Trigger.
Create of Replace trigger Tgname after insert in tbname for each row begin insert into TA (date) VALUES (sysdate) commit; End
3, view by LOGMNR log
LOGMNR is an analysis tool provided by Oracle Corporation.

Reference: Programmer interview written books, Baidu know, csdn and so on.

The ascending order of SQL

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.