From the course: SQL Server 2008 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Writing DELETE statements

Writing DELETE statements - SQL Server Tutorial

From the course: SQL Server 2008 Essential Training

Start my 1-month free trial

Writing DELETE statements

A while ago I mentioned that there is an acronym that you'll occasionally come across with SQL databases which was that of CRUD for create, read, update and delete. Create obviously being the INSERT INTO statement, read being our SELECT, update being UPDATE, and we might as well finish it off with some DELETE. DELETE has an associated word. Like we have UPDATE, SET and INSERT INTO and SELECT FROM, we have DELETE FROM and in fact DELETE is probably as close to SELECT as you're going to find. In fact this is about the simplest statement there is. We say we're going to DELETE FROM a particular table. In this case I'm going to DELETE FROM SalesLT.ProductCategory and I want to be very careful here because if I hit F5 right now, I would go and delete every row in this table. The same way that if I said SELECT * FROM we bring back everything, this would delete everything, and certainly one of the dangers with using SQL Server management studio or having just admin level access to a database.…

Contents