Database Reference
In-Depth Information
The same SELECT statement is used to get multiple columns from a table. But in this case,
multiple column names must be written after the SELECT keyword, and each column must
be separated by a comma.
Syntax:
SELECT columnname1, columnname2,………. columnnameN FROM tablename;
Retrieving All Columns
SELECT statements can also be used to see data of all columns. This is done
using the asterisk (*) wildcard character, which means all column in the table.
Syntax:
SELECT * FROM tablename;
Example: Show all records of Staff Tbale.
SELECT * FROM Staff;
Filtering Table Data
It is rare that all the records or data from the table will be required. Database tables usually
contain large amounts of data. Retrieving the data as per user requirement involves specify-
ing search criteria, known as a filter condition. To methods of filtering data will be like:
Select rows and all columns of the table(s)
Select few columns and all rows
Select few rows and few columns
Use of WHERE Clause
Data can be filtered by mentioning search criteria in the WHERE clause. The WHERE
clause is written right after the table name. RDBMS shows only those records that meet the
specific condition.
Syntax:
SELECT column1,………… columnN FROM tablename
WHERE search condition;
Example: Retrieve Product_ID, Product_Name from table product_info where the
Cost_price is greater than 500.
Sol:
SELECT Product_ID, Product_Name FROM product_info WHERE Cost_price > 500;
WHERE Clause Operators
Following conditional operators can be used with WHERE Clause
Search WWH ::




Custom Search