SELECT CONCAT(Name, "(", LEFT(Occupation, 1), ")") FROM OCCUPATIONS ORDER BY Name; SELECT CONCAT("There are a total of ", COUNT(Occupation), " ", LCASE(Occupation) , "s.") FROM OCCUPATIONS GROUP BY Occupation ORDER BY COUNT(Occupation), Occupation;
31 January 2018
The PADS
My solution:
Type of Triangle
My solution:
SELECT IF(( A + B > C AND ABS(A - B) < C ) AND ( A + C > B AND ABS(A - C) < B ) AND ( B + C > A AND ABS(B - C) < A ), IF (A = B AND A = C AND B = C, "Equilateral", IF(A = B OR B = C OR A = C, "Isosceles", "Scalene")), "Not A Triangle") FROM TRIANGLES;
Employee Salaries
My solution:
SELECT name FROM Employee WHERE salary > 2000 AND months < 10 ORDER BY employee_id;
Higher Than 75 Marks
My solution:
SELECT Name FROM STUDENTS WHERE Marks > 75 ORDER BY RIGHT(Name, 3), ID;
Weather Observation Station 12
My solution:
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP "^[^AEIOU].*[^aeiou]$";
Weather Observation Station 5
My solution:
(SELECT CITY, LENGTH(CITY) FROM STATION GROUP BY CITY HAVING LENGTH(CITY) <= (SELECT MIN(LENGTH(CITY)) FROM STATION) LIMIT 1) UNION (SELECT CITY, LENGTH(CITY) FROM STATION GROUP BY CITY HAVING LENGTH(CITY) >= (SELECT MAX(LENGTH(CITY)) FROM STATION) LIMIT 1);
Weather Observation Station 11
My solution:
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP "^.*[^aeiou]$" OR CITY REGEXP "^[^AEIOU].*$";
Weather Observation Station 10
My solution:
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP "^.*[^aeiou]$";
Weather Observation Station 9
My solution:
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP "^[^AEIOU].*$";
Weather Observation Station 8
My solution:
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP "^(A|E|I|O|U).*(a|e|i|o|u)$";
Weather Observation Station 7
My solution:
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";
Weather Observation Station 6
My solution:
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%";
Subscribe to:
Posts (Atom)