SQL 1
SQL 1
1. The SELECT DISTINCT statement is used to eliminate duplicate rows and display a unique list of values.
2. Select statement
3. Select Where statement. It is used to extract only those records that fulfil a specified condition.
Ex SELECT * FROM Customers WHERE Country='Mexico';
The AND and OR operators are used to filter records based on more than one condition:
AND Syntax
Ex SELECT * FROM Customers WHERE Country='Germany' AND City='Berlin';
OR Syntax
Ex SELECT * FROM Customers WHERE City='Berlin' OR City='München';
NOT Syntax
Ex SELECT * FROM Customers WHERE NOT Country='Germany';
Ex SELECT * FROM Customers WHERE Country='Germany' AND (City='Berlin' OR City='München');
Ex SELECT * FROM Customers WHERE NOT Country='Germany' AND NOT Country='USA';
5. Order By statement used to sort the result-set in ascending or descending order.
Ex SELECT * FROM Customers ORDER BY Country;
Ex SELECT * FROM Customers ORDER BY Country DESC;