How to Write Basic Sql Statements in Sql Server
Click on Start --> All Programs --> Microsoft SQL Server (2005/2008) --> SQL Server Management Studio; ,Next Login with your credentials to the Server ,Now right click on the Northwind Database and choose New Query ,In the new Query Window, enter...
Step-by-Step Guide
-
Step 1: Click on Start --> All Programs --> Microsoft SQL Server (2005/2008) --> SQL Server Management Studio;
In the even you wish to enter multiple rows at one go, you see the following command INSERT INTO Employees values('Anna'
'[email protected]'), INSERT INTO Employees values('Krystel'
'[email protected]'), INSERT INTO Employees values('Lines'
'[email protected]').
The key difference here is that every value is appended by a comma ,,,,, -
Step 2: Next Login with your credentials to the Server
-
Step 3: Now right click on the Northwind Database and choose New Query
-
Step 4: In the new Query Window
-
Step 5: enter the following command for SELECT
-
Step 6: This is the syntax for SELECT - SELECT * FROM Employees
-
Step 7: This is the syntax for INSERT - INSERT INTO Employees VALUES('col1'
-
Step 8: 'col2') - Replace col1 and col2 with actual Values as shown below INSERT INTO Employees values('Anil'
-
Step 9: '[email protected]') This inserts a single row into the table.
-
Step 10: This is the syntax for UPDATE - UPDATE Employees SET col1 = 'new value' WHERE col1 = 'old value' - Replace col1 with actual Values as shown below
-
Step 11: UPDATE Employees SET Name = 'Anil Mahadev' WHERE Name = 'Anil'
-
Step 12: This is the syntax for DELETE - DELETE FROM Employees WHERE col1 = 'value' WHERE value = 'actual data row' - Replace actual data row with actual Values as shown below
-
Step 13: DELETE FROM Employees WHERE Name = 'Anil Mahadev'
-
Step 14: This completes this short How-To
-
Step 15: I hope this has been beneficial to you and like to Thank You for viewing it.
Detailed Guide
In the even you wish to enter multiple rows at one go, you see the following command INSERT INTO Employees values('Anna'
'[email protected]'), INSERT INTO Employees values('Krystel'
'[email protected]'), INSERT INTO Employees values('Lines'
'[email protected]').
The key difference here is that every value is appended by a comma ,,,,,
About the Author
Nancy Gomez
Enthusiastic about teaching hobbies techniques through clear, step-by-step guides.
Rate This Guide
How helpful was this guide? Click to rate: