Basic select statement syntax
SELECT Column_List
FROM Table_Name
If you want to select all the columns, you can also use *. For better performance use the column list, instead of using *.
SELECT *
FROM Table_Name
[フレーム]
To Select distinct rows use DISTINCT keyword
SELECT DISTINCT Column_List
FROM Table_Name
Example: Select distinct city from tblPerson
Filtering rows with WHERE clause
SELECT Column_List
FROM Table_Name
WHERE Filter_Condition
Example: Select Name, Email from tblPerson where City = 'London'
Note: Text values, should be present in single quotes, but not required for numeric values.
Different operators that can be used in a where clause
SELECT Column_List
FROM Table_Name
If you want to select all the columns, you can also use *. For better performance use the column list, instead of using *.
SELECT *
FROM Table_Name
[フレーム]
To Select distinct rows use DISTINCT keyword
SELECT DISTINCT Column_List
FROM Table_Name
Example: Select distinct city from tblPerson
Filtering rows with WHERE clause
SELECT Column_List
FROM Table_Name
WHERE Filter_Condition
Example: Select Name, Email from tblPerson where City = 'London'
Note: Text values, should be present in single quotes, but not required for numeric values.
Different operators that can be used in a where clause
10 comments:
how using columnlist would be faster than using * in the select query
Reply Delete1.* reteives all columns even though some of the columns are not requred,it causes performance degadation,time consuming.
Delete2. In future if we want to change any column alias names while retriving, it is difficult. in that time we must specify thespecified columns.
Thank you Mr. Venkat for providing all your tutorials. Now I have a better understanding of SQL.
Reply Deletehow to fetch values row wise instead of column wise suppose i have 23 colums i want 1st column's each cell value separately on webpage with single statement
Reply DeleteSelect first field only, remove other fields from the select select statement
DeleteThank you Mr. Venkat for this tutorials touching very deeb in a very simple clear way.
Reply DeleteThank you so much such phenomenal job ,i never seen better blog on .net
Reply Deletelike C#,SQL....
Thank you soo much. Your videos and explanations are so amazing that i am able to implement the logics with other rdbms.
Reply DeleteThank you again.
this video is created in 2012 and still the best tutorial I can find
Reply DeleteWatching in 2022 and still the best
Reply DeleteIt would be great if you can help share these free resources
[フレーム]