{"id":36671,"date":"2019-10-31T22:13:01","date_gmt":"2019-10-31T19:13:01","guid":{"rendered":"https:\/\/prohoster.info\/blog\/sql-zanimatelnye-zadachki\/"},"modified":"2019-10-31T22:13:01","modified_gmt":"2019-10-31T19:13:01","slug":"sql-zanimatelnye-zadachki","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/news\/sql-zanimatelnye-zadachki","title":{"rendered":"SQL. Problematika interesante","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>P\u00ebrsh\u00ebndetje, Habr!<\/p>\n<p>Tani e m\u00eb shum\u00eb se 3 vjet, un\u00eb jap m\u00ebsime SQL n\u00eb qendra t\u00eb ndryshme trajnimi, dhe nj\u00eb nga v\u00ebzhgimet e mia \u00ebsht\u00eb se student\u00ebt m\u00ebsojn\u00eb dhe kuptojn\u00eb m\u00eb mir\u00eb SQL n\u00ebse u jepet nj\u00eb detyr\u00eb, dhe jo thjesht u tregohen mund\u00ebsit\u00eb dhe bazat teorike.<\/p>\n<p>N\u00eb k\u00ebt\u00eb artikull do t\u00eb ndaj me ju list\u00ebn time t\u00eb detyrave q\u00eb u jap student\u00ebve si detyr\u00eb sht\u00ebpie dhe p\u00ebr t\u00eb cilat zhvillojm\u00eb lloje t\u00eb ndryshme brainstorming, gj\u00eb q\u00eb \u00e7on n\u00eb nj\u00eb kuptim t\u00eb thell\u00eb dhe t\u00eb qart\u00eb t\u00eb SQL.<\/p>\n<p><img decoding=\"async\" alt=\"SQL. Problematika interesante\" src=\"\/wp-content\/uploads\/2019\/07\/283f472e0c382c0621ffc14e2ac06881.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nSQL (\u02c8\u025bs\u02c8kju\u02c8\u025bl; anglisht: structured query language \u2013 'gjuha e pyetjeve t\u00eb strukturuara') \u00ebsht\u00eb nj\u00eb gjuh\u00eb programimi deklarative, e cila p\u00ebrdoret p\u00ebr t\u00eb krijuar, modifikuar dhe menaxhuar t\u00eb dh\u00ebnat n\u00eb nj\u00eb baz\u00eb t\u00eb dh\u00ebnash relacionale, t\u00eb menaxhuar nga nj\u00eb sistem p\u00ebr menaxhimin e bazave t\u00eb t\u00eb dh\u00ebnave. <noindex><a rel=\"nofollow\" href=\"https:\/\/ru.wikipedia.org\/wiki\/SQL\">M\u00eb shum\u00eb\u2026 <\/a><\/noindex><\/p>\n<p>Mund t\u00eb lexoni mbi SQL n\u00eb t\u00eb ndryshme <noindex><a rel=\"nofollow\" href=\"https:\/\/www.google.com\/search?q=SQL\">burime<\/a><\/noindex>.<br \/>\nKy artikull nuk ka p\u00ebr q\u00ebllim t'ju m\u00ebsoj\u00eb SQL nga e para.<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nPra, le t\u00eb fillojm\u00eb.<\/p>\n<p>Do t\u00eb p\u00ebrdorim t\u00eb njohur\u00ebn <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/oracle\/db-sample-schemas\/tree\/master\/human_resources\">skem\u00ebn HR<\/a><\/noindex> n\u00eb Oracle me tabelat e saj (<noindex><a rel=\"nofollow\" href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/12.2\/comsc\/HR-sample-schema-table-descriptions.html\">M\u00eb shum\u00eb<\/a><\/noindex>):<\/p>\n<p><img decoding=\"async\" alt=\"SQL. Problematika interesante\" src=\"\/wp-content\/uploads\/2019\/07\/b518c0bedd0d7bbeaedbcc4bd95079cd.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nDua t\u00eb theksoj se do t\u00eb trajtojm\u00eb vet\u00ebm detyrat n\u00eb SELECT. Nuk ka detyra p\u00ebr DML dhe DDL.<\/p>\n<h2>Detyrat<\/h2>\n<p>\n<b>Kufizimi dhe Renditja e T\u00eb Dh\u00ebnave<\/b><\/p>\n<p>Tabela Employees. Merrni list\u00ebn me informacion p\u00ebr t\u00eb gjith\u00eb punonj\u00ebsit <br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT * FROM employees\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve me emrin 'David'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE first_name = 'David';\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve me job_id t\u00eb barabart\u00eb me 'IT_PROG'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE job_id = 'IT_PROG'\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve nga departamenti i 50-t\u00eb (department_id) me pag\u00eb (salary) m\u00eb t\u00eb madhe se 4000<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE department_id = 50 AND salary &gt; 4000;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve nga departamenti i 20-t\u00eb dhe ai i 30-t\u00eb (department_id)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE department_id = 20 OR department_id = 30;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebt kan\u00eb shkronj\u00ebn e fundit n\u00eb em\u00ebr 'a'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE first_name LIKE '%a';\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve nga departamenti i 50-t\u00eb dhe ai i 80-t\u00eb (department_id) t\u00eb cil\u00ebt kan\u00eb bonus (vlera n\u00eb kolon\u00ebn commission_pct nuk \u00ebsht\u00eb e zbraz\u00ebt)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE     (department_id = 50 OR department_id = 80)\n       AND commission_pct IS NOT NULL;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebve n\u00eb em\u00ebr u p\u00ebrmbahen t\u00eb pakt\u00ebn 2 shkronja 'n'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE first_name LIKE '%n%n%';\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebt kan\u00eb nj\u00eb em\u00ebr m\u00eb t\u00eb gjat\u00eb se 4 shkronja<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE first_name LIKE '%_____%';\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebt pagat e tyre jan\u00eb n\u00eb intervalin nga 8000 deri n\u00eb 9000 (p\u00ebrfshir\u00eb)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE salary BETWEEN 8000 AND 9000;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebve n\u00eb em\u00ebr p\u00ebrmban simbolin '%'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE first_name LIKE '%%%' ESCAPE '';\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb ID menaxher\u00ebve<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT DISTINCT manager_id\n  FROM employees\n WHERE manager_id IS NOT NULL;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e punonj\u00ebsve me pozitat e tyre n\u00eb formatin: Donald(sh_clerk)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name || '(' || LOWER (job_id) || ')' employee FROM employees;\n<\/code><\/pre>\n<p>\n<b>P\u00ebrdorimi i funksioneve t\u00eb vetme t\u00eb rreshtave p\u00ebr t\u00eb personalizuar daljen<\/b><\/p>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve, t\u00eb cil\u00ebve gjat\u00ebsia e emrit \u00ebsht\u00eb m\u00eb e madhe se 10 shkronja<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE LENGTH (first_name) &gt; 10;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebve n\u00eb em\u00ebr ka shkronj\u00ebn 'b' (pa marr\u00eb parasysh rastin)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE INSTR (LOWER (first_name), 'b') &gt; 0;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebve n\u00eb em\u00ebr p\u00ebrmbahen t\u00eb pakt\u00ebn 2 shkronja 'a'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE INSTR (LOWER (first_name),'a',1,2) &gt; 0;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve, t\u00eb cil\u00ebve paga \u00ebsht\u00eb shum\u00ebfish i 1000<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE MOD (salary, 1000) = 0;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni numrin e par\u00eb 3-shkronjor t\u00eb telefonit t\u00eb punonj\u00ebsit n\u00ebse numri i tij \u00ebsht\u00eb n\u00eb formatin XXX.XXX.XXXX<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT phone_number, SUBSTR (phone_number, 1, 3) new_phone_number\n  FROM employees\n WHERE phone_number LIKE '___.___.____';\n<\/code><\/pre>\n<p>Tabela Departments. Merrni fjal\u00ebn e par\u00eb nga emri i departamentit p\u00ebr ata, t\u00eb cil\u00ebve emri ka m\u00eb shum\u00eb se nj\u00eb fjal\u00eb<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT department_name,\n       SUBSTR (department_name, 1, INSTR (department_name, ' ')-1)\n           first_word\n  FROM departments\n WHERE INSTR (department_name, ' ') &gt; 0;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni emrat e punonj\u00ebsve pa shkronj\u00ebn e par\u00eb dhe t\u00eb fundit n\u00eb em\u00ebr<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name, SUBSTR (first_name, 2, LENGTH (first_name) - 2) new_name\n  FROM employees;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebve shkronja e fundit n\u00eb em\u00ebr \u00ebsht\u00eb 'm' dhe gjat\u00ebsi emri \u00ebsht\u00eb m\u00eb e madhe se 5<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE SUBSTR (first_name, -1) = 'm' AND LENGTH(first_name) &gt; 5;\n<\/code><\/pre>\n<p>Tabela Dual. Merrni dat\u00ebn e s\u00eb premtes s\u00eb ardhshme<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT NEXT_DAY (SYSDATE, 'FRIDAY') next_friday FROM DUAL;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve, t\u00eb cil\u00ebt punojn\u00eb n\u00eb company m\u00eb shum\u00eb se 17 vjet<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE MONTHS_BETWEEN (SYSDATE, hire_date) \/ 12 &gt; 17;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve, t\u00eb cil\u00ebve shifra e fundit t\u00eb numrit t\u00eb telefonit \u00ebsht\u00eb \u00e7ifti dhe p\u00ebrb\u00ebhet nga 3 numra t\u00eb ndar\u00eb me pik\u00eb<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE MOD (SUBSTR (phone_number, -1), 2) != 0\n       AND INSTR (phone_number,'.',1,3) = 0;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve t\u00eb cil\u00ebve n\u00eb vler\u00ebn e job_id pas shenj\u00ebs '_' ka t\u00eb pakt\u00ebn 3 simbol, por kjo vler\u00eb pas '_' nuk \u00ebsht\u00eb e barabart\u00eb me 'CLERK'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE LENGTH (SUBSTR (job_id, INSTR (job_id, '_') + 1)) &gt; 3\n       AND SUBSTR (job_id, INSTR (job_id, '_') + 1) != 'CLERK';\n<\/code><\/pre>\n<p>Tabela Employees. Merrni list\u00ebn e t\u00eb gjith\u00eb punonj\u00ebsve duke z\u00ebvend\u00ebsuar n\u00eb vler\u00ebn PHONE_NUMBER t\u00eb gjith\u00eb '.' me '-'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT phone_number, REPLACE (phone_number, '.', '-') new_phone_number\n  FROM employees;\n<\/code><\/pre>\n<p>\n<b>Duke p\u00ebrdorur funksionet e konvertimit dhe shprehjet kondicionale<\/b><\/p>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb t\u00eb gjith\u00eb punonj\u00ebsve q\u00eb filluan pun\u00eb n\u00eb dit\u00ebn e par\u00eb t\u00eb \u00e7do muaji<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE TO_CHAR (hire_date, 'DD') = '01';\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb t\u00eb gjith\u00eb punonj\u00ebsve q\u00eb filluan pun\u00eb n\u00eb vitin 2008<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE TO_CHAR (hire_date, 'YYYY') = '2008';\n<\/code><\/pre>\n<p>Tabela DUAL. Trego dat\u00ebn e nes\u00ebrme n\u00eb formatin: Nes\u00ebr \u00ebsht\u00eb dita e dyt\u00eb e Janarit<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT TO_CHAR (SYSDATE, 'fm\"\"Nes\u00ebr \u00ebsht\u00eb \"\"Ddspth \"\"dita e\"\" Month')     info\n  FROM DUAL;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb t\u00eb gjith\u00eb punonj\u00ebsve dhe dat\u00ebn e nisjes s\u00eb pun\u00ebs p\u00ebr secilin n\u00eb formatin: 21st of June, 2007<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name, TO_CHAR (hire_date, 'fmddth \"\"of\"\" Month, YYYY') hire_date\n  FROM employees;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb punonj\u00ebsve me rritje t\u00eb pagave prej 20%. Trego pag\u00ebn me shenj\u00ebn e dollarit<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name, TO_CHAR (salary + salary * 0.20, 'fm$999,999.00') new_salary\n  FROM employees;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb t\u00eb gjith\u00eb punonj\u00ebsve q\u00eb filluan pun\u00eb n\u00eb shkurt 2007.<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE hire_date BETWEEN TO_DATE ('01.02.2007', 'DD.MM.YYYY')\n                     AND LAST_DAY (TO_DATE ('01.02.2007', 'DD.MM.YYYY'));\n\nSELECT *\n  FROM employees\n WHERE to_char(hire_date,'MM.YYYY') = '02.2007'; \n<\/code><\/pre>\n<p>Tabela DUAL. Tregoni dat\u00ebn aktuale, + sekond\u00eb, + minut\u00eb, + or\u00eb, + dit\u00eb, + muaj, + vit<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT SYSDATE                          now,\n       SYSDATE + 1 \/ (24 * 60 * 60)     plus_second,\n       SYSDATE + 1 \/ (24 * 60)          plus_minute,\n       SYSDATE + 1 \/ 24                 plus_hour,\n       SYSDATE + 1                      plus_day,\n       ADD_MONTHS (SYSDATE, 1)          plus_month,\n       ADD_MONTHS (SYSDATE, 12)         plus_year\n  FROM DUAL;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb t\u00eb gjith\u00eb punonj\u00ebsve me pagat e plota (salary + commission_pct(%)) n\u00eb formatin: $24,000.00<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name, salary, TO_CHAR (salary + salary * NVL (commission_pct, 0), 'fm$99,999.00') full_salary\n  FROM employees;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb t\u00eb gjith\u00eb punonj\u00ebsve dhe informacionin mbi pranin\u00eb e bonuseve n\u00eb paga (Po\/Jo)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name, commission_pct, NVL2 (commission_pct, 'Po', 'Jo') has_bonus\n  FROM employees;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nivelin e pag\u00ebs p\u00ebr secilin punonj\u00ebs: M\u00eb pak se 5000 konsiderohet Nivel i Ul\u00ebt, M\u00eb shum\u00eb ose t\u00eb barabarta me 5000 dhe m\u00eb pak se 10000 konsiderohet Nivel Normal, M\u00eb shum\u00eb ose t\u00eb barabarta me 10000 konsiderohet Nivel i Lart\u00eb<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name,\n       salary,\n       CASE\n           WHEN salary = 5000 AND salary &lt; 10000 THEN &#039;Normal&#039;\n           ELSE &#039;I Lart\u00eb&#039;\n       END salary_level\n  FROM employees;\n<\/code><\/pre>\n<p>Tabela Countries. P\u00ebr \u00e7do vend tregoni regjionin n\u00eb t\u00eb cilin ndodhet: 1-Evropa, 2-Amerika, 3-Azia, 4-Afrika (pa Join)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT country_name country,\n       DECODE (region_id,\n               1, 'Evropa',\n               2, 'Amerika',\n               3, 'Asi',\n               4, 'Afrika',\n               'T\u00eb panjohura')\n           region\n  FROM countries;\n\nSELECT country_name\n           country,\n       CASE region_id\n           WHEN 1 THEN 'Evropa'\n           WHEN 2 THEN 'Amerika'\n           WHEN 3 THEN 'Asi'\n           WHEN 4 THEN 'Afrika'\n           ELSE 'T\u00eb panjohura'\n       END\n           region\n  FROM countries;\n<\/code><\/pre>\n<p>\n<b>Raportimi i t\u00eb Dh\u00ebnave t\u00eb Grumbulluara duke P\u00ebrdorur Funksionet e Grupit<\/b><\/p>\n<p>Tabela Punonj\u00ebsit. Merrni raport p\u00ebr department_id me pag\u00ebn minimale dhe maksimale, me dat\u00ebn m\u00eb her\u00ebt dhe m\u00eb von\u00eb t\u00eb fillimit t\u00eb pun\u00ebs dhe me numrin e punonj\u00ebsve. Rendisni sipas numrit t\u00eb punonj\u00ebsve (n\u00eb r\u00ebnie)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT department_id,\n         MIN (salary) min_salary,\n         MAX (salary) max_salary,\n         MIN (hire_date) min_hire_date,\n         MAX (hire_date) max_hire_Date,\n         COUNT (*) count\n    FROM employees\nGROUP BY department_id\norder by count(*) desc;\n<\/code><\/pre>\n<p>Tabela Punonj\u00ebsit. Sa punonj\u00ebs ka emra t\u00eb cil\u00ebt fillojn\u00eb me t\u00eb nj\u00ebjt\u00ebn shkronj\u00eb? Rendisni sipas numrit. Shfaqni vet\u00ebm ata ku numri \u00ebsht\u00eb m\u00eb shum\u00eb se 1<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT SUBSTR (first_name, 1, 1) first_char, COUNT (*)\n    FROM employees\nGROUP BY SUBSTR (first_name, 1, 1)\n  HAVING COUNT (*) &gt; 1\nORDER BY 2 DESC;\n<\/code><\/pre>\n<p>Tabela Punonj\u00ebsit. Sa punonj\u00ebs ka q\u00eb punojn\u00eb n\u00eb t\u00eb nj\u00ebjtin departament dhe marrin t\u00eb nj\u00ebjt\u00ebn pag\u00eb?<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT department_id, salary, COUNT (*)\n    FROM employees\nGROUP BY department_id, salary\n  HAVING COUNT (*) &gt; 1;\n<\/code><\/pre>\n<p>Tabela Punonj\u00ebsit. Merrni raportin se sa punonj\u00ebs jan\u00eb pun\u00ebsuar \u00e7do dit\u00eb t\u00eb jav\u00ebs. Rendisni sipas numrit<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT TO_CHAR (hire_Date, 'Day') day, COUNT (*)\n    FROM employees\nGROUP BY TO_CHAR (hire_Date, 'Day')\nORDER BY 2 DESC;\n<\/code><\/pre>\n<p>Tabela Punonj\u00ebsit. Merrni raportin se sa punonj\u00ebs jan\u00eb pun\u00ebsuar sipas viteve. Rendisni sipas numrit<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT TO_CHAR (hire_date, 'YYYY') year, COUNT (*)\n    FROM employees\nGROUP BY TO_CHAR (hire_date, 'YYYY');\n<\/code><\/pre>\n<p>Tabela Punonj\u00ebsit. Merrni numrin e departamenteve ku ka punonj\u00ebs<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT COUNT (COUNT (*)) department_count\n    FROM employees\n   WHERE department_id IS NOT NULL\nGROUP BY department_id;\n<\/code><\/pre>\n<p>Tabela Punonj\u00ebsit. Merrni list\u00ebn department_id ku punojn\u00eb m\u00eb shum\u00eb se 30 punonj\u00ebs<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT department_id\n    FROM employees\nGROUP BY department_id\n  HAVING COUNT (*) &gt; 30;\n<\/code><\/pre>\n<p>Tabela Punonj\u00ebsit. Merrni list\u00ebn department_id dhe pag\u00ebn mesatare t\u00eb rrethuar t\u00eb punonj\u00ebsve n\u00eb \u00e7do departament. <br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT department_id, ROUND (AVG (salary)) avg_salary\n    FROM employees\nGROUP BY department_id;\n<\/code><\/pre>\n<p>Tabela Vendet. Merrni list\u00ebn region_id shum\u00ebn e t\u00eb gjitha karaktereve n\u00eb t\u00eb gjitha country_name q\u00eb kan\u00eb m\u00eb shum\u00eb se 60<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT region_id\n    FROM countries\nGROUP BY region_id\n  HAVING SUM (LENGTH (country_name)) &gt; 60;\n<\/code><\/pre>\n<p>Tabela Punonj\u00ebsit. Merrni list\u00ebn department_id ku punojn\u00eb punonj\u00ebs me disa (&gt;1) job_id<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT department_id\n    FROM employees\nGROUP BY department_id\n  HAVING COUNT (DISTINCT job_id) &gt; 1;\n<\/code><\/pre>\n<p>Tabeli Employees. Merrni list\u00ebn e manager_id-ve q\u00eb kan\u00eb m\u00eb shum\u00eb se 5 n\u00ebnt\u00eb punonj\u00ebs dhe shuma e pagave t\u00eb t\u00eb gjith\u00eb n\u00ebnt\u00eb punonj\u00ebsve \u00ebsht\u00eb mbi 50000<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT manager_id\n    FROM employees\nGROUP BY manager_id\n  HAVING COUNT (*) &gt; 5 AND SUM (salary) &gt; 50000;\n<\/code><\/pre>\n<p>Tabeli Employees. Merrni list\u00ebn e manager_id-ve q\u00eb pagat mesatare t\u00eb t\u00eb gjith\u00eb n\u00ebnt\u00eb punonj\u00ebsve jan\u00eb brenda intervalit nga 6000 deri n\u00eb 9000 dhe q\u00eb nuk marrin bonuse (commission_pct \u00ebsht\u00eb bosh)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT manager_id, AVG (salary) avg_salary\n    FROM employees\n   WHERE commission_pct IS NULL\nGROUP BY manager_id\n  HAVING AVG (salary) BETWEEN 6000 AND 9000;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni pag\u00ebn maksimale nga t\u00eb gjith\u00eb punonj\u00ebsit me job_id q\u00eb p\u00ebrfundojn\u00eb me fjal\u00ebn 'CLERK'<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT MAX (salary) max_salary\n  FROM employees\n WHERE job_id LIKE '%CLERK';\n\nSELECT MAX (salary) max_salary\n  FROM employees\n WHERE SUBSTR (job_id, -5) = 'CLERK';\n<\/code><\/pre>\n<p>Tabeli Employees. Merrni pag\u00ebn maksimale mes t\u00eb gjitha pagave mesatare p\u00ebr departamentin<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT MAX (AVG (salary))\n    FROM employees\nGROUP BY department_id;\n<\/code><\/pre>\n<p>Tabeli Employees. Merrni numrin e punonj\u00ebsve me t\u00eb nj\u00ebjtin num\u00ebr shkronjash n\u00eb em\u00ebr. Tregoni vet\u00ebm ata q\u00eb kan\u00eb nj\u00eb em\u00ebr m\u00eb t\u00eb gjat\u00eb se 5 dhe numri i punonj\u00ebsve me at\u00eb em\u00ebr \u00ebsht\u00eb mbi 20. Renditni sipas gjat\u00ebsi emri<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT LENGTH (first_name), COUNT (*)\n    FROM employees\nGROUP BY LENGTH (first_name)\n  HAVING LENGTH (first_name) &gt; 5 AND COUNT (*) &gt; 20\nORDER BY LENGTH (first_name);\n\n  SELECT LENGTH (first_name), COUNT (*)\n    FROM employees\n   WHERE LENGTH (first_name) &gt; 5\nGROUP BY LENGTH (first_name)\n  HAVING COUNT (*) &gt; 20\nORDER BY LENGTH (first_name);\n<\/code><\/pre>\n<p>\n<b>Tregimi i t\u00eb Dh\u00ebnave nga M\u00eb shum\u00eb Tabela duke P\u00ebrdorur Bashkime<\/b><\/p>\n<p>Tabeli Employees, Departaments, Locations, Countries, Regions. Merrni list\u00ebn e rajoneve dhe numrin e punonj\u00ebsve n\u00eb secilin rajon<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT region_name, COUNT (*)\n    FROM employees e\n         JOIN departments d ON (e.department_id = d.department_id)\n         JOIN locations l ON (d.location_id = l.location_id)\n         JOIN countries c ON (l.country_id = c.country_id)\n         JOIN regions r ON (c.region_id = r.region_id)\nGROUP BY region_name;\n<\/code><\/pre>\n<p>Tabeli Employees, Departaments, Locations, Countries, Regions. Merrni informacion detal p\u00ebr secilin punonj\u00ebs:<br \/>\nFirst_name, Last_name, Departament, Job, Street, Country, Region<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT First_name,\n       Last_name,\n       Department_name,\n       Job_id,\n       street_address,\n       Country_name,\n       Region_name\n  FROM employees  e\n       JOIN departments d ON (e.department_id = d.department_id)\n       JOIN locations l ON (d.location_id = l.location_id)\n       JOIN countries c ON (l.country_id = c.country_id)\n       JOIN regions r ON (c.region_id = r.region_id);\n<\/code><\/pre>\n<p>Tabeli Employees. Tregoni t\u00eb gjith\u00eb menaxher\u00ebt q\u00eb kan\u00eb m\u00eb shum\u00eb se 6 punonj\u00ebs n\u00eb n\u00ebnshtrim<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">  SELECT man.first_name, COUNT (*)\n    FROM employees emp JOIN employees man ON (emp.manager_id = man.employee_id)\nGROUP BY man.first_name\n  HAVING COUNT (*) &gt; 6;\n<\/code><\/pre>\n<p>Tabeli Employees. Tregoni t\u00eb gjith\u00eb punonj\u00ebsit q\u00eb nuk kan\u00eb ask\u00ebnd n\u00ebnshtruar<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT emp.first_name\n  FROM employees emp\n       LEFT JOIN employees man ON (emp.manager_id = man.employee_id)\n WHERE man.FIRST_NAME IS NULL;\n\nSELECT first_name\n  FROM employees\n WHERE manager_id IS NULL;\n<\/code><\/pre>\n<p>Tabela Employees, Job_history. Tabela Employee mban t\u00eb gjith\u00eb punonj\u00ebsit. N\u00eb tabel\u00ebn Job_history ruhen punonj\u00ebsit q\u00eb kan\u00eb l\u00ebn\u00eb kompanin\u00eb. Merrni nj\u00eb raport p\u00ebr t\u00eb gjith\u00eb punonj\u00ebsit dhe statusin e tyre n\u00eb kompani (Aktualisht Punon ose Eka l\u00ebn\u00eb kompanin\u00eb me dat\u00ebn e largimit)<br \/>\nShembulli:<br \/>\nfirst_name | status<br \/>\nJennifer | Eka l\u00ebn\u00eb kompanin\u00eb m\u00eb 31 Dhjetor, 2006<br \/>\nClara | Aktualisht Punon<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name,\n       NVL2 (\n           end_date,\n           TO_CHAR (end_date, 'fm\"\"Eka l\u00ebn\u00eb kompanin\u00eb m\u00eb\"\" DD \"\"n\u00eb\"\" Muaj, YYYY'),\n           'Aktualisht Punon')\n           status\n  FROM employees e LEFT JOIN job_history j ON (e.employee_id = j.employee_id);\n<\/code><\/pre>\n<p>Tabela Employees, Departaments, Locations, Countries, Regions. Merrni nj\u00eb list\u00eb t\u00eb punonj\u00ebsve q\u00eb jetojn\u00eb n\u00eb Evrop\u00eb (region_name)<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\"> SELECT first_name\n  FROM employees\n       JOIN departments USING (department_id)\n       JOIN locations USING (location_id)\n       JOIN countries USING (country_id)\n       JOIN regions USING (region_id)\n WHERE region_name = 'Europe';\n \n SELECT first_name\n  FROM employees e\n       JOIN departments d ON (e.department_id = d.department_id)\n       JOIN locations l ON (d.location_id = l.location_id)\n       JOIN countries c ON (l.country_id = c.country_id)\n       JOIN regions r ON (c.region_id = r.region_id)\n WHERE region_name = 'Europe';\n<\/code><\/pre>\n<p>Tabela Employees, Departaments. Tregon t\u00eb gjith\u00eb departamentet ku punojn\u00eb m\u00eb shum\u00eb se 30 punonj\u00ebs<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT department_name, COUNT (*)\n    FROM employees e JOIN departments d ON (e.department_id = d.department_id)\nGROUP BY department_name\n  HAVING COUNT (*) &gt; 30;\n<\/code><\/pre>\n<p>Tabela Employees, Departaments. Tregon t\u00eb gjith\u00eb punonj\u00ebsit q\u00eb nuk jan\u00eb an\u00ebtar\u00eb n\u00eb asnj\u00eb departament<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name\n  FROM employees e\n       LEFT JOIN departments d ON (e.department_id = d.department_id)\n WHERE d.department_name IS NULL;\n\nSELECT first_name\n  FROM employees\n WHERE department_id IS NULL;\n<\/code><\/pre>\n<p>Tabela Employees, Departaments. Tregon t\u00eb gjith\u00eb departamentet ku nuk ka asnj\u00eb punonj\u00ebs<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT department_name\n  FROM employees e\n       RIGHT JOIN departments d ON (e.department_id = d.department_id)\n WHERE first_name IS NULL;\n<\/code><\/pre>\n<p>Tabela Employees. Tregon t\u00eb gjith\u00eb punonj\u00ebsit q\u00eb nuk kan\u00eb ask\u00ebnd n\u00eb raportin e menaxhimit<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT man.first_name\n  FROM employees emp\n       RIGHT JOIN employees man ON (emp.manager_id = man.employee_id)\n WHERE emp.FIRST_NAME IS NULL;\n<\/code><\/pre>\n<p>Tabela Employees, Jobs, Departaments. Tregon punonj\u00ebsit n\u00eb format: First_name, Job_title, Department_name.<br \/>\nShembulli:<br \/>\nFirst_name | Job_title | Department_name<br \/>\nDonald | Shipping | Clerk Shipping<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name, job_title, department_name\n  FROM employees e\n       JOIN jobs j ON (e.job_id = j.job_id)\n       JOIN departments d ON (d.department_id = e.department_id);\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb punonj\u00ebsve ku menaxher\u00ebt e tyre jan\u00eb pun\u00ebsuar n\u00eb vitin 2005, nd\u00ebrkoh\u00eb q\u00eb k\u00ebta punonj\u00ebs jan\u00eb pun\u00ebsuar para vitit 2005<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT emp.*\n  FROM employees emp JOIN employees man ON (emp.manager_id = man.employee_id)\n WHERE     TO_CHAR (man.hire_date, 'YYYY') = '2005'\n       AND emp.hire_date &lt; TO_DATE (&#039;01012005&#039;, &#039;DDMMYYYY&#039;);\n<\/code><\/pre>\n<p>Tabela e Punonj\u00ebsve. Merrni list\u00ebn e punonj\u00ebsve t\u00eb menaxher\u00ebve t\u00eb cil\u00ebt kan\u00eb filluar pun\u00eb n\u00eb muajin janar t\u00eb nj\u00eb viti t\u00eb caktuar dhe gjat\u00ebsia e job_title t\u00eb k\u00ebtyre punonj\u00ebsve \u00ebsht\u00eb m\u00eb e madhe se 15 karaktere<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT emp.*\n  FROM employees emp\n       JOIN employees man ON (emp.manager_id = man.employee_id)\n       JOIN jobs j ON (emp.job_id = j.job_id)\n WHERE TO_CHAR (man.hire_date, 'MM') = '01' AND LENGTH (j.job_title) &gt; 15;\n<\/code><\/pre>\n<p>\n<b>P\u00ebrdorimi i N\u00ebnkuptimeve p\u00ebr t\u00eb Zgjidhur K\u00ebrkesat<\/b><\/p>\n<p>Tabela e Punonj\u00ebsve. Merrni list\u00ebn e punonj\u00ebsve me emrin m\u00eb t\u00eb gjat\u00eb.<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE LENGTH (first_name) =\n       (SELECT MAX (LENGTH (first_name)) FROM employees);\n<\/code><\/pre>\n<p>Tabela e Punonj\u00ebsve. Merrni list\u00ebn e punonj\u00ebsve me pag\u00eb m\u00eb t\u00eb madhe se paga mesatare e t\u00eb gjith\u00eb punonj\u00ebsve.<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE salary &gt; (SELECT AVG (salary) FROM employees);\n<\/code><\/pre>\n<p>Tabela e Punonj\u00ebsve, Departamenteve, Lokacioneve. Merrni qytetin ku punonj\u00ebsit gjithsej fitojn\u00eb m\u00eb pak.<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT city\n    FROM employees e\n         JOIN departments d ON (e.department_id = d.department_id)\n         JOIN locations l ON (d.location_id = l.location_id)\nGROUP BY city\n  HAVING SUM (salary) =\n         (  SELECT MIN (SUM (salary))\n              FROM employees e\n                   JOIN departments d ON (e.department_id = d.department_id)\n                   JOIN locations l ON (d.location_id = l.location_id)\n          GROUP BY city);\n<\/code><\/pre>\n<p>Tabela e Punonj\u00ebsve. Merrni list\u00ebn e punonj\u00ebsve q\u00eb menaxheri i tyre fitojn\u00eb m\u00eb shum\u00eb se 15000.<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE manager_id IN (SELECT employee_id\n                        FROM employees\n                       WHERE salary &gt; 15000)\n<\/code><\/pre>\n<p>Tabela Employees, Departaments. Tregon t\u00eb gjith\u00eb departamentet ku nuk ka asnj\u00eb punonj\u00ebs<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM departments\n WHERE department_id NOT IN (SELECT department_id\n                               FROM employees\n                              WHERE department_id IS NOT NULL);\n<\/code><\/pre>\n<p>Tabela e Punonj\u00ebsve. Tregoni t\u00eb gjith\u00eb punonj\u00ebsit q\u00eb nuk jan\u00eb menaxher\u00eb<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE employee_id NOT IN (SELECT manager_id\n                             FROM employees\n                            WHERE manager_id IS NOT NULL)\n<\/code><\/pre>\n<p>Tabeli Employees. Tregoni t\u00eb gjith\u00eb menaxher\u00ebt q\u00eb kan\u00eb m\u00eb shum\u00eb se 6 punonj\u00ebs n\u00eb n\u00ebnshtrim<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees e\n WHERE (SELECT COUNT (*)\n          FROM employees\n         WHERE manager_id = e.employee_id) &gt; 6;\n<\/code><\/pre>\n<p>Tabela e Punonj\u00ebsve, Departamentet. Tregoni punonj\u00ebsit q\u00eb punojn\u00eb n\u00eb departamentin IT<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE department_id = (SELECT department_id\n                          FROM departments\n                         WHERE department_name = 'IT');\n<\/code><\/pre>\n<p>Tabela Employees, Jobs, Departaments. Tregon punonj\u00ebsit n\u00eb format: First_name, Job_title, Department_name.<br \/>\nShembulli:<br \/>\nFirst_name | Job_title | Department_name<br \/>\nDonald | Shipping | Clerk Shipping<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT first_name,\n       (SELECT job_title\n          FROM jobs\n         WHERE job_id = e.job_id)\n           job_title,\n       (SELECT department_name\n          FROM departments\n         WHERE department_id = e.department_id)\n           department_name\n  FROM employees e;\n<\/code><\/pre>\n<p>Tabela Employees. Merrni nj\u00eb list\u00eb t\u00eb punonj\u00ebsve ku menaxher\u00ebt e tyre jan\u00eb pun\u00ebsuar n\u00eb vitin 2005, nd\u00ebrkoh\u00eb q\u00eb k\u00ebta punonj\u00ebs jan\u00eb pun\u00ebsuar para vitit 2005<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees\n WHERE     manager_id IN (SELECT employee_id\n                            FROM employees\n                           WHERE TO_CHAR (hire_date, 'YYYY') = '2005')\n       AND hire_date &lt; TO_DATE (&#039;01012005&#039;, &#039;DDMMYYYY&#039;);\n<\/code><\/pre>\n<p>Tabela e Punonj\u00ebsve. Merrni list\u00ebn e punonj\u00ebsve t\u00eb menaxher\u00ebve t\u00eb cil\u00ebt kan\u00eb filluar pun\u00eb n\u00eb muajin janar t\u00eb nj\u00eb viti t\u00eb caktuar dhe gjat\u00ebsia e job_title t\u00eb k\u00ebtyre punonj\u00ebsve \u00ebsht\u00eb m\u00eb e madhe se 15 karaktere<br \/>\n<b class=\"spoiler_title\">Zgjidhja<\/b><\/p>\n<pre><code class=\"sql\">SELECT *\n  FROM employees e\n WHERE     manager_id IN (SELECT employee_id\n                            FROM employees\n                           WHERE TO_CHAR (hire_date, 'MM') = '01')\n       AND (SELECT LENGTH (job_title)\n              FROM jobs\n             WHERE job_id = e.job_id) &gt; 15;\n<\/code><\/pre>\n<p>\n<b>K\u00ebto ishin p\u00ebr momentin.<\/b><\/p>\n<p>Shpresoj se detyrat ishin interesante dhe arg\u00ebtuese. <br \/>\nDo t\u00eb p\u00ebrpiqem t\u00eb plot\u00ebsoj k\u00ebt\u00eb list\u00eb detyrash sipas mund\u00ebsive.<br \/>\nI would also be glad to receive any comments and suggestions.<\/p>\n<p>P.S.: If anyone comes up with an interesting task on SELECT, feel free to write in the comments, and I'll add it to the list.<\/p>\n<p>Faleminderit.<br \/>\n<br \/>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/461567\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439, \u0425\u0430\u0431\u0440! \u0412\u043e\u0442 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 3-\u0445 \u043b\u0435\u0442 \u044f \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u044e SQL \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0440\u0435\u043d\u0438\u043d\u0433 \u0446\u0435\u043d\u0442\u0440\u0430\u0445, \u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u043e\u0438\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 SQL \u043b\u0443\u0447\u0448\u0435, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0443, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0430\u0445. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0432\u0430\u043c\u0438 \u0441\u0432\u043e\u0438\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0434\u0430\u044e [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":27465,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[702],"tags":[],"class_list":["post-36671","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439, \u0425\u0430\u0431\u0440! \u0412\u043e\u0442 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 3-\u0445 \u043b\u0435\u0442 \u044f \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u044e SQL \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0440\u0435\u043d\u0438\u043d\u0433 \u0446\u0435\u043d\u0442\u0440\u0430\u0445, \u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u043e\u0438\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 SQL \u043b\u0443\u0447\u0448\u0435, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0443, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/news\/sql-zanimatelnye-zadachki\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47SQL. \u0417\u0430\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439, \u0425\u0430\u0431\u0440! \u0412\u043e\u0442 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 3-\u0445 \u043b\u0435\u0442 \u044f \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u044e SQL \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0440\u0435\u043d\u0438\u043d\u0433 \u0446\u0435\u043d\u0442\u0440\u0430\u0445, \u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u043e\u0438\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 SQL \u043b\u0443\u0447\u0448\u0435, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0443, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/news\/sql-zanimatelnye-zadachki\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T19:13:01+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:13:01+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47SQL. Engaging Tasks | ProHoster","description":"Hello, Habr! For over 3 years, I have been teaching SQL in various training centers, and one of my observations is that students master and understand SQL better when tasks are set before them, rather than just being taught.","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/news\/sql-zanimatelnye-zadachki","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47SQL. \u0417\u0430\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 | ProHoster","og:description":"\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439, \u0425\u0430\u0431\u0440! \u0412\u043e\u0442 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 3-\u0445 \u043b\u0435\u0442 \u044f \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u044e SQL \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0440\u0435\u043d\u0438\u043d\u0433 \u0446\u0435\u043d\u0442\u0440\u0430\u0445, \u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u043e\u0438\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 SQL \u043b\u0443\u0447\u0448\u0435, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0443, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.","og:url":"https:\/\/prohoster.info\/sq\/blog\/news\/sql-zanimatelnye-zadachki","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T19:13:01+00:00","article:modified_time":"2019-10-31T19:13:01+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"36671","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-22 04:21:19","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 01:40:23","updated":"2026-01-22 04:21:19","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/36671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=36671"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/36671\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/27465"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=36671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=36671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=36671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}