Skip to main content

Posts

Showing posts from September, 2022

Write a query that prints a list of employee names for employees in Employee having a salary greater than 2000

  Write a query that prints a list of employee names (i.e.: the  name  attribute) for employees in  Employee  having a salary greater than  2000  per month who have been employees for less than  10  months. Sort your result by ascending  employee_id . Input Format The  Employee  table containing employee data for a company is described as follows: Column Type employee_id Integer name String months Integer salary Integer 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 employee_id name months salary 12228 Rose 15 1968 33645 Angela 1 3443 45692 Frank 17 1608 56118 Patrick 7 1345 59725 Lisa 11 2330 74197 Kimberly 16 4372 78454 Bonnie 8 1771 83565 Michael 6 2017 98607 Todd 5 3396 99989 Joe 9 3573 Sample Output Angela Michael Todd Joe Explanat...

Select Names from table which have vowels

  Problem Query the list of  CITY  names from  table  which have vowels (i.e.,  a ,  e ,  i ,  o , and  u ) as both their first  and  last characters. Your result cannot contain duplicates. Input Format The  STATION  table is described as follows: Field Type ID NUMBER CITY VARCHAR2(21) STATE VARCHAR2(2) LAT_N NUMBER LONG_W NUMBER STATION where  LAT_N  is the northern latitude and  LONG_W  is the western longitude. MYSQL select distinct city from station where (city like 'a%' or city like 'e%' or city like 'i%' or city like 'o%' or city like 'u%' ) and ( city like '%a' or city like '%e' or city like '%i' or city like '%o' or city like '%u' )

Print Prime Numbers in SQL

  Problem Write a query to print all  prime numbers  less than or equal to  1000 . Print your result on a single line, and use the ampersand ( & ) character as your separator (instead of a space). For example, the output for all prime numbers  <= 10  would be 2&3&5&7 DECLARE i NUMBER ( 3 ) ; j NUMBER ( 3 ) ; BEGIN dbms_output . Put_line ( 'The prime numbers are:' ) ; dbms_output . new_line ; i : = 2 ; LOOP j : = 2 ; LOOP EXIT WHEN ( ( MOD ( i , j ) = 0 ) OR ( j = i ) ) ; j : = j + 1 ; END LOOP ; IF ( j = i ) THEN dbms_output . Put ( i || ' ' ) ; END IF ; i : = i + 1 ; exit WHEN i = 50 ; END LOOP ; dbms_output . new_line ; END ; / Enter your query here. Please append a semicolon ";" at the end of the query and enter your query in a single line to a...