WHERE


InterServer Web Hosting and VPS
Sony Playstation PS4 Pro Custom Build NVMe SSD Drive - Enclosure case and Crucial NVMe SSD
PS4 Pro Custom External SSD NVMe Drive

How I built a PS4 Pro Custom External SSD NVMe Drive...

NUC8i7BEH with memory
Intel NUC8I7BEH Review and Custom Build

This is my review of the Intel NUC8i7BEH and a summary of my build...

Card image cap
Asus M5A88-M EVO Review

This is my review of the Asus M5A88-M EVO motherboard...

Corsair Vengeance Blue 8GB (2x4GB) DDR3 PC3-12800C9 1600MHz Dual Channel Kit
Corsair Vengeance Blue Review

This is my review of the Corsair Vengeance Blue 8GB (2x4GB) DDR3 PC3-12800C9 1600MHz Dual Channel Kit memory...

Robotic Arm with USB PC Interface Review
Robotic Arm with USB PC Interface Review

This is my review of the Robotic Arm with USB PC Interface...

WHERE

Here we look at the Where condition in SQL.

The Where condition allows us to specify a certain set of data within a database table. You can use Where with the Select, Update and Delete commands.

For instance, in the first example, we first perform a Select command and gather the entire database table contents, and then we perform a Select command with a Where clause which only returns products of type Postal.


-- Get all the data in the table
SELECT * FROM Products

-- Get only products of type Postal
SELECT * FROM Products WHERE ProductType = 'Postal'


We can have multiple conditions with Where, for instance if you want to find products of type Postal and where the price is greater than 5.00, the next code example shows how to do this.


-- Get only Postal type products and products with
-- a price greater than 5.00
SELECT * FROM Products WHERE ProductType = 'Postal'
AND Price > '5.00'


Where can also be used with the Update and Delete commands, as seen here.


-- Delete only cars of colour red
DELETE FROM Cars WHERE Colour = 'Red'

-- Update the product price for bananas
UPDATE Fruit SET Price = '5.99' WHERE ProductName = 'Bananas'


Sponsored Links
SolarSystem - AngularJS Demo
SolarSystem - Angular JS Demo

Check out my first Angular JS demo hosted in Azure, it helped win my first Angular contract. Put the sound on.