Mysql与Oracle的删除修改语法差异示例

一、修改

        MysqL:   两个表关联

示例1:

UPDATE IOV_CAR_INFO TT
JOIN IOV_CAR_PARTS C ON TT.VIN = C.FRAMENUM 
SET TT.EXTRACT = 0 
WHERE
	TT.EXTRACT = 2

 示例2:

UPDATE  `test_user` u
INNER  JOIN
(SELECT u.id,d.city_id FROM test_department d INNER JOIN `test_user` u on u.dept_id=d.id  WHERE u.enabled=0 and d.enabled=0) t
on t.id=u.id
SET u.city_id=t.city_id
WHERE
u.enabled=0
and u.dept_id is not null;

        Oracle:

        示例1:

UPDATE IOV_CAR_INFO  TT 
SET TT.EXTRACT = 0 
WHERE
	TT.ID IN (
	SELECT
		T.ID 
	FROM
		IOV_CAR_INFO T
		JOIN IOV_CAR_PARTS  C ON T.VIN = C.FRAMENUM 
WHERE
	T.EXTRACT = 2)

二、删除

        MysqL

示例1:

DELETE T 
FROM
	IOV_LIFECYCLE T
	LEFT JOIN IOV_CAR C ON T.VIN = C.VIN
	LEFT JOIN IOV_DEVICE D ON D.IOV_CAR_ID = C.ID 
WHERE
	D.ID IS NULL

        Oracle:

示例1:

DELETE 
FROM
	IOV_LIFECYCLE TT 
WHERE
	TT.ID IN (
	SELECT
		T.ID 
	FROM
		IOV_LIFECYCLE T
		LEFT JOIN IOV_CAR C ON T.VIN = C.VIN
		LEFT JOIN IOV_DEVICE D ON D.IOV_CAR_ID = C.ID 
WHERE
	D.ID IS NULL)

相关文章

Java Oracle 结果集是Java语言中处理数据库查询结果的一种方...
Java AES和Oracle AES是现代加密技术中最常使用的两种AES加密...
Java是一种广泛应用的编程语言,具备可靠性、安全性、跨平台...
随着移动互联网的发展,抽奖活动成为了营销活动中不可或缺的...
Java和Oracle都是在计算机领域应用非常广泛的技术,他们经常...
Java 是一门非常流行的编程语言,它可以运行于各种操作系统上...