Instructions About Writing SQL Statements in SQL Server

Introduction: Instructions About Writing SQL Statements in SQL Server

The following instructions give step by step directions for how to walk you through writing basic SQL Statements in SQL Server. SQL Statements are used to work with databases whether it be retrieving or manipulating data. In order to retrieve and manipulate data you must learn how to get your hands dirty and understand how to write simple queries on the server. This simple instruction set aims to assist students or beginners for this tutorial and should take around ten minutes to complete.

Supplies

We will be focusing on 4 primary areas for this tutorial: SELECT, WHERE, AND and ORDER BY commands. Each command is used to retrieve, add, modify or remove information from a table.

Step 1: Search

Search for Microsoft SQL Server Management Studio 18 in the windows search tab and click on it

Step 2: Login

Login with your correct Server credentials

Step 3: New Query

Now click on New Query in the upper left hand corner (see picture)

Step 4: SELECT Statement

Type “Select * From ‘Table_name’”, as shown in the picture, This statement is a syntax example of how to write a SELECT statement to select data from a database

Step 5: WHERE Statement

Type “Select * From ‘Table_Name’ Where ‘Condition’”, this creates the WHERE clause, which is used to filter records and used to extract records that fulfill a specified condition

Step 6: AND Statement

Type “Select * From ‘Table_Name’ Where ‘Condition’ and ‘condition’ and ‘condition’...” to combine the WHERE clause with the AND operator. It displays a record if all the conditions separated by AND are true.

Step 7: ORDER BY Statement

The ORDER BY keyword is used to sort the result-set in ascending or descending order

Step 8: Execute the Query

Press the execute button to run the query and execute the table

Step 9: Conclusion

Congratulations! You have now learned how to basic SQL Statements in SQL Server

This is how is an example of how the table should look like when running the query and executing the table

This instruction set has provided step by step guidance for writing basic SQL Statements in SQL Server. Enjoy the Querying!

Be the First to Share

    Recommendations

    • Lamps and Lighting Contest

      Lamps and Lighting Contest
    • Halloween Contest

      Halloween Contest
    • Organization Contest

      Organization Contest

    Comments

    0
    Elaina M
    Elaina M

    1 year ago

    Thanks for sharing this tutorial - congrats on your first post :)