What is the FOREACH statement in PigLatin?
In PigLatin, the FOREACH statement is used to iterate through each record in a dataset and perform a specified operation on each record. The FOREACH statement is typically used in conjunction with the GENERATE statement to create new fields or transform records. For example, you can use the FOREACH statement to iterate through a dataset containing employee information and calculate the age of each employee or perform other operations on them. The syntax of the FOREACH statement is similar to the SELECT statement in SQL, where you can specify the operation to be performed.