EXERCISE

Create a table named customer for the below structure,

create table customer (customerid INT UNSIGNED AUTO_INCREMENT UNIQUE,
 customername VARCHAR(30) DEFAULT' ',
 mobileno BIGINT(10) UNSIGNED DEFAULT 0 ,
 area VARCHAR (20) DEFAULT '')
80101DINESH RAJ 9840212400THIRUNINRAVUR
80102RAKESH RAJ9840312413AMBATTUR
80103SUMATHI9489096200PERUNGUDI
80104SHANKARAN8120191091THIRUNINRAVUR
80105RAHUL9000234121THIRUNINRAVUR
80106DIVAKAR9840312222PERUNGUDI
80107DHARMENDAR9804316666THIRUNINRAVUR
80108SHANMUGAM8120878787AMBATTUR
80109PURUSOTH9080403020THIRUNINRAVUR
INSERT INTO `customer` VALUES (80101,'DINESH RAJ',9840212400,'THIRUNINRAVUR'),(80102,'RAKESH RAJ',9840312413,'AMBATTUR'),(80103,'SUMATHI',9489096200,'PERUNGUDI'),(80104,'SHANKARAN',8120191091,'THIRUNINRAVUR'),(80105,'RAHUL',9000234121,'THIRUNINRAVUR'),(80106,'DIVAKAR',9840312222,'PERUNGUDI'),(80107,'DHARMENDAR',9804316666,'THIRUNINRAVUR'),(80108,'SHANMUGAM',8120878787,'AMBATTUR'),(80109,'PURUSOTH',9080403020,'THIRUNINRAVUR')

Solve the queries given below,

  1. Display all areas where the customer is living.
  2. Display the first 3 rows in customer table.
  3. Display all the customers by arranging their name in descending order
  4. Display all the customers who were living in THIRUNINRAVUR
  5. Display all the customers whose name starts by ‘D’
  6. Find out the area of all customers those id greater than 80109
  7. Display all the customers by arranging their name, area wise
  8. Display all the products of price 500-2000
  9. Display mobile numbers of the customers in AMBATTUR, PERUNGUDI
  10. Display all the customers of name ends with ‘RAJ’
SELECT DISTINCT `area` FROM `customer` 
SELECT * FROM `customer` limit 3
SELECT * FROM `customer` order by `customername` desc
SELECT * FROM `customer` WHERE `area`='THIRUNINRAVUR'
SELECT * FROM `customer` WHERE `customername` like'D%'
SELECT distinct `area` FROM `customer` WHERE `customerid`>80109
SELECT * FROM `customer` order by`customername`,`area`
SELECT * FROM `products` where `Price` between 500 and 2000
SELECT `mobileno` from `customer` where `area` in ('AMBATTUR','PERUNGUDI')
SELECT * FROM `customer` WHERE `customername` like '%RAJ'