Common Concepts Coding Practice

1.

Calculate overall number of boundaries scored by each batsmen in the tournament

number of boundaries = fours + sixes

Note: Output must contain rows in the descending order of

number_of_boundaries
and
name

Expected Output Format:

namenumber_of_boundaries
......

2.

Get the highest score of each player who played in the year 2006

Note: Output must contain rows in the descending order of

highest_score

Expected Output Format:

namehighest_score
......

3.

Calculate the strike rate of all the players in every match.

strike_rate = (score of the player / no_of_balls)*100

Note: Strike rate in the output should be a float value.

In SQL, when an integer is divided by another integer, it results in another integer value, i.e, 3/2 = 1 instead of a float. So we need to convert the numerator or denominator to float to get more accurate resutls, i.e 3.0/2 or 3/2.0, to get 1.5 as output.

Let's apply the same while calculating the strike_rate to get accurate results.

Note: Output must contain rows in the descending order of

strike_rate

Expected Output Format:

namematchstrike_rate
.........

 

Let's generate a performance report for all the players who played in the year 2006.

Apply the below logic to grade the player's performance.

total scoreperformance report
>= 150GOOD
100<= <150AVERAGE
<100BELOW AVERAGE

in the year

2006

Note: Output must be in the descending order of

total_score

Expected Output Format:

nametotal_scorebadge
.........

5.

For each player, get the number of matches in which their strike rate is less than 80.0, and the number of matches with strike rate greater than or equal to 80.0.

Note: Output must be in the ascending order of

name

Expected Output Format:

namestrike_rate_less_than_80strike_rate_greater_than_or_equal_to_80
.........

6.

Get all the player/s who played for both CSK and RCB.

Note: Output must be in the ascending order of

name

Expected Output Format:

name
...

7.

Get all the player/s who played only for SRH

Note:

  • Names in the output must be in capital letters.
  • Output must be in the ascending order of 
    name

Expected Output Format:

name
...

8.

Get all the player/s who played either for SRH, CSK, or MI.

Note: - Get unique players. - Output must be in the ascending order of

name

Expected Output Format:

name
...

9.

Fetch the name, highest and lowest scores of player/s for the matches in which strike rate is greater than 50.0.

Expected Output Format:

namehighest_scorelowest_score
.........
Player Table
idnamescorematch_dateplayed_for_teammatchfourssixesno_of_balls
1Ravi802000-05-26CSKCSK vs RCB4560
2Sai452006-05-30RRRR vs SRH3240
3Raghav362001-06-21SRHSRH vs MI1225
4Ravi722005-07-12RCBRCB vs SRH3470
5Sai502006-03-23MIMI vs RCB2344
6Jadhav502006-03-26CSKCSK vs MI3240
7Jadhav542006-05-13CSKCSK vs SRH2440
8Manoj682006-05-23MIMI vs RCB3360
9Ravi922006-05-14SRHSRH vs MI4490
10Karthik322007-02-13MIMI vs RR1228
11Madhu402002-04-13MIMI vs RCB1055
12Sanjay452002-04-12SRHSRH vs RR2060
13Ravi352002-04-13MIMI vs RR0050
14Manoj452005-07-15RRRR vs CSK3172
15Vijay922003-06-20RRRR vs SRH4392
16Sai802006-04-22SRHSRH vs RCB2480


.....

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post

Contact Form