/  Technology   /   Project Operation ( P ) in Python

 Project Operation ( P ) in Python

 

The Project operation selects columns that are given as input.

 

Let us understand the PROJECT operation better using some examples.

Consider the following table: 

R1 :    FACULTY-1

FNoFNameDNoQualSalary
22Riya21Ph.D55000
24Priya22M. Tech50000
25Zayn22M. Tech42000
27Harry23M. Tech28000
30Sia23M. Tech32000
33Max24Ph.D53000
35Fred24Ph.D52000
37Diva25M. Tech26000
39Ben25M. Tech24000
40Trent25M. Tech34000

 

Example-1 :  Find the list of FName and their salaries..

FName, Salary (Faculty-1)

Output:     

FNameSalary
Riya55000
Priya50000
Zayn42000
Harry28000
Sia32000
Max53000
Fred52000
Diva26000
Ben24000
Trent34000

 

 Example-2 :  Find the list of Qualifications.

                           P Qual (Faculty-1)

 

Output :                        

Qual
Ph.D
M.Tech

 

                                                        

Example-3 :  Find the list of Faculty having Ph.D. Qualification.

                          P FName (squal  = ‘Ph.D.’ ( (Faculty-1) )

 Output :                 

Qual
Riya
Max
Fred

       

 

Example-4 :  Find the Salaries of Faculty along with their names having

                     MTech qualification.

                P FName, Salary (squal  = ‘MTech’ ( (Faculty-1) )

 Output :                    

FNameQual
Priya50000
Zayn42000
Harry28000
Sia32000
Diva26000
Ben24000
Trent34000

 

 

Leave a comment