SELECT * FROM teacher
--female teacher number, name
Select Tno,tname,gendar from teacher where gendar= ' woman '
--Han's female teacher number, name, ID number
Select Tno,tname,tid from teacher where gendar= ' women ' and tname like ' Korean '
--Salary between [10000,20000] teacher List
Select Sal,tname from teacher where Sal between 10000 and 20000
-Post for lecturer or development, sorted by salary in descending order
Select Tname,sal,job from teacher where job in (' Lecturer ', ' research and Development ')
ORDER BY Sal Desc
--INSERT statement for all data in the department
SELECT * FROM Dept
--oracle Use | | To concatenate strings
INSERT INTO Dept values (40, ' Ministry of Manpower ', ' Beijing Haidian ')
--How to query
Select ' INSERT INTO dept values (' | | deptno| | ', ' ' | | dname| | "' | | ', ' | | loc| | ');
From dept;
SELECT * FROM teacher
--Name of all male teachers in admissions department
--Using subqueries
Select Tname,gendar,deptno
From teacher
where deptno= (select Deptno from dept where dname= ' Admissions Department ')
and gendar= ' man '
--Using Inner connection 01
Select Tname,gendar,d.deptno,dname
From teacher T,dept D
where T.deptno=d.deptno
and gendar= ' Male ' and dname= ' admissions Department '
--Using inner connection 02
Select Tname,gendar,d.deptno,dname
From teacher T INNER join dept D
On T.deptno=d.deptno
where gendar= ' male ' and dname= ' admissions Department '
--All teachers ' names, departments
Select Tname,dname
From teacher T,dept D
where T.deptno=d.deptno
--The names of all teachers and the names of their mentors are self-connected
Select T1.tname,t2.tname as tutor name from teacher T1,teacher T2
where T2.tno=t1.mgrno
--All teachers ' names, departments, mentors
Select T.tname as teacher name, T1.tname as tutor name, D.dname as Department
From teacher T left join teacher T1
On T.mgrno=t1.tno
Left JOIN Dept D
On T.deptno=d.deptno
--List all names and dates of birth
Select Tname,birthdate from teacher
Oracle Basic Queries