How to Assign the Output of an SQL Query to a Variable?

Hi

iam new to shell scripting

how to declare variables as redshift query and I have to compare two counts by using if condition .

ex: count=select count(*) from prd;

select count(*) from prd;
 
select count(*) from tag;

can any one help me .

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in the Homework & Coursework Questions forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

If you did not post homework, please explain the company you work for and the nature of the problem you are working on. Furthermore, unless you tell us what operating system and shell you're using (and, when using a database, what database software you're using), it is very hard for us to guess at what might work in your environment. Showing us what you have tried to do to solve this problem on your own always helps us help you.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.