Python SQL Example Code
Python SQL Example Code

SQL example code for Python, as shown on [SQL Programming Guide](https://spark.apache.org/docs/1.0.2/sql-programming-guide.html)

Author: jyotiska <jyotiska123@gmail.com>

Closes #2521 from jyotiska/sql_example and squashes the following commits:

1471dcb [jyotiska] added imports for sql
b25e436 [jyotiska] pep 8 compliance
43fd10a [jyotiska] lines broken to maintain 80 char limit
b4fdf4e [jyotiska] removed blank lines
83d5ab7 [jyotiska] added inferschema and applyschema to the demo
306667e [jyotiska] replaced blank line with end line
c90502a [jyotiska] fixed new line
4939a70 [jyotiska] added new line at end for python style
0b46148 [jyotiska] fixed appname for python sql example
8f67b5b [jyotiska] added python sql example

liutang123/spark,ddna1021/spark,darionyaphet/spark,sahilTakiar/spark,setjet/spark,zzcclp/spark,zuotingbing/spark,srowen/spark,darionyaphet/spark,goldmedal/spark,UndeadBaneGitHub/spark,kimoonkim/spark,lvdongr/spark,ioana-delaney/spark,andrewor14/iolap,metamx/spark,poffuomo/spark,JoshRosen/spark,pgandhi999/spark,debugger87/spark,pgandhi999/spark,joseph-torres/spark,nilsgrabbert/spark,andrewor14/spark,kiszk/spark,setjet/spark,ddna1021/spark,BryanCutler/spark,aosagie/spark,zuotingbing/spark,SnappyDataInc/spark,someorz/spark,maropu/spark,big-pegasus/spark,ddna1021/spark,pgandhi999/spark,shubhamchopra/spark,kissmetrics/spark,vinodkc/spark,witgo/spark,kiszk/spark,nchammas/spark,bravo-zhang/spark,jrshust/spark,apache/spark,zhouyejoe/spark,nilsgrabbert/spark,JerryLead/spark,holdenk/spark,byakuinss/spark,ioana-delaney/spark,kevinyu98/spark,nchammas/spark,LantaoJin/spark,wangmiao1981/spark,rikima/spark,sachintyagi22/spark,shaneknapp/spark,spark-test/spark,sahilTakiar/spark,zhouyejoe/spark,wangmiao1981/spark,apache/spark,xflin/spark,JoshRosen/spark,alunarbeach/spark,kissmetrics/spark,JerryLead/spark,sureshthalamati/spark,wangyum/spark,witgo/spark,sahilTakiar/spark,hhbyyh/spark,ericvandenbergfb/spark,ueshin/apache-spark,lvdongr/spark,spark-test/spark,janewangfb/spark,zzcclp/spark,sureshthalamati/spark,ron8hu/spark,liyichao/spark,holdenk/spark,tengpeng/spark,xflin/spark,bravo-zhang/spark,adrian-ionescu/apache-spark,wzhfy/spark,milliman/spark,jlopezmalla/spark,esi-mineset/spark,icexelloss/spark,SHASHANKB/spark,WindCanDie/spark,loneknightpy/spark,chuckchen/spark,sureshthalamati/spark,BryanCutler/spark,bOOm-X/spark,minixalpha/spark,aosagie/spark,narahari92/spark,hhbyyh/spark,wangyum/spark,LantaoJin/spark,jrshust/spark,taroplus/spark,esi-mineset/spark,yanboliang/spark,metamx/spark,ddna1021/spark,ahnqirage/spark,rednaxelafx/apache-spark,skonto/spark,UndeadBaneGitHub/spark,adrian-ionescu/apache-spark,highfei2011/spark,saturday-shi/spark,akopich/spark,taroplus/spark,Panos-Bletsos/spark-cost-model-optimizer,WindCanDie/spark,SnappyDataInc/spark,dongjoon-hyun/spark,zuotingbing/spark,ron8hu/spark,gengliangwang/spark,rezasafi/spark,xuanyuanking/spark,MLnick/spark,pgandhi999/spark,hhbyyh/spark,icexelloss/spark,guoxiaolongzte/spark,techaddict/spark,ahnqirage/spark,rikima/spark,caneGuy/spark,aosagie/spark,sureshthalamati/spark,mdespriee/spark,guoxiaolongzte/spark,andrewor14/spark,jrshust/spark,kimoonkim/spark,icexelloss/spark,kissmetrics/spark,HyukjinKwon/spark,adrian-ionescu/apache-spark,ericvandenbergfb/spark,bravo-zhang/spark,mike0sv/spark,someorz/spark,map222/spark,setjet/spark,rekhajoshm/spark,debugger87/spark,lvdongr/spark,WeichenXu123/spark,witgo/spark,sachintyagi22/spark,shuangshuangwang/spark,ron8hu/spark,Panos-Bletsos/spark-cost-model-optimizer,saltstar/spark,xflin/spark,bravo-zhang/spark,xuanyuanking/spark,JerryLead/spark,caneGuy/spark,icexelloss/spark,spark-test/spark,mdespriee/spark,shaneknapp/spark,jlopezmalla/spark,ahnqirage/spark,kissmetrics/spark,map222/spark,jiangxb1987/spark,debugger87/spark,liutang123/spark,minixalpha/spark,ericvandenbergfb/spark,shaneknapp/spark,saturday-shi/spark,ConeyLiu/spark,lvdongr/spark,taroplus/spark,milliman/spark,BryanCutler/spark,actuaryzhang/spark,ibm-research-ireland/sparkoscope,nilsgrabbert/spark,jianran/spark,tengpeng/spark,alunarbeach/spark,rednaxelafx/apache-spark,Panos-Bletsos/spark-cost-model-optimizer,kissmetrics/spark,gioenn/xSpark,brad-kaiser/spark,shubhamchopra/spark,lvdongr/spark,mzl9039/spark,zuotingbing/spark,janewangfb/spark,metamx/spark,ron8hu/spark,haowu80s/spark,saltstar/spark,chuckchen/spark,rednaxelafx/apache-spark,tengpeng/spark,eyalfa/spark,andrewor14/iolap,holdenk/spark,WindCanDie/spark,eyalfa/spark,zhouyejoe/spark,mahak/spark,cloud-fan/spark,UndeadBaneGitHub/spark,ueshin/apache-spark,debugger87/spark,darionyaphet/spark,tejasapatil/spark,wangyum/spark,eyalfa/spark,markhamstra/spark,ConeyLiu/spark,caneGuy/spark,dongjoon-hyun/spark,SHASHANKB/spark,tejasapatil/spark,tejasapatil/spark,publicRoman/spark,actuaryzhang/spark,jkbradley/spark,markhamstra/spark,byakuinss/spark,gioenn/xSpark,jkbradley/spark,rekhajoshm/spark,zero323/spark,joseph-torres/spark,aosagie/spark,aosagie/spark,ueshin/apache-spark,rednaxelafx/apache-spark,holdenk/spark,alunarbeach/spark,ericvandenbergfb/spark,debugger87/spark,ibm-research-ireland/sparkoscope,eyalfa/spark,ajaysaini725/spark,joseph-torres/spark,wzhfy/spark,liutang123/spark,sahilTakiar/spark,icexelloss/spark,publicRoman/spark,Panos-Bletsos/spark-cost-model-optimizer,someorz/spark,mzl9039/spark,narahari92/spark,poffuomo/spark,JerryLead/spark,mdespriee/spark,guoxiaolongzte/spark,yanboliang/spark,apache-spark-on-k8s/spark,dbtsai/spark,ueshin/apache-spark,kimoonkim/spark,darionyaphet/spark,aray/spark,UndeadBaneGitHub/spark,wangmiao1981/spark,dbtsai/spark,goldmedal/spark,mzl9039/spark,byakuinss/spark,kimoonkim/spark,gioenn/xSpark,HyukjinKwon/spark,aray/spark,lxsmnv/spark,adrian-ionescu/apache-spark,icexelloss/spark,markhamstra/spark,jkbradley/spark,zhouyejoe/spark,nilsgrabbert/spark,cin/spark,xuanyuanking/spark,jiangxb1987/spark,lxsmnv/spark,rekhajoshm/spark,nlalevee/spark,bdrillard/spark,brad-kaiser/spark,vinodkc/spark,jianran/spark,shaneknapp/spark,andrewor14/iolap,haowu80s/spark,SHASHANKB/spark,joseph-torres/spark,metamx/spark,lxsmnv/spark,ConeyLiu/spark,nilsgrabbert/spark,BryanCutler/spark,huang1900/spark,brad-kaiser/spark,jrshust/spark,ptkool/spark,dongjoon-hyun/spark,tejasapatil/spark,patrick-nicholson/spark,Aegeaner/spark,pgandhi999/spark,caneGuy/spark,aray/spark,ConeyLiu/spark,ericvandenbergfb/spark,szhem/spark,actuaryzhang/spark,mike0sv/spark,andrewor14/spark,nlalevee/spark,caneGuy/spark,andrewor14/spark,nchammas/spark,gioenn/xSpark,mike0sv/spark,jiangxb1987/spark,highfei2011/spark,mike0sv/spark,zero323/spark,Aegeaner/spark,shuangshuangwang/spark,maropu/spark,kiszk/spark,maropu/spark,sureshthalamati/spark,jrshust/spark,cloud-fan/spark,apache-spark-on-k8s/spark,patrick-nicholson/spark,jlopezmalla/spark,akopich/spark,poffuomo/spark,markhamstra/spark,vinodkc/spark,ibm-research-ireland/sparkoscope,rednaxelafx/apache-spark,facaiy/spark,caneGuy/spark,esi-mineset/spark,pronix/spark,aokolnychyi/spark,Panos-Bletsos/spark-cost-model-optimizer,rezasafi/spark,sahilTakiar/spark,skonto/spark,jiangxb1987/spark,spark-test/spark,nlalevee/spark,gengliangwang/spark,vinodkc/spark,xflin/spark,ddna1021/spark,jianran/spark,jianran/spark,adrian-ionescu/apache-spark,ptkool/spark,facaiy/spark,kiszk/spark,techaddict/spark,sahilTakiar/spark,bravo-zhang/spark,kevinyu98/spark,ahnqirage/spark,huang1900/spark,ajaysaini725/spark,kevinyu98/spark,narahari92/spark,skonto/spark,byakuinss/spark,haowu80s/spark,bravo-zhang/spark,shubhamchopra/spark,zzcclp/spark,rednaxelafx/apache-spark,kiszk/spark,ajaysaini725/spark,byakuinss/spark,sahilTakiar/spark,alunarbeach/spark,jkbradley/spark,rekhajoshm/spark,highfei2011/spark,shuangshuangwang/spark,aray/spark,srowen/spark,cin/spark,eyalfa/spark,sachintyagi22/spark,kevinyu98/spark,HyukjinKwon/spark,bOOm-X/spark,Aegeaner/spark,rezasafi/spark,ptkool/spark,taroplus/spark,panfengfeng/spark,yanboliang/spark,gengliangwang/spark,dongjoon-hyun/spark,techaddict/spark,shubhamchopra/spark,cin/spark,huang1900/spark,huang1900/spark,shaneknapp/spark,gengliangwang/spark,panfengfeng/spark,big-pegasus/spark,skonto/spark,nlalevee/spark,bOOm-X/spark,hvanhovell/spark,aosagie/spark,someorz/spark,witgo/spark,facaiy/spark,ueshin/apache-spark,debugger87/spark,LantaoJin/spark,actuaryzhang/spark,MLnick/spark,SnappyDataInc/spark,brad-kaiser/spark,nilsgrabbert/spark,apache-spark-on-k8s/spark,lxsmnv/spark,wangmiao1981/spark,ptkool/spark,SHASHANKB/spark,setjet/spark,UndeadBaneGitHub/spark,WeichenXu123/spark,zzcclp/spark,srowen/spark,loneknightpy/spark,aray/spark,nchammas/spark,HyukjinKwon/spark,srowen/spark,1haodian/spark,big-pegasus/spark,haowu80s/spark,hvanhovell/spark,dongjoon-hyun/spark,facaiy/spark,goldmedal/spark,mahak/spark,setjet/spark,sachintyagi22/spark,taroplus/spark,shaneknapp/spark,ibm-research-ireland/sparkoscope,BryanCutler/spark,matthewfranglen/spark,shubhamchopra/spark,lxsmnv/spark,maropu/spark,SHASHANKB/spark,JerryLead/spark,narahari92/spark,kevinyu98/spark,hhbyyh/spark,tejasapatil/spark,janewangfb/spark,dbtsai/spark,yanboliang/spark,hhbyyh/spark,aosagie/spark,BryanCutler/spark,mdespriee/spark,cin/spark,1haodian/spark,metamx/spark,techaddict/spark,andrewor14/spark,highfei2011/spark,Aegeaner/spark,andrewor14/iolap,Panos-Bletsos/spark-cost-model-optimizer,brad-kaiser/spark,apache/spark,minixalpha/spark,mahak/spark,rekhajoshm/spark,jkbradley/spark,dhruve/spark,liyichao/spark,BryanCutler/spark,1haodian/spark,highfei2011/spark,saltstar/spark,goldmedal/spark,techaddict/spark,jianran/spark,facaiy/spark,esi-mineset/spark,sachintyagi22/spark,kiszk/spark,guoxiaolongzte/spark,narahari92/spark,dhruve/spark,saltstar/spark,big-pegasus/spark,kissmetrics/spark,map222/spark,zuotingbing/spark,loneknightpy/spark,chuckchen/spark,setjet/spark,patrick-nicholson/spark,apache/spark,spark-test/spark,xuanyuanking/spark,byakuinss/spark,srowen/spark,1haodian/spark,MLnick/spark,xuanyuanking/spark,rikima/spark,mahak/spark,someorz/spark,dhruve/spark,saturday-shi/spark,wangyum/spark,cloud-fan/spark,kimoonkim/spark,zhouyejoe/spark,milliman/spark,cin/spark,vinodkc/spark,rekhajoshm/spark,andrewor14/iolap,akopich/spark,patrick-nicholson/spark,ahnqirage/spark,shuangshuangwang/spark,zzcclp/spark,saturday-shi/spark,LantaoJin/spark,wzhfy/spark,aokolnychyi/spark,milliman/spark,shuangshuangwang/spark,maropu/spark,sachintyagi22/spark,tengpeng/spark,esi-mineset/spark,milliman/spark,wzhfy/spark,mdespriee/spark,ahnqirage/spark,nchammas/spark,zero323/spark,dhruve/spark,WeichenXu123/spark,kevinyu98/spark,michalsenkyr/spark,chuckchen/spark,ericvandenbergfb/spark,zero323/spark,liyichao/spark,wangyum/spark,apache/spark,jrshust/spark,UndeadBaneGitHub/spark,someorz/spark,tengpeng/spark,zuotingbing/spark,saltstar/spark,zero323/spark,highfei2011/spark,techaddict/spark,Aegeaner/spark,aokolnychyi/spark,jlopezmalla/spark,publicRoman/spark,liutang123/spark,actuaryzhang/spark,gioenn/xSpark,apache/spark,jkbradley/spark,HyukjinKwon/spark,HyukjinKwon/spark,bOOm-X/spark,aokolnychyi/spark,jiangxb1987/spark,gengliangwang/spark,someorz/spark,loneknightpy/spark,cloud-fan/spark,yanboliang/spark,milliman/spark,dbtsai/spark,mike0sv/spark,saturday-shi/spark,shubhamchopra/spark,markhamstra/spark,rezasafi/spark,publicRoman/spark,dbtsai/spark,Aegeaner/spark,WindCanDie/spark,techaddict/spark,facaiy/spark,ConeyLiu/spark,andrewor14/spark,hhbyyh/spark,akopich/spark,ioana-delaney/spark,szhem/spark,huang1900/spark,wangmiao1981/spark,ueshin/apache-spark,bOOm-X/spark,apache/spark,xflin/spark,chuckchen/spark,andrewor14/iolap,bdrillard/spark,minixalpha/spark,taroplus/spark,JoshRosen/spark,SnappyDataInc/spark,caneGuy/spark,rikima/spark,SHASHANKB/spark,JoshRosen/spark,michalsenkyr/spark,ajaysaini725/spark,setjet/spark,jrshust/spark,cloud-fan/spark,panfengfeng/spark,esi-mineset/spark,saturday-shi/spark,sureshthalamati/spark,zzcclp/spark,alunarbeach/spark,jlopezmalla/spark,dhruve/spark,loneknightpy/spark,cloud-fan/spark,rezasafi/spark,pronix/spark,aokolnychyi/spark,aokolnychyi/spark,apache-spark-on-k8s/spark,1haodian/spark,WeichenXu123/spark,mzl9039/spark,ddna1021/spark,jiangxb1987/spark,mzl9039/spark,sureshthalamati/spark,ioana-delaney/spark,holdenk/spark,aray/spark,saturday-shi/spark,vinodkc/spark,brad-kaiser/spark,ConeyLiu/spark,dbtsai/spark,darionyaphet/spark,joseph-torres/spark,ajaysaini725/spark,gengliangwang/spark,witgo/spark,map222/spark,hvanhovell/spark,pgandhi999/spark,xflin/spark,haowu80s/spark,lvdongr/spark,wangyum/spark,JoshRosen/spark,brad-kaiser/spark,vinodkc/spark,taroplus/spark,saltstar/spark,debugger87/spark,tengpeng/spark,adrian-ionescu/apache-spark,eyalfa/spark,jianran/spark,skonto/spark,michalsenkyr/spark,liyichao/spark,kiszk/spark,kissmetrics/spark,poffuomo/spark,big-pegasus/spark,janewangfb/spark,bdrillard/spark,ajaysaini725/spark,pronix/spark,ptkool/spark,cin/spark,mike0sv/spark,map222/spark,HyukjinKwon/spark,stanzhai/spark,SnappyDataInc/spark,patrick-nicholson/spark,bravo-zhang/spark,bdrillard/spark,janewangfb/spark,huang1900/spark,pgandhi999/spark,zuotingbing/spark,ron8hu/spark,yanboliang/spark,liyichao/spark,wangyum/spark,loneknightpy/spark,Aegeaner/spark,pronix/spark,andrewor14/iolap,akopich/spark,ioana-delaney/spark,xuanyuanking/spark,szhem/spark,chuckchen/spark,joseph-torres/spark,loneknightpy/spark,skonto/spark,eyalfa/spark,andrewor14/spark,panfengfeng/spark,gioenn/xSpark,rednaxelafx/apache-spark,nlalevee/spark,WeichenXu123/spark,guoxiaolongzte/spark,WindCanDie/spark,icexelloss/spark,jiangxb1987/spark,highfei2011/spark,panfengfeng/spark,pronix/spark,mzl9039/spark,SHASHANKB/spark,spark-test/spark,WeichenXu123/spark,actuaryzhang/spark,mdespriee/spark,ptkool/spark,WindCanDie/spark,kimoonkim/spark,UndeadBaneGitHub/spark,gioenn/xSpark,mahak/spark,szhem/spark,dongjoon-hyun/spark,cin/spark,JoshRosen/spark,bdrillard/spark,stanzhai/spark,hvanhovell/spark,WindCanDie/spark,ptkool/spark,LantaoJin/spark,zero323/spark,pronix/spark,publicRoman/spark,dbtsai/spark,MLnick/spark,panfengfeng/spark,lxsmnv/spark,liutang123/spark,map222/spark,nlalevee/spark,nchammas/spark,milliman/spark,mdespriee/spark,hvanhovell/spark,minixalpha/spark,JerryLead/spark,jlopezmalla/spark,hhbyyh/spark,1haodian/spark,holdenk/spark,goldmedal/spark,wangmiao1981/spark,szhem/spark,rikima/spark,1haodian/spark,liyichao/spark,tejasapatil/spark,JoshRosen/spark,LantaoJin/spark,lxsmnv/spark,JerryLead/spark,shaneknapp/spark,rezasafi/spark,sachintyagi22/spark,szhem/spark,ueshin/apache-spark,goldmedal/spark,markhamstra/spark,cloud-fan/spark,zhouyejoe/spark,ajaysaini725/spark,witgo/spark,goldmedal/spark,liyichao/spark,nchammas/spark,holdenk/spark,akopich/spark,byakuinss/spark,stanzhai/spark,publicRoman/spark,mahak/spark,michalsenkyr/spark,rikima/spark,kimoonkim/spark,rezasafi/spark,ericvandenbergfb/spark,ibm-research-ireland/sparkoscope,actuaryzhang/spark,MLnick/spark,srowen/spark,bOOm-X/spark,jlopezmalla/spark,jkbradley/spark,apache-spark-on-k8s/spark,markhamstra/spark,hvanhovell/spark,aokolnychyi/spark,guoxiaolongzte/spark,ron8hu/spark,dongjoon-hyun/spark,chuckchen/spark,MLnick/spark,witgo/spark,poffuomo/spark,darionyaphet/spark,xflin/spark,map222/spark,michalsenkyr/spark,hvanhovell/spark,minixalpha/spark,minixalpha/spark,gengliangwang/spark,esi-mineset/spark,poffuomo/spark,michalsenkyr/spark,mike0sv/spark,huang1900/spark,ibm-research-ireland/sparkoscope,xuanyuanking/spark,ddna1021/spark,saltstar/spark,nlalevee/spark,big-pegasus/spark,wzhfy/spark,zero323/spark,haowu80s/spark,mahak/spark,aray/spark,bdrillard/spark,stanzhai/spark,janewangfb/spark,narahari92/spark,Panos-Bletsos/spark-cost-model-optimizer,dhruve/spark,SnappyDataInc/spark,joseph-torres/spark,nilsgrabbert/spark,ConeyLiu/spark,shubhamchopra/spark,SnappyDataInc/spark,mzl9039/spark,tejasapatil/spark,maropu/spark,ibm-research-ireland/sparkoscope,zzcclp/spark,ioana-delaney/spark,shuangshuangwang/spark,wangmiao1981/spark,skonto/spark,metamx/spark,alunarbeach/spark,stanzhai/spark,wzhfy/spark,big-pegasus/spark,MLnick/spark,LantaoJin/spark,metamx/spark,yanboliang/spark,panfengfeng/spark,ahnqirage/spark,apache-spark-on-k8s/spark,tengpeng/spark,darionyaphet/spark,michalsenkyr/spark,poffuomo/spark,publicRoman/spark,ron8hu/spark,alunarbeach/spark,liutang123/spark,liutang123/spark,apache-spark-on-k8s/spark,patrick-nicholson/spark,zhouyejoe/spark,jianran/spark,rekhajoshm/spark,adrian-ionescu/apache-spark,guoxiaolongzte/spark,rikima/spark,janewangfb/spark,ioana-delaney/spark,stanzhai/spark,kevinyu98/spark,patrick-nicholson/spark,stanzhai/spark,dhruve/spark,maropu/spark,WeichenXu123/spark,lvdongr/spark,facaiy/spark,srowen/spark,narahari92/spark,szhem/spark,bOOm-X/spark,akopich/spark,spark-test/spark,bdrillard/spark,shuangshuangwang/spark,wzhfy/spark