Current location - Education and Training Encyclopedia - Education and training - Oracle Bone Inscriptions interview questions
Oracle Bone Inscriptions interview questions
3.select ename,(select ename from EMP where empno in(a . mgr))from EMP a;

The whole query is divided into sub-query and parent query, (Select Enam from emp where empNOIN (a.mgr)) is a sub-query, emp a refers to the employee table, and A specifies the alias of EMP table for this query, so I know A.

It is easy to understand what a.mgr stands for. A.mgr is actually emp.mgr, which means the mgr (superior number) field in the emp employee table. Emp table records the information of employees and their superiors, and a.mgr is used to represent employees.

The number of the superior, and then output the employee name and his superior name.

6. Although dname and ename are in two different tables, the information in the two tables is related by the statement where deptno in(a.deptno), so that the name of the employee and the name of the department to which the employee belongs can be obtained.

14.a.deptno and b.deptno respectively represent the department number field in the department table and the department number field in the employee table. Their function is to associate the information in the independent department table and the employee table, so as to merge the information in the two tables.

One-to-one correspondence, emp b is used to output the ename, sal fields, and B is the alias of emp table in the query, which can be named arbitrarily, because the name A has been given to dept table, and if another emp table is given, it will cause

The database can't identify whether A stands for dept table or emp table, so it's named B instead of A..

16.group by has a classification function. Here, it means that the installed job types divide the query results into several categories, each category contains many different salaries, and then the min function is used to select the lowest salary from them. When it is necessary to check the job,

When aggregating query results, you can use a group by statement followed by all fields except the aggregation function, such as the job field here.