Geek Slack

Getting Started with SQL Server
    About Lesson


    SQL SELECT Statement


    SQL SELECT Statement

    The SELECT statement is used to retrieve data from a database. It allows you to specify which columns to retrieve and which rows to include, based on various conditions.

    Basic SELECT Statement:

    SELECT column1, column2
    FROM table_name;

    This query selects specific columns (column1 and column2) from a table (table_name).

    SELECT with WHERE Clause:

    SELECT *
    FROM customers
    WHERE country = 'USA';

    This query selects all columns from the “customers” table where the “country” column has the value ‘USA’.

    SELECT with ORDER BY Clause:

    SELECT *
    FROM products
    ORDER BY price DESC;

    This query selects all columns from the “products” table and orders the result by the “price” column in descending order.

    The SELECT statement can be customized with various clauses and functions to retrieve specific data from a database.