Basic Oracle Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
How To Select Some Rows from a Table in Oracle?
Answer:
If you don't want select all rows from a table, you can specify a WHERE clause to tell the query to return only the rows that meets the condition defined in the WHERE clause. The following select statement only returns rows that has department name starts with the letter "C":
SQL> SELECT * FROM departments
2 WHERE department_name LIKE 'C%';
<pre>DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
------------- -------------------- ---------- -----------
130 Corporate Tax 1700
140 Control And Credit 1700
180 Construction 1700
190 Contracting 1700
......</pre>
SQL> SELECT * FROM departments
2 WHERE department_name LIKE 'C%';
<pre>DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
------------- -------------------- ---------- -----------
130 Corporate Tax 1700
140 Control And Credit 1700
180 Construction 1700
190 Contracting 1700
......</pre>
Download Oracle Database Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Select Some Columns from a Table in Oracle? | How To Sort the Query Output in Oracle? |