MSSQL Lab Test 1

June 26, 2013 10:40 am MSSQL, Private
/*1*/
SELECT CompanyName AS 'ชื่อบริษัท' FROM Customer_data ;
 
/*2*/
SELECT CompanyName,Country FROM Customer_data WHERE Country='Germany';
 
/*3*/
SELECT * FROM Customer_data WHERE Payment BETWEEN 1 AND 20 ORDER BY Country DESC;
 
/*4*/
SELECT DISTINCT Country FROM Customer_data;
 
/*5*/
SELECT CompanyName,ContectName,Region FROM Customer_data WHERE Region IS NOT NULL;
 
/*6*/
SELECT CompanyName,ContectName,Contectitle FROM Customer_data WHERE Contectitle='Sales Representative';
 
/*7*/
SELECT * FROM Customer_data WHERE Country='USA' AND Payment>=7;
 
/*8*/
SELECT CustomerID,CompanyName,ContectName FROM Customer_data WHERE CompanyName LIKE '%a'
 
/*9*/
SELECT * FROM Customer_data WHERE City IN ('London','Helsinki') ORDER BY City ASC;
 
/*10*/
SELECT CustomerID,CompanyName,Region,Country,Payment FROM Customer_data WHERE Payment != 15  AND Region IS NULL ORDER BY Country ASC