1 / 12

Oracle Academy

Oracle Academy. Prof. Carmen Popescu Oracle Academy Lead Adjunct. Forma generala a comenzii SELECT. SELECT expresii FROM tabele WHERE conditii In clauza select pot aparea coloane, sau expresii Ordinea operatorilor: * / + - Operatorii logici: AND, OR (in aceasta ordine). BETWEEN.

norris
Download Presentation

Oracle Academy

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Oracle Academy Prof. Carmen Popescu Oracle Academy Lead Adjunct

  2. Forma generala a comenzii SELECT SELECT expresii FROM tabele WHERE conditii In clauza select pot aparea coloane, sau expresii Ordinea operatorilor: * / + - Operatorii logici: AND, OR (in aceasta ordine)

  3. BETWEEN SELECT * from employees WHERE department_id BETWEEN 10 AND 30  SELECT * from employees WHERE department_id >=10 AND department_id<=30 Departamentul 20 ESTE afisat

  4. IN SELECT * from employees WHERE department_id IN (10,30)  SELECT * from employees WHERE department_id=10 OR department_id=30 Departamentul 20 NU ESTE afisat

  5. NULL 5+NULL => NULL • La ordonare crescatoare valorile NULL sunt puse la sfarsit • La ordonare descrescatoare NULL apare la inceput

  6. ALIAS DE COLOANA (AS) SELECT salary+0.25*salary FROM employees SELECT salary+0.25*salary AS ”New Salary” FROM employees SELECT salary+0.25*salary AS New Salary FROM employees => EROARE

  7. ALIAS DE COLOANA (AS) SELECT first_name||’ ’||last_name AS Numele FROM employees SELECT first_name||’ ’||last_name AS ”Numele” FROM employees

  8. ALIAS DE COLOANA (AS) Ghilimelele la alias sunt obligatorii cand: • Aliasul e compus din doua sau mai multe cuvinte • Dorim ca aliasul sa fie scriscu litere mici

  9. DESCRIBE

  10. LIKE SELECT * from employees WHERE first_name LIKE ’%a%’ • afiseaza toate persoanele cu un ’a’ oriunde in prenume SELECT * from employees WHERE first_name LIKE ’_ _a%’ • afiseaza persoanele cu un a pe a treia pozitie din nume % - oricate caractere (inclusiv nici unul) _ - un singur caracter

  11. LIKE SELECT * from employees WHERE job_title LIKE ’%\_ _ _’ ESCAPE ’\’ • afiseaza persoanele pt. care in job_title, dupa caracterul _ mai exista exact doua caractere • Cu clauza ESCAPE am precizat ca% sau _ precedate de \ vor fi tratate ca si caractere normale ce trebuie sa apara in text nu ca wildchar.

  12. ORDER BY SELECT * FROM employees ORDER BY last_name ASC, salary DESC SELECT first_name,salary, department_id FROM employees ORDER BY 2 Se sorteaza dupa a doua expresie din clauza SELECT, adica dupa salary

More Related