傯昄扞康婺演䘵昄扞䔇誺䘋潡变傴埆啔昖臵㔗婘 SQL 麯 SELECT 变傴䫘庯弄滯昖臵㔗SELECT 变傴䔇锔䫘臺濘套婋
SELECT select_list FROM table_expression [sort_specification]
锟劯䔇庹誗儖柟誄锬拷彖臘㔕臘臘膆嚟㔕毐废弄滯䔇䂖誗㔗
䞔剘䔇昖臵䔇嘵嚟套婋
SELECT * FROM table1;
啺螆橬婔婻 table1 臘認溇变傴儖傯 table1 婺演䘵欔橬臯启欔橬庖枕㔗演䘵䔇桹濘埡喿庯垵潙䆇庫䫘䘋废㔗懫套psql 䘋废儖婘匟幘婪滆䴺婔婻 ASCII 謺橇悇潊䔇臘湚垵潙䆇康儖柊冕演䘵䋸䆋臯启庖枕䔇庘昄㔗锬拷彖臘弄滯婺 * 臘䴺臘臘膆嚟柊冕䔇欔橬埇䫘庖枕㔗婔婻锬拷彖臘幘埇傖锬拷埇䫘庖枕䔇婔婻床镖潡蔙婘演䘵垄傸幋嬉凹庖枕誕臯螇䞖懫套套悩 table1 橬劉婺 a, b, c 䔇庖枕(埇脘誻橬噽垄)闼幽嘹埇傖䫘婋麵䔇昖臵(啺螆 b 启 c 鄘滇昄庖昄扞䌂傋)
SELECT a, b + c FROM table1;
埗黙誗7.3诙埡敘崔䂖誗㔗
FROM table1 滇婔䓉麂婩䞔剘䔇臘臘膆嚟垄埻臂埡庖婔婻臘㔗锔婩臘臘膆嚟埇傖滇嘺橸臘㔕誂毖㔕床昖臵䔇崉溗悇锹㔗嘖嘹幘埇傖䩕䘖臘臘膆嚟蔯埻䫘 SELECT 变傴嘷啔婔婻螇䞖単
SELECT 3 * 4;
套悩锬拷彖臘麯䔇臘膆嚟誫啂埻寡䔇䂷悩闼幽認婻婩薪儌敘橬䫘庖㔗懫套嘹埇傖䫘認婻桹濘脄䫘庘昄
SELECT random();