Technology

Following is an example to use COUNT with the


Following is an example to use DISTINCT clause

SELECT DISTINCT CustomerName, CellPhone
FROM Customers
WHERE State='CA';


Following is an example to use the COUNT function

SELECT COUNT(CustomerName)
FROM Customers
WHERE State='CA';


Method 1

Add /*csv*/ to the SQL query right after SELECT clause and run the query as a script using F5 or the second Execute button on the worksheet toolbar.


Example 2: In the following table called Customers, return only one Phone Number with priority to CellPhone first, then DayPhone, then NightPhone.


Example: In the following table called Customers, return only one Phone Number with priority to CellPhone first then DayPhone. Return Cellphone is CellPhone is not Null.


Example: In the following table called Customers, return only one Phone Number with priority to CellPhone first then DayPhone. Return Cellphone is CellPhone is not Null.


Method 1

Simple Case Statement with one expressions


Example: In the following table called Customers, return the Phone Number if the ContactbyPhone is
Y, otherwise if the ContactbyPhone is Null, return the Email.


Example: In the following table called Customers, return the Phone Number if the ContactbyPhone is
Y, otherwise if the ContactbyPhone is Null, return the Email.


Pages

User login