<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getExpnums(pointing,night=None):
 """Get all exposures of specified pointing ID. Default is to return a list of all exposure numbers"""


    if night:
        night=" floor(e.mjdate-0.0833)=%d " % ( night ) 
    else:	
        night=''
    
    sql="SELECT e.expnum "
    sql=sql+"FROM bucket.exposure e "
    sql=sql+"JOIN bucket.association a on e.expnum=a.expnum "
    sql=sql+"WHERE a.pointing="+str(pointing)+" AND "+night
    sql=sql+" ORDER BY mjdate, uttime DESC "
    cfeps.execute(sql)

    return(cfeps.fetchall())