Task 5 – SQL WHERE Clause

Actuary Forums Forums Learnings Softwares SQL Course Task 5 – SQL WHERE Clause

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #22712
    Mayank Goyal
    Keymaster

      The SQL WHERE ClauseThe WHERE clause is used to filter records.The WHERE clause is used to extract only those records that fulfill a specified condition.WHERE Syntax

      Code:

      SELECT [i]column1[/i],[i] column2, …[/i]
      FROM [i]table_name[/i]
      WHERE [i]condition[/i];


      WHERE Clause ExampleThe following SQL statement selects all the customers from the country “Mexico”, in the “Customers” table:Example

      Code:

      SELECT * FROM Customers
      WHERE Country=’Mexico’;


      Try it Yourself »


      [hr]
      Text Fields vs. Numeric FieldsSQL requires single quotes around text values (most database systems will also allow double quotes).

      However, numeric fields should not be enclosed in quotes: Example

      Code:

      SELECT * FROM Customers
      WHERE CustomerID=1;


      Try it Yourself »


      [hr]
      Operators in The WHERE Clause

      The following operators can be used in the WHERE clause: 

      [attachment=0]sql operators.png[/attachment]

      Note: Use Demo database as of the previous Task

    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.

    Actuary Forums Forums Learnings Softwares SQL Course Task 5 – SQL WHERE Clause