Tags: des style io ar sp for on Art BSCheck the salary of each department in 25%, 50%, 75% position,Percent_rank () is the relative position in the ranking .CREATE TABLE EMP(EMPNO Number (4) is not NULL,Ename VARCHAR2 (10),JOB VARCHAR2 (9),MGR Number (4),HireDate DATE,SAL number (7,2),COMM number (7,2),DEPTNO Number (2));INSERT INTO EMP (EMPNO, ename, JOB, MGR, HireDate, SAL, COMM, DEPTNO)VALUES (7369, ' SMITH ', ' clerk ', 7902, to_date (' 17-12-1980 ', ' dd-mm-yyyy '), 800.00, NULL, 20);INSERT
Original works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the following sources, otherwise, the legal responsibility to pursue copyright.Deep Blue Blog:http://blog.csdn.net/huangyanlong/article/details/41347109 Wm_concat function: Field merge functionTarget: Implement some other field merge according to the same value of a fieldExperimentalUsing the EMP table under the experiment Scott UserSql> select * from EMP;--Take a look at the full contents of the EMP table
Create a memento employee personal information: --Create a tableCreate TablePlspl_company_info (empno Number(5) not NULL, enamevarchar2(Ten) not NULL, Jobvarchar2(Ten), manager Number(5), HireDate date, Sal Number(5), Comm Number(5), Deptno Number(3) ); Insert intoPlspl_company_infoValues(7369,'SMITH','Clerk',7902, date'1980-12-17', -,NULL,Ten);Insert intoPlspl_company_infoValues(7293,'ALLEN','salesman',7689, date'1981-03-2
Label:Add or subtract a number on a date the result is still a date. Two date subtraction returns the number of days between dates. You can add or subtract hours from the date with the number except 24来.1Sql> SelectSysdate, Sysdate+2 fromdual;2 3Sysdate sysdate+24 ----------- -----------5 the- A- at the- A- -6 7Sql> SelectHiredate,sysdate-HireDate fromEMP;8 9HireDate Sysdate-HireDateTen ----------- ---------------- One 1980- A- - 12424.8094328704 A
In the development of the report, it is unavoidable to encounter the problem of row to column.For example, in the case of Scott's EMP in Oracle, you can use "Row to column" to count the number of people in each position in each department:The original data for Scott's EMP are:
EMPNO
Ename
JOB
MGR
HireDate
SAL
COMM
DEPTNO
7369
SMITH
Clerk
7902
12/17/1980
800.00
20
7499
In the development of the report, it is unavoidable to encounter the problem of row to column.For example, in the case of Scott's EMP in Oracle, you can use "Row to column" to count the number of people in each position in each department:The original data for Scott's EMP are:
EMPNO
Ename
JOB
MGR
HireDate
SAL
COMM
DEPTNO
7369
SMITH
Clerk
7902
12/17/1980
800.00
20
7499
1. Installing FILE_FDWNeed to install FILE_FDW, usually into the PostgreSQL source package in the CONTRIB/FILE_FDW directory, execute:makemake installThen go into the database and execute the following SQL to install the FILE_FDW:CREATE EXTENSION file_fdw;CREATE SERVER file_fdw_server FOREIGN DATA WRAPPER file_fdw;2. Create an external tableTake the common EMP table as an example;Create foreign table EMP(empno integer NOT NULL,ename VARCHAR (Ten),Job VARCHAR (9),Mgr Integer,hiredate DATE,Sal NUM
Tags: Create value ima display test sid ted. com xxxSimilar to Oracle's RowNumber () over (partition by xxx order by xxx ) statement, which is: sorting tables after grouping Creating a Test EMP table DROP TABLE IF EXISTS emp; CREATE TABLE emp (empno decimal (4,0) NOT NULL, ename varchar (TEN) default NULL, Job varchar (9) default NULL, Mgr D Ecimal (4,0) default NULL, HireDate datetime default NULL, sal decimal (7,2) default NULL, Comm Decimal (7,2) Default N
ULL, Deptno decimal (2,0) default
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.