The table shows the length of service of all employees by year, month and day The table is the origi

Updated on society 2024-04-01
7 answers
  1. Anonymous users2024-02-07

    As of the current date.

    select emp.*,to_char(trunc(months_between(sysdate,hiredate)/12))|'years'||

    to_char(trunc(months_between(sysdate,hiredate)-trunc(months_between

    sysdate,hiredate)/12)*12))|'months'||

    to_char(round((months_between(sysdate,hiredate)-trunc(months_between

    sysdate,hiredate)/12)*12-

    trunc(months_between(sysdate,hiredate)-trunc(months_between(sysdate,hiredate)/12)*12))

    last_day(add_months(sysdate,-1))-add_months(sysdate,-1)))'days'Years of service.

    from emp;

  2. Anonymous users2024-02-06

    Time is limited, so I'll help you write a few first.

    2.List the name, number, and department number of all clerksSelect empno, ename, deptno from emp

    where job = "clerk";

    3.Find out who has a higher commission than their salary.

    select ename from empwhere comm>sal;

    4.Find out employees whose commissions are higher than 60% of their salary.

    select ename from empwhere comm>sal*;

    5.Find out the details of all managers in department 10 and all clerks in department 20.

    select * from emp

    where deptno = 10 and job = "manager" or deptno = 20 and job = "clerk";

    No, you can tell me, and I'll change it.

  3. Anonymous users2024-02-05

    What format you have stored in the database is what format comes out, and if you need to convert the format, convert it in the program.

  4. Anonymous users2024-02-04

    It's so complicated and don't give points, who will help you.

  5. Anonymous users2024-02-03

    There's definitely something wrong with you.

    Here's a way for you.

    You can calculate how many integer months you've worked on so far, divide that number by 12, and get the remaining months of the year following this principle.

    For example, if I joined the company on January 31, 2000, it will be 11 years if it is March 28, 2011.

    The 28th in March is smaller than the 31st in January, so it can't be directly 2 integer months, but it will be treated as 1 month, and the remaining days will not be difficult.

  6. Anonymous users2024-02-02

    There is nothing wrong with the syntax, but assuming 365 days per year, 30 days per month, there will be some errors.

  7. Anonymous users2024-02-01

    It's as simple as subtracting the start date from the current date to display the number of days, as follows:

    select empno,ename,sysdate-hiredate from emp;

    If you want to display the year, month, and day, you have to perform a series of function conversions, as follows:

    select empno,ename,to_char(floor(to_number((sysdate-hiredate)/365)))' years '||

    to_char(ceil(months_between(sysdate,hiredate)-(floor(to_number((sysdate-hiredate)/365)))12))|' months '

    from emp

    The above sql will show the number of years and months of the work period, I don't think it is necessary to show the number of days anymore, because the number of days in each month is also inconsistent.

Related questions
4 answers2024-04-01

1. What is "learn before you teach"?

The so-called "learning first" means that in the classroom, students read books, study on their own, and practice according to the teaching objectives and pre-school guidance revealed by the teacher. The so-called "post-teaching" means that in response to the problems exposed in students' self-study and the mistakes in practice, teachers guide students to discuss, teach students, and students who can teach students who can't, and teachers only evaluate, supplement, and correct. In the multi-directional interaction between students, teachers and students, texts and teachers, and texts and students, learn new knowledge and consolidate knowledge growth points. >>>More

6 answers2024-04-01

1.In ancient times (about 5,000 years ago), Jews lived in what is now Israel. Later, he wandered around the world. >>>More

3 answers2024-04-01

<> even numbers within 100.

An even number is an integer that is divisible by 2. Positive even numbers are also called even numbers. If a number is a multiple of 2, it is an even number and can be expressed as 2n; If not, it is an odd number, which can be expressed as 2n+1 (n is an integer), that is, the remainder of the odd number divided by two is one. >>>More

27 answers2024-04-01

It's completely achievable. At James' current level. He's still at his prime. >>>More

20 answers2024-04-01

Ethereum Classic is an abandoned coin, and later due to a large number of coin theft incidents, the team abandoned the coin to make the current Ethereum, and Ethereum Classic was continued to operate by another team. The earliest online platforms in China are Bitcoin Trading Network and Jubi Network. The bigwigs in the currency circle generally don't like this coin very much, mainly because it belongs to the currency of small scattering.