T-SQL SELECT STATEMENTIn T-SQL, the SELECT statement is used to fetch the data from the database table that returns the data in form of the result. These tables are called result-set in SELECT STATEMENT. Syntax of Select Statement:Where column1, column2, column N are the fields of a table whose values we want to fetch. If we fetch all the fields available in this table, then we need to use the given syntax- Example:Consider the customer's table having the following records-
Following command is an example, which will fetch ID, Name and Salary fields of the customers available in CUSTOMERS table- The above command will produce the following output.
Example 2:In this example we SELECT only NAME, AGE, and ADDRESS from the database CUSTOMERS. Output:
Example 3:OUTPUT:
Populate One Table using the other oneWe can populate data into a table through SELECT statement over another table. Another table has a set of fields, which is required to populate the first table. The syntax of SELECT Statement is- Next TopicT-SQL Update Statement |