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 '')
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 |
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,
- Display all areas where the customer is living.
- Display the first 3 rows in customer table.
- Display all the customers by arranging their name in descending order
- Display all the customers who were living in THIRUNINRAVUR
- Display all the customers whose name starts by ‘D’
- Find out the area of all customers those id greater than 80109
- Display all the customers by arranging their name, area wise
- Display all the products of price 500-2000
- Display mobile numbers of the customers in AMBATTUR, PERUNGUDI
- 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'