Example:
1) Find employee information with a salary above 3000
SELECT *
Froms_emp E
where e.salary>3000;
2) Find all information about employees who are known as Carmen
SELECT * FROM S_emp E
Wheree.first_name = ' Carmen ';
"Oracle SQL keywords, table names, column names, etc. are case insensitive, and the values in the records are case sensitive"
3) Find out the employee information without performance
SELECT * FROM S_emp E
Where e.commission_pct is not null;
4) Find out the employee's name, department number and salary at 1200-3000.
Selecte.first_name,e.dept_id,e.salary
Froms_emp E
Wheree.salary>=1200 and e.salary<=3000;
Selecte.first_name, E.dept_id,e.salary
Froms_emp E
Wheree.salary between and 3000;
Wildcard characters% and _
% : Represents any number of characters
_ : represents any one character
1) Find information about employees whose names contain letters ' a '
SELECT * FROM S_emp E
where e.first_name like '%a% '
2) Check out the name of the employee whose first letter is ' S ' in the employee's name
SELECT * FROM S_emp E
Wheree.first_namelike ' s% '
3) Find information about employees whose names contain ' a ' and ' F '
SELECT * FROM S_emp E
Wheree.first_name like '%a% ' and e.first_name like '%f% ';
4) Check out the employee's name with the third-last letter ' I ' information
SELECT * FROM S_emp E
Wheree.first_name like '%i__ '
5) Check out the names, department numbers and positions of all employees in 31, 41 departments
Selecte.first_name,e.dept_id,e.title from S_emp E
wheree.dept_id = or e.dept_id = 41;
Selecte.first_name,e.dept_id,e.title from S_emp E
where e.dept_id in (31,41);
"In (31,41) equivalent: dept_id=31 or dept_id=41"
6) Find employees who are neither sales nor clerks
SELECT * FROM S_emp
where title! = ' Sales representative ' and title! = ' Stock clerk ';
SELECT * FROM S_emp
Where title isn't in (' Sales representative ', ' Stock clerk ');
"Not in (' Sales representative ', ' Stock clerk ') equals"
Title! = ' Sales representative ' and title! = ' Stock clerk '
- "Dual table: Virtual tables in Oracle to ensure complete SQL statements. "
"Get the value of 4+30"
Select (4+30) from dual;
"Get Current system Time"
Select sysdate from dual;
"Get ' hello '"
Select ' Hello ' from dual;
Oracle Conditional Query Fuzzy query