Oracle_ Basic function Query synthesis

Source: Internet
Author: User
Tags sorted by name

oracle_ basic function Query synthesis
--"1" Check out all employees employed on the third day of each monthSelect * from emp where hiredate = last_day(hiredate)-2 ; --"2" to identify employees employed before 30Select * from emp where (sysdate - hiredate)/ 365>; select *   from where months_between ( sysdate,hiredate )/12&NBSP; >30 ; Select * from emp where to_char(sysdate,' yyyy ') - To_char(hiredate,' yyyy ') >;  --"3" displays the names of all employees in uppercase lettersSelect initcap(ename) from emp;  --"4" shows the names of employees without ' R 'Select ename from emp; Select ename from emp where ename does like '%r% ';  --"5" displays the name of an employee who is exactly 5 charactersSelect ename from emp where length(ename) = 5;  --"6" displays the first three characters of all employee namesSelect substr(ename,1,3) from emp;  --"7" displays the names of all employees and replaces all ' a ' with ' a 'Select replace(ename,' A ',' a ') from emp;  --"8" shows the name and date of employment of employees who have been in service for over 10 yearsSelect ename, hiredate from emp where months_between(sysdate, hiredate) />;  --"9" displays employee details, sorted by nameSelect * from emp order by ename;  --"10" shows the employee's name and the date of employment, according to their service life, the oldest employees in the front rowSelect ename, hiredate from emp order by (sysdate -< /c8> hiredate) desc;  --"11" Displays the names of all employees, the year and month of incorporation, sorted by the month of the employment date, and the first year of employees in the same monthSelectename, to_char(hiredate,' yyyy ') As Year, to_char(hiredate,' MM ') As Month FromEMPOrder By Month,hiredate;    --"12" shows the names of all employees, work, salary, sorted by job, if same work, by salarySelect ename, job, Sal from the EMP order by job, Sal;  --"13" Find all employees employed in February (in any year)Select * from emp where to_char(hiredate,' mm ') = 2;  --"14" for each employee, showing the number of days they joined the companySelect empno, round(to_char(sysdate - hiredate)) from emp;  --"15" displays the names of all employees with ' A ' at any location in the Name fieldSelect ename from emp where ename like '%a% ';

Oracle_ Basic function Query synthesis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.