English | 正體中文 | 简体中文

SQL delete


范例资料表 : Songs (以下范例皆用此表当作资料来源)
Artist SongTitle SongPlayCount
Scott Mckenzie San Francisco 30
Kiss Detroit rock city 120
R.E.M. Losing my religion 256
Pink Try 97


Example
用WHERE子句删除某个特定的资料列

Sytax : DELETE FROM table_name WHERE search_condition
SQL
DELETE FROM Songs WHERE Artist = 'R.E.M.'

会输出结果
Artist SongTitle SongPlayCount
Scott Mckenzie San Francisco 30
Kiss Detroit rock city 120
Pink Try 97


Example
删除资料表中的所有资料列

Sytax : DELETE FROM table_name
SQL
DELETE FROM Songs

会输出结果 (所有资料列已被删除)
Artist SongTitle SongPlayCount
     

© 2012 PureExample.com contact