当前位置:网站首页>Oracle update and delete data
Oracle update and delete data
2022-07-29 04:28:00 【zhiyou-rookie】
oracle Update and delete data
except DBMS Common queries in (SELECT), Insert (INSERT) Out of operation , The database also has some operations, such as : to update , And delete data .
1. Update data
To update ( modify ) Table data , have access to UPDATE sentence . Use UPDATE There are two ways :
- Update specific rows in the table
- Update all rows in the table
Warning : Don't omit WHERE Clause
In the use of UPDATE Special care must be taken when , Because it is very easy to update every row in the table by mistake .
UPDATE Examples of use :
UPDATE customers
SET cust_email = '[email protected]'
WHERE cust_id = 10005;
When updating multiple columns , Only a single SET command , And separate each with a comma column = value Yes ( There is no need to specify a comma after the last column ).
Tips : stay UPDATE The subquery is used in the statement
stay UPDATE You can use subqueries in statements , Allow to use through SELECT The data retrieved by the statement updates the column .
To delete the value of a column , You can set it to NULL.
UPDATE customers
SET cust_email = NULL
WHERE cust_id = 10005;
2. Delete data
To delete from the table ( remove ) data , have access to DELETE sentence , There are two ways :
- Delete specific rows from the table
- Delete all rows from the table
DELETE Do not accept column names or wildcards , He will delete the whole line , Instead of deleting columns .
Be careful : Is the table content , Not a watch
DELETE Statement will delete rows from the table , Even all rows in the table , however DELETE Never delete the table itself .
3. Guidelines for updating and deleting data
- Never perform without WHERE Clause UPDATE or DELETE, Unless you really intend to update and delete each row .
- Ensure that each table has a primary key ( If you forget what this is , See page 15 Chapter ), And whenever possible , Just use it as WHERE Clause ( You may specify each primary key 、 Multiple values or value ranges ).
- In combination WHERE Clause and UPDATE or DELETE Before , First of all, make use of SELECT Test it , To ensure that it filters out the correct records —— Write incorrect WHERE Clauses are much easier .
- Referential integrity implemented using the database ( See also page 15 Chapter learn about it ), If the rows to be deleted have data associated with them in other tables , that Oracle Deletion will not be allowed .
Warning : Careful use
The most important thing is ,Oracle No, Undo( revoke ) Button . Use it very carefully UPDATE and DELETE, Otherwise, you will find yourself updating and deleting the wrong data .
边栏推荐
- Use of torch.optim optimizer in pytorch
- Log configuration logback
- Object detection: object_ Detection API +ssd target detection model
- MySQL - 聚簇索引和辅助索引
- C语言:浅谈各种复杂的声明
- Whether the modification of import and export values by ES6 and commonjs affects the original module
- visio画网格
- 12.优先级队列和惰性队列
- C language force buckle question 61 of the rotating list. Double ended queue and construction of circular linked list
- 不会就坚持65天吧 只出现一次的数字
猜你喜欢

Back propagation process of manual BP neural network

Redux quick start

Code or script to speed up the video playback of video websites

Whole house WiFi solution: mesh router networking and ac+ap

It won't last for 65 days. It only appears once

不会就坚持60天吧 神奇的字典

Jenkins 参数化构建中 各参数介绍与示例

Machine vision Series 2: vs DLL debugging

你真的会写Restful API吗?

MySQL - 深入解析MySQL索引数据结构
随机推荐
【Express连接MySQL数据库】
Can you really write restful API?
Deploy Jenkins using containers
12.优先级队列和惰性队列
9.延迟队列
Multi card training in pytorch
Opengauss pre check installation
Leftmost prefix principle of index
Locally call tensorboard and Jupiter notebook on the server (using mobaxterm)
What is the use of meta-info?
Definition and implementation of stack and queue (detailed)
顺序表和链表
Code or script to speed up the video playback of video websites
C language: typedef knowledge points summary
Why are there so many unknowns when opengauss starts?
Down sampling and up sampling
MySQL - 聚簇索引和辅助索引
Won't you just stick to 62 days? Sum of words
Understand the Internet giant [the war between China and Taiwan] and the development thinking of China and Taiwan
Make a virtual human with zego avatar | virtual anchor live broadcast solution