Sql Tutorial Class


Sql Select

Sql Select 


The SQL Select statement is used to display the data / records in the database. The user has saved the data in the SQL Server table. After saving the records in the table, the user extracts the required record from the table. For this proposal, the user must use the SQL Select statement. Without the SQL Select statement, the user cannot extract or display records from the specified sql table. The registry on the SQL server is invisible, which means that it is not visible as Excel. SQL has the record saved but not visible. To show the table record, the user must give the command to SQL Server. To start the SQL command, the user must start the SQL Select command.


Sql Select command syntax:
 Select */COLUMN_NAME,COLUMN_NAME1,COLUMN_NAME2,COLUMN_NAME3,.... From 
TABLE_NAME 

[Note: Create table Click here for complete details.  ]

Description:
          Select: Select is Sql Server command. It is used to display                             the record(s) from Sql Server Table. 
          *: It indicate the n number of column of the table. Like                          Name,  Address, Phone so on.
          TABLE_NAME: It is a name of table where use want to get                                        data. Like ItemDetails, StudentDetails,                                             Employee




Example:

Create table ItemDetails
(
ItemId int NOT NULL,
Name Varchar(30)NOT NULL,
Quantity int NOT NULL,
Price float NOT NULL,
Category varchar(30)NOT NULL,
Country varchar(20)NOT NULL,
Remarks Varchar(250)NULL
)



Insert into ItemDetails Values('1','Dell Desktop Computer','10','540','Computer','Japan',NULL)
Insert into ItemDetails Values('2','Dell Server','5','500','Computer','USA',NULL)
insert into ItemDetails Values('3','Acer Desktop Computer','50','200','Computer','Korea',NULL)
Insert into ItemDetails Values('4','Acer Laptop','20','250','Computer','Korea',NULL)
Insert into ItemDetails Values('5','Dell Laptop','300','150','Computer','USA',NULL)
Insert into ItemDetails Values('6','Apple Mac Book','40','600','Computer','USA',NULL)
insert into ItemDetails Values('7','Samsung Laptop','20','200','Computer','USA',NULL)
Insert into ItemDetails Values('8','MSI Desktop Computer','40','200','Computer','China',NULL)
Insert into ItemDetails Values('9','MSI Laptop','15','250','Computer','China',NULL)
Insert into ItemDetails Values('10','Toshiba','5','200','Computer','USA',NULL)


SQL Select Command Example:
Select * from ItemDetails
Select ItemId from ItemDetails
select Name From ItemDetails
Select ItemId, Name from ItemDetails
Select ItemId,Quantity,Price from ItemDetails
Select Name, Quantity,Category from ItemDetails




Sql Select in Image
Sql Select Command

No comments:

Post a Comment