This post will help you to run hive script on hive table. Hive script is made for below given title.
Hive script can be saved with the extension '.hql' or '.sql' . Copy paste the below code in a file "HiveScript.hql". In hive script, single line comment is given by '--'.