一、在介绍使用函数处理数据前,先说下使用DBMS(数据库管理系统)处理数据所带来的问题!

1、与几乎所有的DBMS都同等的支持SQL语句(如SELECT)不同,每一个DBMS都有特定的函数,事实上,只有少数几个函数被所有主要的DBMS等同的支持。

比如,像提取字符串的组成部分,ACESS使用MID();DB2、Oracle、Postgre和SQLite使用SUBSTR(),而MySQL和SQL SERVER使用SUBSTRING();

比如,数据类型的转换,Access和Oracle使用多个函数,每种类型的转换有一个函数;DB2和PostgreSQL使用Cast();MariaDB、MySQL和SQL Server使用CONVERT();

比如,获取当前日期,Access使用Now();DB2和PostgreSQL使用CURRENT_DATE;MariaDB和MySQL使用CURDATE();Oracle使用SYSDATE,SQL Server使用GETDATE(),SQLite使用DATE();

通过上面的例子我们可以看出,与SQL语句不一样,SQL函数是不可以移植的。这意味这特定SQL实现编写的代码在其他实现中可能不正常。

所以如果你在编写SQL程序的时候,需要考虑程序的可移植性,那么你在使用函数的时候一定要慎重,因为这些函数,在某些环境中可能没被实现,所以你在编写SQL代码的时候一定要写好注释,来说名这段代码是干嘛用的!以便于后续的开发或者库之间的移植!

2、下面是大多数SQL实现并支持一下的函数

(1)用于处理文本字符串(如删除或者填充,转换值为大写或者小写)的文本函数。

(2)用于在数值数据上进行算术操作(如返回绝对值,进行代数运算)的数值函数。

(3)用于处理日期和时间值并从这些值中提取特定成分(如返回两个日期之差,检查日期的有效性)的日期和时间函数。

(4)返回DBMS正使用的特殊信息(如返回用户登录信息)的系统函数

下面是常用的文本处理函数

1、LEFT()      ---返回字符串左边的字符

用法LEFT(计算字段,index),index表示向左查找开始的索引  如下代码:

select  cname,cno,tno from dbo.course where cno='c001'

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKUAAAAsCAIAAACL9u+dAAAElUlEQVR4nO2b227aTBDH56EStOVdogo74kEiIbXGkbjpK0SKmrYmn8Qz5KISEofcILVNm6bpBQpxCQZjy9+FT+vDYhs8tgk7GlWbZZn/sD9mbaMpWPtm7+UP3Ld2KBsft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jIof6prev1wTn8ETmHYiSifekU4eN7Y4l805f30HYlF82nHmM+o47HCvLOxE2Sy7IO77Fheoz2dbj69vDRvFjwp6qj9Orkzzu15Kvo55V8vqdBjZLrjjecfXt3nt7hXvZCB3O1B07cn3Hnefp7s8jrLIAyHp/bvWaKR+XknkzWpoUAcTPu7U0Ma/flw36wuw/fAMAOLdp1KT7VYg8f4dv6La5fluxT7b4z992POe9iXL+n/59Xga5AG+8bhv++5pVwd/X8Lpt+O/nVgV543Xb8Pq2Ksgbr6uG17dVQd54jTW8vq0K8sY2qEAbExxwM5NV2P//5lYR47wPyzjvw7L/AY6JiX+NvSvcAAAAAElFTkSuQmCC" alt="" />

现在我需要cname列值中'S'左边的字符串,下面是解决代码:

select LEFT(cname,2),cno,tno from dbo.course where cno='c001'

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAArCAIAAAC8Qy6KAAAE20lEQVR4nO1c3W7aShCeh2rRinepKuyIB6kUqQUi8RSVoqaJSSWeIReVqkNCbpBOmzZNcy6iECD8GFucC9vLsj/eNWbtpdlPK7Qej+cbdj8G44wCnz5/WenE09OT1vi7RVnZFs8rZYS9VgYASC2ZYJWBUZYyunWod1crECPOT2DHZ6m4AmXEdNtmqx0vURnD4ZA1DtpVdqNSPu4iQbB2oZLUtMHNtgDQvIN2tdoeFMnIQLsyHh8fGRt/l3Iqg3s5YeSqUSXbIkDz6leG9J3Cp89flstgNvd1jCAI/9z/R8fvHIB7zjoDgCgOWQNIT2pCRaAOPRfcTvZs5+duQu12/Fn/CKGjpktY5v6sf4Riw4G3g1W6bkbh0NGVBjrMKFeGvwyms4WOEQTh77s/VPzLJkLN6+lskXKTESHyxxM8556iHNhTmDdLttcNBI4XzTsOoIbXQpBYrloItS4Jn8smArezg1WKIy+mV7unw4xlKiMMw9vfdyJlcHc03a6iDNaoqAxOtniHuJZozlryrxKpjF3TYUYFZfjL5+lcxwjC8NftHRW/10Co0ac8AQC/cgfpgN1I/5Tak8IryfayhVC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RU5ErkJggg==" alt="" />

ok,完成需求!

2、RIGHT()   ---返回字符串右边的字符

用法和LEFT()方法相反

3、LENGTH() (也可以使用DATALENGTH()或LEN())      ---返回字符串的长度    SQL Server中可以使用DATALENGTH和LEN()

用法:如下代码:

select DATALENGTH(cname),cno,tno from dbo.course where cno='c001'

4、 文本处理函数之UPPER()函数      ---将字符串转为大写

用法:UPPER(计算字段),将计算字段所在的列值全部转换成大写字母,看如下代码:

select top 5 cname,cno,tno from dbo.course

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAAB6CAIAAADcTEMjAAANB0lEQVR4nO1d3W7buBLmQ7UB1+9SLGIHepACAfbYDuCnKFD0Z+0W8DP0YoEAdpIbA2e3u91uz0XQNJvEiePA50I/psihNCRFmbLmA9GqjEIOR5+GFDVfxd68+0iFStMLe/Pu48Ynrq+vvbbfWoTj2PotUXskHjcV4Ti2FTz+8eOH1/Zbi3AcW78lao/E46YiHMcSjwn2CMexreDx1dWV1/Zbi3AcK1uyGHU6o0WdPdbA4+/fv3ttv7UIx7GyJf55rI6dvXn38fFxvbxf+Sjr9dM/3/6ntP+hxxL0Jqvl+QnnJ4OeUHO/GmdnbM856nHGGOPDD4Pk4GJ5v1qen/DkxJ8G515GEWCxdqzgrqOxF0su4qvD+MmZHwPiHgEerx7Xd8sHH2W9fvr76z/59i/6nHXH8fGky3h/POQsrTkbcj6ci43ENWdDznj/7OFOPODD+fKiz3n/TPO7+1tsHbs9Zz7grDfxYkl2Ic68GBD3WCuPn56evvz9FR4kWJN3QYKYx1m9eCCexhhjKaf3vVg6FnS1P0v8GBD3CPF49Xh7d++jrJ+e/vryNdf+fMj5cCaeJtYkx5Mu4/25UJOdIx3Mh5z1fvVjfMjF0rGAq31a4seAuMdd8/juvM9Zdxwfp9MfwOOUneMeK+Cx2FqbOG3r2O05sz5n3YkXSwp4XIUBWh4/rB5vbpc+ynr99PnPL0r74266Duj+uryZDQ74YBb/KD2e9YX1Ah/MsnPUg21r/D8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LNGCCGmECNu2O30lNA5l16piBOERbTxdQsDGscC+cdGNJLT/60tsdWDlBpgwmNI4+SXx2Kab457kjZE+/C5GHWiqURcQRXCRCiKjwYSuXw2h+qKaWRBYowl1RpQyONdfa8pOQD/h4pFXmJU9r9YTCMWRZFwSjRKgjPA1MKJrRHA8xi5PLUjMcqSSg0w4LHwvaZJl/H+3Nv3mpK/88PKx9/0X/A5+TZlCQSwbbHI/pcg2+fzMIBfV6B0TZr9SXtLDPcr8AYU8Xh332tSHsPENUP+DoXPyXlOrJbInlfNFC5RGgH8cx5YJdWAQiw3S8x0TXgDingcvq6JICEcxwb0Po90TY1DOI4NiMeka2ocwnFsQDwmXVPjEI5jA+Ix6Zoah3AcGxCPCYSmACQ3e/Puo+f7h0DwDuIxYR9APCbsA4jHhH0A8ZiwDyAeE/YBxGPCPuD/B/BtqzCv42cAAAAASUVORK5CYII=" alt="" />

现在有一个需求,需要将cname列值全部转换成大写,下面是解决代码:

select top 5 UPPER(cname),cno,tno from dbo.course

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAAB7CAIAAAAXEJCGAAANVElEQVR4nO1d3W7bOBbmQ7WB1u9SDGIHfpACBaZ2AvhmX6FAsd3W7gB+hl4MUGz+bgzsTGc6ne5F0TQ/TuI48F7IoijykDwURYmSzwcicI5p8vDo0xFF8YPYplV4efhPKlTUwppmJoFQAdhms/nXv3+hQqXVZcvjoOfK5eVl0PZ3FvEEtn5PpB6Jxy1GPIHdCR7/+PEjaPs7i3gCW78nUo+t5zFj8q2qaukqiMccDfJ4PmTD+WbD9Ni6qLHzb6V2NTzedtclEI856uDxxcWFalxMeiqtDKlUR1/VruV955gMBrYRyJ4sJr3eZFFjj3Xw+Pv374oN5pQnj8GfC0bw3GkxoMA2A9mT8DyWetzy+OFhfXu3ClHW68e/v/5Pbn92wAbv1cqMMV07Yn4Va0ofpBakf6cDNpgFGWb9BQ7s3ftBFqXBbHV7dpQkR+OBYLlb3Z4dJVvDwTSIJ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vWEn1eglguUgQgN+eZjx7F75GNV15SW41ESUNckBA+YaJLqyQj8fR6y68wMrB+XuTLsrK7JDFI9SaDneRyka2ox4glsRDwmXVPrEE9gI+Ix6Zpah3gCGxGPSdfUOsQT2Ih4TCC0CFoe13n2ECpBPIGt2RPicacQT2CJx4TyiCewxGNCecQT2Jh57CCwce21APXxft6dRmgE1ARrpE+UC49mtZKkgtFrvLXBiT2lRFZVelKhA648dhwNutcC1F2Dw6Fuq5m8g0qoCdUpbvgx72AW+Y/dUtcwHHhc6TYdrCeN7BMyOeEHFx4vJr3hnEs/gG/FL4o1OUSZl7gB06yMkjfLVXMOB4UDj6veMorypJF9m7Ku6eyI70AOq2tSyak5kW01ObKw8J3MUhbufj720TVtKsrH2URNSr7B99FLuqbpAUsOT8K950b0WSCqLu6qUZ9b8+vUls6qvkOZHndofgzsP3aikbz9v7Qn+hTk6YALjyGNU2AeF/klj1IaOFRTaHI4l/gvXLu6Pa8wnNnCZx2NSpAY40m1Dhh5XPP7mtQ0y3MsOHBJaATXzFC8B1xMesOJ8BM7j9sxscDzGDk9LUdilCeVOuDAY+F9TbM+S0YnleuastsxVXqjBKG47mCqKTQuayHg20WxlYKEpLX5GJpXYJYLACGWpyeO6xV4B0w8buB9Tdu7ES750c/1C+epseYG+IH8E3l+nE0h5Slz7MDf54EmyQIKsfw8cdM14R0w8Th+XRNBQjyBjeh5HumaWod4AhsRj0nX1DrEE9iIeEy6ptYhnsBGxGPSNbUO8QQ2Ih4TCG2Byuwtj2s4hwiEcCAeE7oA4jGhCyAeE7oA4jGhCyAeE7qA/wMjQPyaG1QKJAAAAABJRU5ErkJggg==" alt="" />

ok,需求完成!

6、文本处理函数之LOWER()函数      ---将字符串转换成小写

用法和UPPER()函数相反!

7、SOUNDEX()      ---返回字符串的SOUNDEX值

SOUNDEX是一个将任何文本字符串转换描述其语音表示的字母数字模式的算法。SOUNDEX考虑了类似的发音字符和音节,使得能对字符串进行发音比较而不是字母比较!虽然SOUNDEX不是SQL概念,但多数DBMS都提供对SOUNDEX的支持!代码如下:

select * from student where sname='Michael Green'

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPgAAAAtCAIAAAAMQDHAAAAGJUlEQVR4nO1c3W6bSBQ+D5VGU96lioIjHqRSpRQTiaeIVG23wa3EM/QiUrX+yQ3StmnTNHsRxXHjP4yVvRjAAwNjGHuGqT2fRtFwDOebc/g4DNgTeE7w19+fdNNtVxuQQn8WidFoJNS/aryKQHL4ytJpoe84lFWeZDp5Qn98fBTqXzVeRSA5fGXptNB3HMoqTzKdFvqOQ1nlSaaTJ/ThcCjUv2q8ikBy+MrSyRP6w8ODUP+q8SoCyeErS5cR+mIRTWehiBZFy193/+X8952XAAAAyLmaDs4QOmu3sAFanXA6C6eDMxQbTjyJvF6yGVsGZwidtBA+5GMbJcdmRviyPRCSOrFpp4PNBAWAzvqVw6xCl9vMefZaGcZ4PEw6HqGHi2gynYtoUbT8efsr679jwok3nU/6DoITr+8gANObT7AFOb3plY1iS6+NoNWRxUt4wJa+gwDZfXxI0olHiOx+ybEKtPXh08ESaa8bZgW63GaBZ68FqN1ZjWFddGoJfblc3vy8zfq/snFpbF/lM5jKK2eRwxufhrSkESPJdcjdAACSc6ZMWx8+I9j6YVago5Jf4LljAlSpa5iOS+jhYjyZiWjRcvnj5rbQ/4UJAK2LnoOQ08VG3KctcngnHROQ3SsaSa7TcxC0LsRkTFLaGcHWD7MCHZV82nPPQQBQ4XRjOuWF3nNQnOKBjZDt0YIb2AhMbzaezLo2ArMji7djptn3WsAQOjHCsZKiXx9+jwo2F1SdMCtlO8NOe44tFyYge1AlOh6hz8PF03gqokXR8vr7Tc5/145vXId2/6nbPkTtLv4o7Xfbh/E9LflICm+6Q0xNjifXGXtmst/brpDUiU07HSyZ9lXmK4VZiw5vZj333yIA00vtyT4sOh6hz+bh76eJiBZFy2/XP8T5V41XkbZp+B9MMD1ls43puIQ+C0e/xyJaFEVfv30X5181XkUaV/gXx0SFP/1H3WxjOh6h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6htSldEO9mk5je6h1Vcj7/+gaGg1CC11jL6CFrrEX0ELX2AtooWvsBbTQNfYC/wMO81NRPoz/DAAAAABJRU5ErkJggg==" alt="" />

这个时候我们忘记sname的列值怎么拼了,只记得他的读音,这个时候使用SOUNDEX()函数就同样能检索出这条记录,代码如下:

select * from dbo.student where SOUNDEX(sname)=SOUNDEX('Michelle Green')

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAAAoCAIAAABPWuCHAAAF/ElEQVR4nO1c3W6bSBQ+D5VGU96ligIRDxKpUoqJxFNYqrZb467EM/QiUrX+yQ3StmnTNHsRxXHjP4zlvRjAwwyMAXuGWYdPo2g4hvPNOfP5MJBMYB3jjz//WovEeDwW6l81XkUgOfza6SDpNYI+SNSuMMl08gT99PQk1L9qvIpAcvi10zWCPnDUrjDJdI2gDxy1K0wynTxBj0Yjof5V41UEksOvnU6eoB8fH4X6V41XEUgOv3a6lKCXy3A2D0S0MFz9uv+X8j+wXwMAACD7eja8ROiyZWADGN1gNg9mw0sUGc5cibxufBhZhpcInRkIX/KpheJrUyN83RoKSZ3YtLPBpoICQJeDwmEWoaMOKc+ukWKMxsOl4wk6WIbT2UJEC8PVz7tfaf9dHc7c2WI6sBGcuQMbAejuYootyO7Pri0UWfotBEZXFi/hAVsGNgJkDfAlcScaIbIGOdcq0LaHzwZLpL1smAXoqMMMz64BqNXdjGFbdPUIerVa3f68S/u/tnCpa13TmUpkRFnk8EbpTkoUMRKqQ54GABDPjTJte/icYMuHWYCOSX6G564OUKR+YTquoIPlZDoX0cLV6sftXab/jg4ARqdvI2T3sBH3WYsc3mlXB2T1s0ZCdfo2AqMjJmOS0s4JtnyYBeiY5LOe+zYCgALTjemUEXTfRlEqhxZClssKa2gh0N35ZDrvWQj0rizerp5k2TWAI2hihBMlxb09/D4TLBVUmTALZTvFznqOLB0dkDUsEh1P0Itg+TyZiWhhuLr5fkv571nRDefYGjz3Wseo1cMfJf1e6zi6F8UfSeFNToioyfFQnYmrx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5jeFtUCd3xSu84UrUtDC9s80f8tRCxQRdOa6QsZDobj9M02FrgWKCFoaFy1ocVtlmgpdC166oMXtlmkqdC146YIWDWh2YTXYEzJVLu//QzdoIAGNoBscFP4Dlb0H/Brc2XEAAAAASUVORK5CYII=" alt="" />

ok,完成检索!

8、日期和时间处理函数DATEPART()函数

在使用日期和时间处理函数编写程序前,需要注意一点,不同的DBMS都有自己特有的时间和日期格式,所以他们很不一致,可移植也非常差!

有如下代码:

select * from tb_order

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXsAAADqCAIAAADMEXIOAAAgAElEQVR4nO1dy47kOnLVT7mhW//ixWQW+kO8m6xqoL7CG9vdWW0gf2Mw9ehNAp73nfHCuI/penY15EWqlBQZEQpSfESJcZAY9E2FFCdI6hTFFM80nUKhUORC8x//9d/60Y9+9JPn06QTs19//TXdxecgMzGx7eAFyVVI5lY53K5RxVlaukSQXIVkbpUjq+L88ssv6S4+B5mJiW0HL0iuQjK3yuF2jSrO0tIlguQqJHOrHAIUZ/e+6XFyscdP3l+ckMfhGM5Zb0VxeLVkg+S7OkcLC+uOt4KsivPzzz/bX+3eN8373eHf+4sTQnRSKg5AjJ/CHx7pYqeOmCiwCn72wz+Cqs7RwliwKhEJt2sSKs5PP/00/sLpnN37QX9spFQch1haBKYTpjipGs3KHlR1jhZWxQmC2zXNw+Nzis/Ly/e//+N/v317OX55+6FtTrdm2OGb2w9te7pum+bw79eHrqb9cNPHHPDD2e3zgxVsx7ye5Uusv2bTHBia3/QX/Lx+zbC+HMgbxPjpRuda6TxbgGI1XPm1QQ7/vv3Qth/O1sNZX85GZYZV0TSvVx7lenzeDvwODIns4zY/WzfN+vMh0XbdtOdfyrSwEzyuaNx6vCFRz+fQNbbi3D88pfi8vHz/249/f/72cvzy5rxtz69HYZer5nR7c9427ebm6f7hy6ZtVtun+4en++1p055fP3zZtIdDr6cfg4cLumf5E3u95vVZ26wvj9+4KR4uV027uXGI8dMZV7PT+bUAyMq58sDteP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zHFyPYYEIOC3KqOGtD+9UWqIPhcRK6N4z7qnE13mZgfy0sEdfVPwnqrsYOJHNPyQdWXWXxBYcTiuo8g3MV1HkW+SYN77OGOBiL2OQ73+UxQ+77wcK9rBFpaZuO0gK8/o7+NgXQZmx8Y4HGyfMDnR4AY7/TLZZeiMkACsOOo6urB0iSC5CsncagaiOOo6uqx0iSC5CsncagasOOo6urB0iSC5CsncagasOOo6urB0iSC5Csncagb2zrG6ji4qXSJIrkIyt5oBKw5sFqhQKBSzAShOZoWTgMzExLaDFyRXIZlbzVDF6aGKEwDJVUjmVjNUcXqo4gRAchWSudUMVZweqjgBkFyFZG41A+yX/wdGDZDBNasHpgAAAABJRU5ErkJggg==" alt="" />

现在有一个需求,需要检索2016年的所有订单数,下面是解决代码:

select * from tb_order where DATEPART(YY,orderdate)=2016

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAACdCAIAAAA46lQOAAAYXklEQVR4nO1d7W4jtxXlQzXGxO9SFJGMfZAAAVLZBvYpChRtd6UtoGfIjwJB/fXHQNu0aZr+CLLZriXba2P6Y6T5IHkvLymScz28B4PA0XDIc3k5RxxqeFbVdV3X9R/+9Gc55JBDjgyHakWnTokPHz4krT8YmYmx7QcvcI6CM7fC0aZGREdExxuco+DMrXDkFp1ffvklaf3ByEyMbT94gXMUnLkVjjY1IjoiOt7gHAVnboWDh+isX6kdjl/fwhffvj5Gz9vLUK56KaJDiyUbON/YOXqYWTpeCnKLzvv37/WP1q+UerVu/r59fYzoTkrRsRCjN+EPj+ZiNx2xocAo6K03fwRFnaOHocIiRija1GQSnZ9//nn4gZGf9atWgnSkFB2DWFoENsdMdFJ1mtZ6UNQ5elhEJwhtajrR+fTpaXv/mOJ4enr+z4//HdR/fV6pk2W/WPPJ9XlVncwrpZq/909fqjq/2pVp8Pnp9eNWK6yX2V/lS2xXp1INw/4nuwrfzfctzFct+R4xenODa7XmPHsAY9XWvO+Q5u/r86o6P523V92cDsIMi0Kpfc2Dtu4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Fh0xK50Ws0lAucoOHMrGaDoiF3pxJpLBM5RcOZWMkDREbvSiTWXCJyj4MytZCBvJItd6aSaSwTOUXDmVjJA0REIBIIU6AtQJzrZNE8gEJQMER2BQJAVIjoCgSArRHQEAkFW/B+nCY7Va2/J8wAAAABJRU5ErkJggg==" alt="" />

ok,需求完成!

9、下面是常用的数值处理函数

ABS()      ---返回一个数的绝对值

COS()      ---返回一个角度的余弦

EXP()      ---返回一个数的指数值

PI()      ---返回圆周率

SIN()      ---返回一个角度的正弦

SQRT()      ---返回一个数的平方根

TAN()      ---返回一个角度的正切

SQL学习之使用常用函数处理数据的更多相关文章

  1. Python学习笔记之常用函数及说明

    Python学习笔记之常用函数及说明 俗话说"好记性不如烂笔头",老祖宗们几千年总结出来的东西还是有些道理的,所以,常用的东西也要记下来,不记不知道,一记吓一跳,乖乖,函数咋这么多 ...

  2. 【转】JNI学习积累之一 ---- 常用函数大全

    原文网址:http://blog.csdn.net/qinjuning/article/details/7595104 本文原创,转载请注明出处:http://blog.csdn.net/qinjun ...

  3. [SQL SERVER系列]之常用函数和开窗函数介绍及实例

    本文主要介绍SQL SERVER数据库中一些常用的系统函数及其SQL SERVER 2005以上支持的开窗函数. 1.常用函数 --从字符串右边截取指定字符数 select RIGHT('HELLO' ...

  4. JNI学习积累之一 ---- 常用函数大全

    主要资料来源: 百度文库的<JNI常用函数> . 同时对其加以了补充 . 要素  :1. 该函数大全是基于C语言方式的,对于C++方式可以直接转换 ,例如,对于生成一个jstring类型的 ...

  5. numpy学习笔记 - numpy常用函数、向量化操作及基本数学统计方法

    # -*- coding: utf-8 -*-"""主要记录代码,相关说明采用注释形势,供日常总结.查阅使用,不定时更新.Created on Fri Aug 24 19 ...

  6. PL/SQL学习笔记_03_存储函数与存储过程

    ORACLE 提供可以把 PL/SQL 程序存储在数据库中,并可以在任何地方来运行它.这样就叫存储过程或函数. 存储函数:有返回值,创建完成后,通过select function() from dua ...

  7. 用Excel做数据分析常用函数(数据清理、关联匹配……)

    本文总结在使用Excel进行数据分析时,最常用的功能和函数. Excel的功能和函数非常多,用进废退,除了学习基本的函数和功能,最重要的是遇到问题可以快速的搜索并解决. 首先Excel可以处理的数据量 ...

  8. Sql注入截取字符串常用函数

    在sql注入中,往往会用到截取字符串的问题,例如不回显的情况下进行的注入,也成为盲注,这种情况下往往需要一个一个字符的去猜解,过程中需要用到截取字符串.本文中主要列举三个函数和该函数注入过程中的一些用 ...

  9. python学习总结----内置函数及数据持久化

    抽象基类(了解) - 说明: - 抽象基类就是为了统一接口而存在的 - 它不能进行实例化 - 继承自抽象类的子类必须实现抽象基类的抽象方法 - 示例: from abc import ABC, abs ...

随机推荐

  1. C语言的本质(12)——指针与函数

    往往,我们一提到指针函数和函数指针的时候,就有很多人弄不懂.下面详细为大家介绍C语言中指针函数和函数指针. 1.指针函数 当一个函数声明其返回值为一个指针时,实际上就是返回一个地址给调用函数,以用于需 ...

  2. SEO人员应该突破的5大思想误区

    1.外链误区 很多人在做网站优化的时候容易陷入外链怪圈,认为外链就是网站优化的一切,只要做好外链排名就会上去,让他不做外链了他将不知道做什么.特别是外链专员和一些初级SEO人员,优化网站只知道到哪里发 ...

  3. js计算时间差,包括计算,天,时,分,秒

    收集两个计算时间差的计算方法代码片段: var date1=new Date(); //开始时间 var date2=new Date(); //结束时间 var date3=date2.getTim ...

  4. 配置自己风格的Clang-Format-Xcode

    在项目根目录下,创建一个文件.clang-format,使用vim打开并修改. 具体的配置风格可以看这里:http://clang.llvm.org/docs/ClangFormatStyleOpti ...

  5. update慢怎样处理?

    update慢: 1.表的pctfree參数设置? 2.运行计划用索引还是全表扫? 3.SQL语句写法问题? 4.update慢还是commit慢? 5.更新多少条数据? 6.表是否频繁update造 ...

  6. 简单实现仿UITabBarController界面

    第一步:添加两个占位View 第二步:添加子控制器 第三步:添加按钮 #import "ViewController.h" #define SCREEN_WIDTH ([UIScr ...

  7. 简单的CSS网页布局--一二列布局

    1.一列布局 (一)一列自适应 自适应浏览器,随着浏览器的拉伸而变化,一般宽度采用百分比的写法,很简<!DOCTYPE html> <html> <head lang=& ...

  8. 第10课_dg

    export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1 export ORACLE ...

  9. 关于智能指针auto_ptr

    智能指针auto_ptr和shared_ptr也是面试中经常被问到的一个 感觉看auto_ptr的源码反而更加容易理解一些,因为源码的代码量并不大,而且比较容易理解. 本篇主要介绍auto_ptr 其 ...

  10. Linux学习之sed命令详解

    概述 sed是stream editor的简称,也就是流编辑器.它一次处理一行内容,处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区 ...