Simple query of a single Oracle table
View the table structure desc emp; query all columns Select * from emp; find the Department number (query the specified column) select deptnofrom emp; find the Department numbers with different numbers (deduplication) selectdistinct deptnofrom emp; find the employee position with the ename SMITH, salary, Department number select job, sal, deptnofrom emp t where t. ename = 'Smith '; find the employee's annual salary NVL (string1, replace_with) function: If string1 is NULL, The NVL function returns the value of replace_with, otherwise, the string1 value SELECT sal * 12 + nvl (comm, 0) * 12as salsun, ename, sal, comm from emp is returned.
The alias application select salas "salary" from emp queries the salaries of employees with a salary greater than 1000 select salas "salary" from empwhere sal> 1000 searches for the employees who have joined the company after 1982.1.1 select ename, hiredatefrom empwhere hiredate> '1-September 11-1982 ': select ename, salfrom empwhere sal> = 2000and sal for employees with salaries ranging from 2000 to 3000 <= 3000; fuzzy query like, %, _ select ename, salfrom emp t where t. enamelike '% S %'; select ename, salfrom emp t where t. enamelike '_ O %'; in uses select sal, enamefrom emp twhere t. salin () is null using select * from empwhere mgrisnull;