Chinastark/bird_dataset huggingface dataset:
Database: image_and_language
Note: The bounding box's w and h abbreviations stand for the object's width and height respectively; "keyboard" as object class refers to obj_class = 'keyboard'; (5, 647) as coordinate refers to x and y coordinates of the bounding box where x = 5 and y = 647;
Question: What are the width and height of the bounding box of the object with "keyboard" as their object class and (5, 647) as their coordinate?
SQL: SELECT img_obj.w, img_obj.h FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE obj_classes.obj_class = 'keyboard' AND img_obj.x = 5 AND img_obj.y = 647
Database: image_and_language
Note: ID of all images refer to img_id; attribute class of "horse" refers to att_class = 'horse';
Question: List all the ID of the images that have an attribute class of "horse".
SQL: SELECT img_obj_att.img_id FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id WHERE att_classes.att_class = 'horse'
Database: image_and_language
Note: attribute class of "horse" refers to att_class = 'horse'; object class of "fur" refers to obj_class = 'fur';
Question: Provide the x-coordinate and y-coordinate of the image with an attribute class of ''horse" and an object class of "fur".
SQL: SELECT img_obj.x, img_obj.y FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id INNER JOIN img_obj ON img_obj_att.img_id = img_obj.img_id INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE att_classes.att_class = 'horse' AND obj_classes.obj_class = 'fur'
Database: image_and_language
Note: attribute classes of the image ID "15" refer to att_class where img_id = 15;
Question: List all the attribute classes of the image ID "15".
SQL: SELECT att_classes.att_class FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id WHERE img_obj_att.img_id = 15
Database: image_and_language
Note: prediction class of "reading" refers to pred_class = 'reading'; if two objects (obj1_sample_id, obj2_sample_id) has multiple pred_class_id, it means these two objects have multiple relations;
Question: For those objects that have multiple relations, how many images have a prediction class of "reading"?
SQL: SELECT count(img_rel.img_id) FROM img_rel INNER JOIN pred_classes ON img_rel.pred_class_id = pred_classes.pred_class_id WHERE pred_classes.pred_class = 'reading'
Database: image_and_language
Note: images have "picture" as their attribute class refer to img_id where att_class = 'picture';
Question: How many images have "picture" as their attribute class?
SQL: SELECT count(img_obj_att.img_id) FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id WHERE att_classes.att_class = 'picture'
Database: image_and_language
Note: "picture" as attribute class refers to att_class = 'picture'; "bear" as object class refers to obj_class = 'bear'; images refer to img_id;
Question: How many images have "picture" as their attribute class and "bear" as their object class?
SQL: SELECT count(img_obj_att.img_id) FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id INNER JOIN img_obj ON img_obj_att.img_id = img_obj.img_id INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE att_classes.att_class = 'picture' AND obj_classes.obj_class = 'bear'
Database: image_and_language
Note: attribute classes refer to att_class; (5,5) coordinate refers to x and y coordinates of the bounding box where x = 5 and y = 5;
Question: List all the attribute classes of the images that have a (5,5) coordinate.
SQL: SELECT att_classes.att_class FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id INNER JOIN img_obj ON img_obj_att.img_id = img_obj.img_id WHERE img_obj.x = 5 AND img_obj.y = 5
Database: image_and_language
Note: AVG(img_id) where obj_class = 'keyboard';
Question: Calculate the average number of images with an attribute class of "keyboard".
SQL: SELECT avg(img_obj.img_id) FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE obj_classes.obj_class = 'keyboard'
Database: image_and_language
Note: DIVIDE(COUNT(img_id where obj_class = 'man'), COUNT(img_id where obj_class = 'person'));
Question: Calculate the ratio of the total number of images with an object class of "man" and "person".
SQL: SELECT cast(count(CASE WHEN obj_classes.obj_class = 'man' THEN 1 ELSE 0 END) AS REAL) / count(CASE WHEN obj_classes.obj_class = 'person' THEN 1 ELSE 0 END) FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id
Database: image_and_language
Note: object sample ID refers to obj_sample_id; image ID 17 refers to img_id = 17; coordinates (0,0) refer to x and y coordinates of the bounding box where x = 0 and y = 0;
Question: List the object sample IDs of image ID 17 with coordinates (0,0).
SQL: SELECT obj_sample_id FROM img_obj WHERE img_id = 17 AND x = 0 AND y = 0
Database: image_and_language
Note: The bounding box's w and h abbreviations stand for the object's width and height respectively; object sample ID 2 refers to obj_sample_id = 2;
Question: List all bounding box widths and heights of object sample ID 2.
SQL: SELECT w, h FROM img_obj WHERE obj_sample_id = 2
Database: image_and_language
Note: y coordinate many are 0 refers to y coordinates of the bounding box where y = 0; image ID 12 refers to img_id = 12;
Question: In the Y coordinate of image ID 12, how many are 0?
SQL: SELECT count(img_id) FROM img_obj WHERE img_id = 12 AND y = 0
Database: image_and_language
Note: attribute classes of image ID 22 refer to att_class where MG_ID = 22;
Question: List all the attribute classes of image ID 22.
SQL: SELECT att_classes.att_class FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id WHERE img_obj_att.img_id = 22
Database: image_and_language
Note: object classes of image ID 36 refers to obj_class where img_id = 36; coordinates (0,0) refer to x and y coordinates of the bounding box where x = 0 and y = 0;
Question: List the object classes of image ID 36 with coordinates (0,0).
SQL: SELECT obj_classes.obj_class FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE img_obj.img_id = 36 AND img_obj.x = 0 AND img_obj.y = 0
Database: image_and_language
Note: coordinates for the object refer to x, y, w and h coordinates of the bounding box; object class "pizza" refers to obj_class = 'pizza';
Question: Write 10 coordinates with the object class "pizza."
SQL: SELECT img_obj.img_id, img_obj.x, img_obj.y FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE obj_classes.obj_class = 'pizza' LIMIT 10
Database: image_and_language
Note: object class refers to obj_class; x and y coordinates of 126 and 363 refer to coordinates of the bounding box where x = 126 and y = 363;
Question: What object class is in the X and Y coordinates of 126 and 363?
SQL: SELECT img_obj.img_id, obj_classes.obj_class FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE img_obj.x = 126 AND img_obj.y = 363
Database: image_and_language
Note: the most common object class of image ID 56 refers to MAx(COUNT(obj_class_id)) where img_id = 56;
Question: What is the most common object class of image ID 56?
SQL: SELECT obj_classes.obj_class FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE img_obj.img_id = 56 GROUP BY obj_classes.obj_class ORDER BY count(obj_classes.obj_class_id) DESC LIMIT 1
Database: image_and_language
Note: object classes of image ID 22 refers to obj_class where img_id = 22; the object's width and heigh refer to w and h coordinates of the bounding box respectively;
Question: Write the object classes of image ID 22 alongside the object's width and height.
SQL: SELECT img_obj.w, img_obj.h, obj_classes.obj_class FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE img_obj.img_id = 22
Database: image_and_language
Note: predicate class of image ID 68 refers to pred_class where img_id = 68;
Question: What is the predicate class of image ID 68?
SQL: SELECT pred_classes.pred_class FROM img_rel INNER JOIN pred_classes ON img_rel.pred_class_id = pred_classes.pred_class_id WHERE img_rel.img_id = 68
Database: image_and_language
Note: has' predicate classes refers to pred_class = 'has'; image ID 107 refers to img_id = 107;
Question: How many 'has' predicate classes does image ID 107 have?
SQL: SELECT count(pred_classes.pred_class) FROM img_rel INNER JOIN pred_classes ON img_rel.pred_class_id = pred_classes.pred_class_id WHERE img_rel.img_id = 107 AND pred_classes.pred_class = 'has'
Database: image_and_language
Note: the most common predicate class of image ID 4434 MAx(pred_class) where img_id = 4434;
Question: Name the most common predicate class of image ID 4434.
SQL: SELECT pred_classes.pred_class FROM img_rel INNER JOIN pred_classes ON img_rel.pred_class_id = pred_classes.pred_class_id WHERE img_rel.img_id = 4434 ORDER BY pred_classes.pred_class DESC LIMIT 1
Database: image_and_language
Note: dress' object classes refer to obj_class = 'dress'; image ID 1764 refers to img_id = 1764; x and y refer to coordinates of the bounding box;
Question: Count the number of 'dress' object classes and include their X and Y coordinates in image ID 1764.
SQL: SELECT img_obj.x, img_obj.y FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE img_obj.img_id = 1764 AND obj_classes.obj_class = 'dress'
Database: image_and_language
Note: x and y refer to coordinates of the bounding box; image ID 23 refers to img_id = 23; 'cast' attribute class refers to att_class = 'cast';
Question: Give the X and Y coordinates of the sample object of image ID 23 that has the 'cast' attribute class.
SQL: SELECT img_obj.obj_sample_id, img_obj.x, img_obj.y FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id INNER JOIN img_obj ON img_obj_att.img_id = img_obj.img_id WHERE img_obj.img_id = 23 AND att_classes.att_class = 'cast'
Database: image_and_language
Note: blue' attribute classes on image ID 2355735 refer to att_class = 'blue' where img_id = 2355735;
Question: How many 'blue' attribute classes are there on image ID 2355735?
SQL: SELECT count(att_classes.att_class) FROM att_classes INNER JOIN img_obj_att ON att_classes.att_class_id = img_obj_att.att_class_id WHERE img_obj_att.img_id = 2355735 AND att_classes.att_class = 'blue'
Database: image_and_language
Note: The bounding box's w and h abbreviations stand for the object's width and height in which average width and height refer to AVG(w) and AVG(h) respectively; image ID 47 refers to img_id = 47; object classes refer to obj_class;
Question: What is the average width and height of the objects in image ID 47? List their object classes as well.
SQL: SELECT obj_classes.obj_class, avg(img_obj.w), avg(img_obj.h) FROM img_obj INNER JOIN obj_classes ON img_obj.obj_class_id = obj_classes.obj_class_id WHERE img_obj.img_id = 47 GROUP BY obj_classes.obj_class
Database: hockey
Note: Not from Usa refers to birthcountry! = 'Usa'; born in 1990 refers to birthyear = 1990;
Question: List the first Name and last name of all players not from USA and who are born in 1990 .
SQL: SELECT firstname, lastname FROM master WHERE birthyear = 1990 AND birthcountry != 'USA'
Database: hockey
Note: good at both left and right hand refers to shootcatch Is NUll;  playing the forward position refers to pos = 'F';
Question: List all players' given name who are good at both left and right hand and playing the forward position.
SQL: SELECT namegiven FROM master WHERE shootcatch IS NULL AND pos = 'F'
Database: hockey
Note: not in the Hall of Fame refers to hofid Is NUll;
Question: Who are the players who were not in the Hall of Fame list.
SQL: SELECT firstname, lastname FROM master WHERE hofid IS NULL
Database: hockey
Note: still living refers to deathyear Is NUll; youngest refers to MaX(birthyear,birthmon,birthday);
Question: Who is the youngest player who is still living. State the given name and date of birth.
SQL: SELECT namegiven , namegiven , birthyear, birthmon, birthday FROM master WHERE deathyear IS NULL ORDER BY birthyear DESC, birthmon DESC, birthday DESC LIMIT 1
Database: hockey
Note: age when he died refers to sUBtRaCt(deathyear,birthyear); deceased refers to deathyear Is NOt NUll; good at both left and right hand refers to shootcatch Is NUll;
Question: For all the deceased players who are good at both left and right hand, list the player's name and the age when he died.
SQL: SELECT firstname, lastname, deathyear - birthyear FROM master WHERE shootcatch IS NULL AND deathyear IS NOT NULL
Database: hockey
Note: goalie who played for more than 2 teams refers to COUNt(DIstINCt(t2.tmid))>2;
Question: Name the goalies who played for more than two teams from Year 2000 to 2005.
SQL: SELECT master.firstname, master.lastname FROM master INNER JOIN goalies ON master.playerid = goalies.playerid WHERE goalies.year >= 2000 AND goalies.year <= 2005 GROUP BY goalies.playerid HAVING count(DISTINCT goalies.tmid) > 2
Database: hockey
Note: average weight refers to aVg(weight); height greater than 72 inches refers to height>72;
Question: What is the average weight of players who have height greater than 72 inches.
SQL: SELECT avg(weight) FROM master WHERE height > 72
Database: hockey
Note: played more than total of 5000 minutes refers to sUM(min)>5000;country he was born refers to birthcountry;
Question: Name the goalies who have played more than total of 5000 minutes in the all the season played. State given name of the player and from which country was he born.
SQL: SELECT DISTINCT master.namegiven, master.birthcountry FROM master INNER JOIN goalies ON master.playerid = goalies.playerid GROUP BY master.namegiven, master.birthcountry HAVING sum(goalies.min) > 5000
Database: hockey
Note: PCHa refers to lgid = 'PCHa'; Nhl league refers to lgid = 'Nhl';
Question: Name the goaltenders who had played in both PCHA and NHL league.
SQL: SELECT master.firstname, master.lastname FROM master INNER JOIN goalies ON master.playerid = goalies.playerid WHERE goalies.lgid IN ('PCHA', 'NHL') GROUP BY goalies.playerid HAVING count(DISTINCT goalies.lgid) > 1
Database: hockey
Note: deceased refers to deathyear; most time played refers to MaX(min);
Question: List all deceased goalies by last name. List the season where he had the most time played.
SQL: SELECT master.playerid, goalies.year, MIN FROM master INNER JOIN goalies ON goalies.playerid = master.playerid WHERE master.deathyear IS NOT NULL ORDER BY goalies.min DESC LIMIT 1
Database: hockey
Note: team COl refers to tmid = 'COl'; age of today refers to sUBtRaCt(year(NOw())-birthyear);
Question: List all goalies from year 2000 to 2010 for team COL. State their given name, height, weight and age of today.
SQL: SELECT master.namegiven, master.height , master.weight, strftime('%Y', CURRENT_TIMESTAMP) - birthyear FROM master INNER JOIN goalies ON master.playerid = goalies.playerid WHERE goalies.tmid = 'COL' AND goalies.year >= 2000 AND goalies.year <= 2010 GROUP BY master.playerid
Database: hockey
Note: 10 or more empty net goals refers to eng>= 10; season refers to year;
Question: Name all goalies with 10 or more empty net goals. Name the players and season where he played.
SQL: SELECT master.firstname, master.lastname , goalies.year FROM master INNER JOIN goalies ON master.playerid = goalies.playerid WHERE goalies.eng >= 10
Database: hockey
Note: goals against refers to ga; shots against refers to sa; lowest percentage of goals against among all the shots against refers to min(dividE(ga,sa)*100);
Question: State the goalie who has the lowest percentage of goals against among all the shots against recorded. Name the players and season where he played.
SQL: SELECT master.firstname, master.lastname, goalies.year FROM master INNER JOIN goalies ON master.playerid = goalies.playerid WHERE cast(goalies.ga AS REAL) / goalies.sa IS NOT NULL ORDER BY cast(goalies.ga AS REAL) / goalies.sa LIMIT 1
Database: hockey
Note: shorter than 72 inches refers to height<72;
Question: List all goalies who played in the year 2005 season and shorter than 72 inches. List all the team names he play for.
SQL: SELECT DISTINCT master.firstname, master.lastname, teams.name FROM master INNER JOIN goalies ON master.playerid = goalies.playerid INNER JOIN teams ON goalies.tmid = teams.tmid WHERE goalies.year = 2005 AND master.height < 72
Database: hockey
Note: nick name refers to namenick; team refers to tmid; season refers to year;
Question: State the nick name of player ID 'aubinje01'. List all the teams and season he played for.
SQL: SELECT DISTINCT master.namenick, teams.year, teams.name FROM master INNER JOIN goalies ON master.playerid = goalies.playerid INNER JOIN teams ON goalies.tmid = teams.tmid WHERE master.playerid = 'aubinje01'
Database: hockey
Note: most seasons played refers to MaX(COUNt(playerid)); average time he played for each season refers to dividE(sUM(t2.min),COUNt(t2.playerid));
Question: Name the goalies with the most seasons played. State the average time he played for each season.
SQL: SELECT master.firstname, master.lastname, goalies.year, avg(goalies.min) FROM master INNER JOIN goalies ON master.playerid = goalies.playerid WHERE master.playerid = ( SELECT playerid FROM goalies GROUP BY playerid ORDER BY count(playerid) DESC LIMIT 1 ) GROUP BY master.firstname, master.lastname, goalies.year
Database: hockey
Note: shutouts refers to sho; number of goals refers to ga; 5% shutouts among the number of goals refers to dividE(sho,ga)*100 = 5.00;
Question: Name the goalie and the season he played where he had 5% shutouts among the number of goals recorded while the goalie was on the ice.
SQL: SELECT DISTINCT master.firstname, master.lastname, t2.year FROM master INNER JOIN ( SELECT playerid, YEAR FROM goalies WHERE cast(sho AS REAL) / ga > 0.05 ) AS t2 ON t2.playerid = master.playerid
Database: hockey
Note: death country is different from his birth country refers to birthcountry! = deathcountry;
Question: Name the deceased players whose death country is different from his birth country order by birth year.
SQL: SELECT firstname, lastname FROM master WHERE birthcountry != deathcountry ORDER BY birthyear
Database: hockey
Note: first year they were in Nhl refers to firstnhl; first year in wHa refers to firstwha; play in both refers to firstnhl Is NOt NUll aND firstwha Is NOt NUll;
Question: Who are the players played both in NHL and WHA. List the given name and first year they were in NHL and first year in WHA.
SQL: SELECT namegiven, firstnhl, firstwha FROM master WHERE firstnhl IS NOT NULL AND firstwha IS NOT NULL
Database: hockey
Note: living players refers to deathyear Is NUll; positions refers to pos;
Question: List the living players who have two positions. State their given name the position they play.
SQL: SELECT firstname, lastname, pos FROM master WHERE deathyear IS NULL AND pos LIKE '%/%'
Database: hockey
Note: nick name refers to namenick; tallest player refers to MaX(height); had left Nhl refers to lastnhl;
Question: State the nick name of the tallest player? If the player had left NHL, mention the last season he was with NHL.
SQL: SELECT namenick, lastnhl FROM master ORDER BY height DESC LIMIT 1
Database: hockey
Note: average height refers to aVg(height); born in 1990 refers to birthyear = 1990;
Question: What is the average height of player who were born in 1990 and after? Compare the average height with players who were born before 1990.
SQL: SELECT avg(iif(birthyear < 1990, height, NULL)) - avg(iif(birthyear >= 1990, height, NULL)) FROM master
Database: hockey
Note: good at left hand refers to shootcatch = 'l'; goalies refers to pos = 'g';
Question: Name the goalies who are good at left hand and also has become a coach after retirement. Name all teams he had played before.
SQL: SELECT DISTINCT firstname, lastname, teams.name FROM goalies INNER JOIN master ON master.playerid = goalies.playerid INNER JOIN teams ON goalies.lgid = teams.lgid WHERE goalies.playerid IS NOT NULL AND master.coachid IS NOT NULL AND master.shootcatch = 'L' AND master.pos = 'G'
Database: hockey
Note: goalies refers to pos = 'g'; deceased goalies refers to deathyear Is NOt NUll;
Question: List all the deceased goalies and the teams he had played whose birth country was in Canada.
SQL: SELECT DISTINCT firstname, lastname, teams.name FROM goalies INNER JOIN master ON master.playerid = goalies.playerid INNER JOIN teams ON goalies.lgid = teams.lgid WHERE master.birthcountry = 'Canada' AND master.deathyear IS NOT NULL AND master.pos = 'G'
Database: hockey
Note: goalies refers to pos = 'g'; season refers to year;
Question: Name the goalies and season they played when Boston Bruins won number 1 in rank.
SQL: SELECT master.firstname, master.lastname, teams.year FROM master INNER JOIN goalies ON master.playerid = goalies.playerid INNER JOIN teams ON goalies.year = teams.year AND goalies.tmid = teams.tmid WHERE master.deathyear IS NOT NULL AND teams.name = 'Boston Bruins' AND teams.rank = 1 AND master.pos = 'G'
Database: hockey
Note: first season in Nhl in before 1950 refers to firstnhl<1950; goalies who are still alive refers to deathyear Is NOt NUll;
Question: Among all goalies who are still alive, whose first season in NHL in before 1950. List the team names they were in.
SQL: SELECT DISTINCT teams.name FROM master INNER JOIN goalies ON master.playerid = goalies.playerid INNER JOIN teams ON goalies.lgid = teams.lgid AND goalies.year = teams.year WHERE master.deathyear IS NOT NULL AND master.firstnhl < 1950
Database: hockey
Question: For all players who becomes coach after retirement, state the given name of coach and which teams and years did they coach?
SQL: SELECT DISTINCT master.namegiven, teams.name, teams.year FROM coaches INNER JOIN master ON master.coachid = coaches.coachid INNER JOIN teams ON coaches.lgid = teams.lgid WHERE master.playerid IS NOT NULL AND master.coachid IS NOT NULL
Database: hockey
Note: highest percentage of game winning refers to MaX(dividE(w,g)*100);
Question: Among the coaches who was never a player, who has highest percentage of game winning? Provide the given name of the coach and team he coached.
SQL: SELECT master.namegiven, teams.name FROM coaches INNER JOIN master ON master.coachid = coaches.coachid INNER JOIN teams ON coaches.lgid = teams.lgid WHERE coaches.coachid IS NOT NULL ORDER BY cast(coaches.w AS REAL) / coaches.g DESC LIMIT 1
Database: hockey
Note: winning percentage refers to dividE(w,g)*100; team DEt refers to tmid = 'DEt';
Question: Which coach has the best performance for team DET in history? What was the winning percentage? Name the coach and the year he coached.
SQL: SELECT cast(coaches.w AS REAL) / coaches.g, master.firstname, master.lastname, coaches.year FROM master INNER JOIN coaches ON master.coachid = coaches.coachid INNER JOIN ( SELECT coachid FROM coaches ORDER BY cast(w AS REAL) / g DESC LIMIT 1 ) AS t3 ON coaches.coachid = t3.coachid
Database: hockey
Note: date of birth refers to birthday + birthmon + birthyear;
Question: Who is the coach who had coached the the most seasons in MTL? State his given name, date of birth and all teams he had coaches before.
SQL: SELECT master.namegiven , master.birthyear, master.birthmon, master.birthday, teams.name FROM goalies INNER JOIN master ON master.playerid = goalies.playerid INNER JOIN teams ON teams.lgid = goalies.lgid WHERE teams.tmid = 'MTL' GROUP BY master.namegiven, master.birthyear, master.birthmon, master.birthday, teams.name ORDER BY count(master.coachid) DESC LIMIT 1
Database: hockey
Note: lost refers to l; won refers to w;
Question: List all goalies with more lost than won games for two seasons or more. State the name of the player and team he played.
SQL: SELECT DISTINCT master.firstname, master.lastname, teams.name FROM master INNER JOIN goalies ON master.playerid = goalies.playerid INNER JOIN teams ON goalies.year = teams.year AND goalies.tmid = teams.tmid WHERE master.pos = 'G' AND goalies.l > goalies.w GROUP BY master.firstname, master.lastname, teams.name HAVING count(teams.year) > 2