English | 正體中文 | 简体中文

SQL select


范例资料表 : 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
选出'Artist'栏位

Sytax : SELECT col_name FROM table_name
SQL
SELECT Artist FROM Songs

会输出结果
Artist
Scott Mckenzie
Kiss
R.E.M.
Pink


Example
选择出多个栏位

Sytax : SELECT col_name1, col_name2.. FROM table_name
SQL
SELECT Artist, SongPlayCount FROM Songs 

会输出结果
Artist SongPlayCount
Scott Mckenzie 30
Kiss 120
R.E.M. 256
Pink 97


Example
选择所有栏位

Sytax : SELECT * FROM table_name
SQL
SELECT * FROM Songs 

会输出结果
Artist SongTitle SongPlayCount
Scott Mckenzie San Francisco 30
Kiss Detroit rock city 120
R.E.M. Losing my religion 256
Pink Try 97

© 2012 PureExample.com contact