www.bersaty.com

随笔分类 -  MySql

摘要:使用数据处理函数:/*Upper返回大写*/select vend_name,Upper(vend_name) as vend_name_upcasefrom vendorsorder by vend_name;常用文本处理函数:Left() 返回左边的字符;Length() 返回串的长度;Loca... 阅读全文
posted @ 2014-12-02 14:17 bersaty 阅读(158) 评论(0) 推荐(0) 编辑
摘要:拼接:/*连接和使用别名*/select concat(vend_name,'(',vend_country,')') as vend_titlefrom vendersorder by vend_name;执行算术计算:/*quantity*item_price形成一个新列expanded_price*/select prod_id, quantity, item_price, quantity*item_price as expanded_pricefrom orderitemswhere order_num = 20005; 阅读全文
posted @ 2013-08-23 14:20 bersaty 阅读(164) 评论(0) 推荐(0) 编辑
摘要:检索不同的行:select vend_idfrom products;/*返回不同的值*/select distinct vend_idfrom products;限制结果:limit/*limit 5 指示sql返回不多于5行*/select vend_id from products limit 5;/*指定要检索的开始行和行数*/select prod_name from products limit 5,5;检索排序:order by/*从小到大*/select prod_name from products order by prod_name;/*按多个列排序*/select p. 阅读全文
posted @ 2013-08-22 10:03 bersaty 阅读(230) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示