The SELECT statement is used for accessing the contents of a table. Queries for using the SELECT statement is given bellow.
SELECT * FROM table_name;
The above SELECT query is used for displaying all the content of the table. '*' indicates all content in that table.
Example:
SELECT * FROM Student;
For the customized content view of a table use the following SELECT query.
SELECT COLUMN_1, COLUMN_2........COLUMN_n FROM TABLE_NAME;
Example:
SELECT name, address FROM Student;
SELECT with WHERE clause
It is possible to access only a particular raw from a table using SELECT statement with the help of WHERE clause.
Syntax:
SELECT */COLUMN_NAMES FROM TABLE_NAME WHERE CONDITION;
Example:
From the Student table now i am going to access the details of 'prabeesh' only. I use the following query for it.
SELECT * FROM Student WHERE name='prabeesh';
It is also note that the table contents are also not case sensitive. Here the table contains two rows with name RESHMI and reshmi. Now i execute the following query.
SELECT * FROM Student WHERE Name = 'reshmi';
SELECT * FROM table_name;
The above SELECT query is used for displaying all the content of the table. '*' indicates all content in that table.
Example:
SELECT * FROM Student;
For the customized content view of a table use the following SELECT query.
SELECT COLUMN_1, COLUMN_2........COLUMN_n FROM TABLE_NAME;
Example:
SELECT name, address FROM Student;
SELECT with WHERE clause
It is possible to access only a particular raw from a table using SELECT statement with the help of WHERE clause.
Syntax:
SELECT */COLUMN_NAMES FROM TABLE_NAME WHERE CONDITION;
Example:
From the Student table now i am going to access the details of 'prabeesh' only. I use the following query for it.
SELECT * FROM Student WHERE name='prabeesh';
It is also note that the table contents are also not case sensitive. Here the table contains two rows with name RESHMI and reshmi. Now i execute the following query.
SELECT * FROM Student WHERE Name = 'reshmi';
Comments
Post a Comment