DataBase

My SQL 공부 3(UPDATE, DELETE)

JihyunLee 2019. 5. 2. 13:59
반응형

UPDATE

The UPDATE statement is used to modify the existing records in a table

Customer Id 가 1인 사람의 city와 CustomerName 변경하기

UPDATE Customers
SET City = 'Berlin', CustomerNaume ='Amy'
WHERE CustomerID = 1;

*WHERE 구문을 빠뜨리면, 전체 tuple이 변하게 된다.

 

DELETE

The DELETE statement is used to delete existing records in a table.

CustomerName 이 Amy인 사람의 tuple 삭제하기

DELETE FROM Customer WHERE CustomerName='Amy'

* WHERE 구문이 없으면 전체 tuple이 삭제된다.

*UPDATE는 FROM이 없고, DELETE만 있다.

반응형