Simple query of a single Oracle table

Source: Internet
Author: User

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;

 


Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.