SOLVE

LATER

Play with Ranges!

Problem

Editorial

Analytics

Mishki loves to play with data and now she wants some interesting data from the given data. Given two tables:

1) **Range_Details** : It consists one column **Limits** containing the ranges of the height of the students, in the form of **a-b**, where a the lower limit and b is the upper limit of the height.

2) **Heights**: It consists of one column **Height** containing the heights of people.

For each height in the **Height** table, you need to tell the ranges, in which the height is between its lower and upper limit (inclusive both limits). The ranges should be printed in the sorted order of their difference of upper and lower limit.

The data should be printed in the ascending order of heights.

Table : **Range_Details**

Field | Type |
---|---|

Limits | text |

Table: **Heights**

Field | Type |
---|---|

Height | int |

Field | Type |
---|---|

Height | int |

Specific_Ranges | text |

**Sample Range_Details Table:**

Limits |
---|

0-9 |

7-12 |

4-4 |

**Sample Heights Table:**

Height |
---|

9 |

4 |

Height | Specific_Ranges |
---|---|

4 | 4-4,0-9 |

9 | 7-12,0-9 |

Time Limit:
5 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
MySQL,
PostgreSQL,
MSSQL,
Oracle_Db

Initializing Code Editor...

{"80f29a9": "/pagelets/recommended-problems/sql/play-with-ranges/", "e398fc8": "/pagelets/problem-author-tester/sql/play-with-ranges/", "b31f53d": "/pagelets/suggested-problems/sql/play-with-ranges/", "ea54743": "/pagelets/show-submission/sql/play-with-ranges/", "4860ef7": "/pagelets/problems-hint/sql/play-with-ranges/"}

realtime.hackerearth.com

80

038857a5ce979f926b0704572de9bff359651e61

58a29e5cae2309f04b28

/realtime/pusher/auth/