How to Use SQL SELECT Statement – Programming, Pseudocode Example, C# Programming Example
SQL

How to Use SQL SELECT Statement

SQL Code:

The SELECT statement is used to select data from a database. We will call the set of result as SQL result-set.

In the first selection statement of the query user can specify the columns to select from the table. This selection statement is used when we need to select the columns in particular order or want to select only some particular columns of table.

SELECT * FROM Table_Name – This will give all the columns in the table in particular order in which table designed. Normally when we query the table developers mostly use the this type of selection query.

SELECT TOP 10 FROM Table_Name – This query will give the result of 10 rows in the result-set. After top we can specify the number of rows needs to select from the table. This top select statement is mostly used to limit the number of rows selection.

SQL SELECT Examples

 Example 1:  List all the records in the student chart

Example 2: List the gender Female (F) records in the student table

Example 3: List the names, surnames and classes of the students in the class 10Math or 10Sci in the student table

Example 4: List the book names and pages count with number of pages between 50 and 200 in the book table

Example 5: List the names surnames classes and genders of males in 9Math or females in 9His in the student table

Example 6: List the males whose classes are 10Math or 10Bio

For more SQL SELECT Examples click here!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.