SQL Select

SQL Select command is used to show columns and rows from tables.

SYNTAX:
SELECT * FROM NAMEOFTABLE;

EXAMPLE:
SELECT * FROM ITEMS

DESCRIPTION:
SELECT command can be used in many ways. One of the ways is to see all the columns of a table with all the data in it. “Select * from nameoftable” command is used to show all the data inside tables. Esteric(*) is for showing all columns inside a table

select columns 

SELECT Command can also be used to see only specific columns from a table. For example, lets say our table name is items and inside table there are many columns but we only want to see ItemID, ItemName columns. In that case the SQL Query will be

SYNTAX:
SELECT COLUMN1, COLUMN2 FROM NAMEOFTABLE

EXAMPLE:
Select ItemID, ItemName from items

select distinct

Select command can also be used to select unique records from table. To select the unique records from table the keyword is distinct. For example, if we want to select only unique categories name from our table items the SQL command will be

Select distinct ItemCat from items
Select distinct ItemCat, count(*)'Total' from items group by ItemCat

Create Copy 0f table

It is possible to create a copy of a table using the following select statement:

Syntax:
Select * into NewTableName from TableName