***Welcome to ashrafedu.blogspot.com * * * This website is maintained by ASHRAF***

Posts

    Tuesday, 17 December 2019

    SQL where clause

    SQL where clause:

    The SQL WHERE clause is used to specify a condition while fetching the data from a single table or by joining with multiple tables. If the given condition is satisfied, then only it returns a specific value from the table. The WHERE clause is used to filter records.
    The WHERE clause can be used in the SELECT statement, the UPDATE, DELETE statement, etc.,. A condition can be specified using the comparison or logical operators

    The basic syntax of the SELECT statement with the WHERE clause is as shown below.
    SELECT column1, column2, columnN
    FROM table_name
    WHERE [condition];
    Example:
    Consider the CUSTOMERS table having the following records 













    To fetch ID, Name and Salary fields from the CUSTOMERS table, where the salary is greater than 2000 the query is:
    SQL> SELECT ID, NAME, SALARY FROM CUSTOMERS WHERE SALARY > 2000;
    Output:










    No comments:

    Post a Comment