How To Select Some Rows from a Table?
Page 1 of 1
How To Select Some Rows from a Table?
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 WHERE department_name LIKE 'C%';
DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
------------- ------------------------------ ---------- -----------
130 Corporate Tax 1700
140 Control And Credit 1700
180 Construction 1700
190 Contracting 1700
......
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 WHERE department_name LIKE 'C%';
DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
------------- ------------------------------ ---------- -----------
130 Corporate Tax 1700
140 Control And Credit 1700
180 Construction 1700
190 Contracting 1700
......
Similar topics
» How To Select All Columns of All Rows from a Table?
» Can SELECT Statements Be Used on Views?
» How To Create a New Table by Selecting Rows from Another Table?
» How To Use SELECT Statement to Count the Number of Rows?
» How To Select Some Columns from a Table?
» Can SELECT Statements Be Used on Views?
» How To Create a New Table by Selecting Rows from Another Table?
» How To Use SELECT Statement to Count the Number of Rows?
» How To Select Some Columns from a Table?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Sun Jan 31, 2010 12:35 am by Micheal
» Accessing tables of other users in SQL
Sun Jan 31, 2010 12:34 am by Micheal
» Grouping commands in SQL
Sun Jan 31, 2010 12:32 am by Micheal
» Operations on Result Sets in SQL
Sun Jan 31, 2010 12:31 am by Micheal
» Subqueries in SQL
Sun Jan 31, 2010 12:30 am by Micheal
» Joining Relations in SQL
Sun Jan 31, 2010 12:28 am by Micheal
» Delete comand in SQL
Sun Jan 31, 2010 12:27 am by Micheal
» Update command in SQL
Sun Jan 31, 2010 12:26 am by Micheal
» Insert command in SQL
Sun Jan 31, 2010 12:23 am by Micheal