The Wayback Machine - https://web.archive.org/web/20071011015518/http://www.sqlcourse.com:80/delete.html


Free Newsletters:
DatabaseJournal
DBANews
 

SQLCourse
Interactive Online SQL Training
HOME News MS SQL Oracle DB2 Access MySQL PHP SQL Etc Scripts Links Forums DBA Talk
internet.com
SQL Courses
1 What is SQL?
2 Table basics
3 Selecting data
4 Creating tables
5 Inserting into a table
6 Updating records
7 Deleting records
8 Drop a table
9 Advanced Queries
10 Standalone SQL interpreter
11 Advertise on SQLCourse.com
12 Database Links
13 Technology Jobs




internet.commerce
Partner With Us
Promotional Gifts
Web Hosting Directory
Promote Your Website
Laptop Batteries
Free Credit Score
Build a Server Rack
Corporate Awards
Web Hosting
Cell Phone Plans
Laptop Battery
Marketing Products
Server Racks
KVM Switch over IP
Internet Security

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Innotas Whitepaper: Projects are Investments--Project Portfolio Management (PPM) Is Not Just About Projects. Learn why it is vital to include & manage app tasks & resources in the project portfolio.

Deleting Records

The delete statement is used to delete records or rows from the table.

delete from "tablename"
where "columnname" OPERATOR "value" [and|or "column" OPERATOR "value"]; [ ] = optional

[The above example was line wrapped for better viewing on this Web page.]

Examples:

delete from employee;

Note: if you leave off the where clause, all records will be deleted!

delete from employee
  where lastname = 'May';

delete from employee
  where firstname = 'Mike' or firstname = 'Eric';

To delete an entire record/row from a table, enter "delete from" followed by the table name, followed by the where clause which contains the conditions to delete. If you leave off the where clause, all records will be deleted.

Delete statement exercises

(Use the select statement to verify your deletes):

  1. Jonie Weber-Williams just quit, remove her record from the table.
  2. It's time for budget cuts. Remove all employees who are making over 70000 dollars.

Create at least two of your own delete statements, and then issue a command to delete all records from the table.

Answers to exercises

SQL Interpreter


SQL Course Curriculum
<<previous 1 2 3 4 5 6 7 8 9  next>>


Solutions


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info