TOP MOST USEFUL MYSQLI_QUERIES || WHICH IS USE EVERY PROJECT TO PERFORM SOME DIFFERENT TASK.
SELECT * FROM `products`;
SELECT productname, price FROM products;
SELECT productname, price FROM products WHERE id=1;
SELECT * FROM `products` ORDER BY id DESC;
SELECT * FROM `products` ORDER BY productname ASC;
SELECT * FROM `products` LIMIT 0,3;
form which index , no of records
SELECT * FROM products ORDER BY price DESC LIMIT 0,2;
SELECT * FROM products WHERE city = 'cityname';
SELECT * FROM products WHERE price >= 'priceamout';
SELECT * FROM products WHERE price >= '20000' AND price <='50000'
SELECT * FROM products WHERE city = 'city' AND price >= 'priceamount';
SELECT * FROM `products` WHERE city IN ('Bhopal','Indore');
SELECT * FROM `products` WHERE city!='gwalior'
SELECT * FROM `products` WHERE city NOT IN ('Bhopal','Indore');
ALTER TABLE `tablename` ADD `coulmname` DATATYPE(length) property;
ALTER TABLE products ADD `manager` VARCHAR(30);
ALTER TABLE `tablename` ADD `coulmname` DATATYPE(length) property AFTER `othercoulmname`;
ALTER TABLE `tablename` DROP `columname`;
DROP TABLE `tablename`;
DROP DATABASE 'databasename';
SELECT * FROM `products` WHERE `PRICE` BETWEEN '20000' AND '50000''
SELECT * FROM `products` WHERE `billing_date` BETWEEN '01-02-2018' AND '01-03-2018''
SELECT * FROM products WHERE storename LIKE '%%'
SELECT * FROM `products` WHERE storename LIKE '%jeet%'
SELECT * FROM `products` WHERE storename LIKE 'jeet%'
SELECT * FROM `products` WHERE storename LIKE '__jeet%'
SELECT SUM(columname) FROM products
SELECT SUM(columname) AS `Aliasnameofcolumn`FROM products
SELECT MAX(price) FROM products
SELECT MIN(price) FROM products
SELECT MIN(price) FROM products
SELECT AVG(price) FROM products
Comments
Post a Comment