Skip to content

Latest commit

 

History

History

Qualifying Criteria

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Qualifying Criteria

Star Badge View Main Folder View Repositories View My Profile


🛠️ Problem Statement

Table Name : Ameriprise_LLC

Column Name Type
teamID varchar(2)
memberID varchar(10)
Criteria1 varchar(1)
Criteria2 varchar(1)

memberID is the primary key of this table.

The Criteria1 and Criteria2 columns are single characters with two possible values- ["Y", "N"].

For a person to qualify there are 2 conditions:

1. The person should have both the criteria as 'Y' .
2. There should be at least 2 people in his team who qualify for the program.

Write a SQL query to find all the qualified members along with their teams.
Return the result table in any order.

The query result format is in the following example.

Input

Table Name: Ameriprise_LLC

teamID memberID Criteria1 Criteria2
T1 T1_mbr1 Y Y
T1 T1_mbr2 Y Y
T1 T1_mbr3 Y Y
T1 T1_mbr4 Y Y
T1 T1_mbr5 Y N
T2 T2_mbr1 Y Y
T2 T2_mbr2 Y N
T2 T2_mbr3 N Y
T2 T2_mbr4 N N
T2 T2_mbr5 N N
T3 T3_mbr1 Y Y
T3 T3_mbr2 Y Y
T3 T3_mbr3 N Y
T3 T3_mbr4 N Y
T3 T3_mbr5 Y N
Output
teamid memberid
T1 T1_mbr1
T1 T1_mbr2
T1 T1_mbr3
T1 T1_mbr4
T3 T3_mbr1
T3 T3_mbr2