SQL SELECT QUERY - The Coding Shala
Home >> Learn SQL >> SQL SELECT Query
Now if we want to fetch only 'PersonID' and 'FirstName' then we use -
Other Posts You May Like
Please leave a comment below if you like this post or found some error, it will help me to improve my content.
SQL SELECT QUERY
SQL 'SELECT' statement is used to fetch data from the database table. Using 'SELECT' Statement we can fetch the whole table or some columns that we want.
SQL SELECT Syntax
The basic syntax of the SELECT statement is as follows -
SELECT column1, column2, columnN FROM table_name;
This Query will fetch only particular columns that are mentioned. If we want to fetch all the columns then use '*' instead of columns name.
SELECT * FROM table_name;
SQL SELECT Query Examples -
The following query will fetch all the data from the 'Persons' Table -
SQL >> select * from Persons Output >> PersonID LastName FirstName Address City 1 Saini Akshay A-101 Pune 1 last first A-101 Pune 2 null Akshay null null
Now if we want to fetch only 'PersonID' and 'FirstName' then we use -
SQL >> select PersonID, FirstName from Personsselect * from Persons Output >> PersonID FirstName 1 Akshay 1 first 2 Akshay
Other Posts You May Like
Prev<< SQL INSERT Query NEXT >>SQL Where Clause
Comments
Post a Comment