Saturday, 23 March 2019

Employee Salaries:- HackerRank Solution in MYSQL

Problem:-


Write a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than  per month who have been employees for less than  months. Sort your result by ascending employee_id.
Input Format
The Employee table containing employee data for a company is described as follows:
where employee_id is an employee's ID number, name is their name, months is the total number of months they've been working for the company, and salary is the their monthly salary.
Sample Input
Sample Output
Angela
Michael
Todd
Joe
Explanation
Angela has been an employee for  month and earns  per month.
Michael has been an employee for  months and earns  per month.
Todd has been an employee for  months and earns  per month.
Joe has been an employee for  months and earns  per month.
We order our output by ascending employee_id.

Solution:-
Select Name
From Employee
Where Months<10 And Salary>2000
order by employee_id

Employee Names HackerRank Solution in MYSQL

Problem:-


Write a query that prints a list of employee names (i.e.: the name attribute) from the Employee table in alphabetical order.
Input Format
The Employee table containing employee data for a company is described as follows:
where employee_id is an employee's ID number, name is their name, months is the total number of months they've been working for the company, and salary is their monthly salary.
Sample Input
Sample Output
Angela
Bonnie
Frank
Joe
Kimberly
Lisa
Michael
Patrick
Rose
Todd

Solution:-
Select Name
From Employee

Order By Name Asc;

Weather Observation Station 12 hackerrank solution in SQL Server

Problem:-
Query the list of CITY names from STATION that do not start with vowels and do not end with vowels. Your result cannot contain duplicates.
Input Format
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.

Solution:-

Select Distinct CITY
From Station

where city Like '[^aeiou]%[^aeiou]';

Java Substring Example

Problem:-
Given a string, , and two indices,  and , print a substring consisting of all characters in the inclusive range from  to . You'll find the String class' substring method helpful in completing this challenge.
Input Format
The first line contains a single string denoting .
The second line contains two space-separated integers denoting the respective values of  and .
Constraints
  • String  consists of English alphabetic letters (i.e., ) only.
Output Format
Print the substring in the inclusive range from  to .
Sample Input
Helloworld
3 7
Sample Output
lowo
Explanation
In the diagram below, the substring is highlighted in green:
substring.png


Solution:-

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String S = in.next();
int start = in.nextInt();
int end = in.nextInt();
System.out.println(S.substring(start,end));
}
}


Error While embed the video in Your website page

Error:- Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'sameorigin Solution:- if ...