As follows:
SELECT * fromProduct--Querying all ColumnsSELECTPro_id,pro_name fromProduct--querying a specified columnSELECTPro_name as 'Product Name', Price fromProduct--Add constant column change pro_id to "Product name" (Add constant column just show this name, query or original) and querySELECTpro_id, (Protype+Price as'Total Price' fromProduct--Merge Columns Protype+price two columns when querying add a constant column Note: Merge columns can only merge fields of numeric typesSELECT DISTINCTProtype fromProduct--Remove duplicate columns when queryingSELECT * fromProductWHEREPinpai='Sony' andChandi='Shenzhen';--conditional Query and (and) or (or)SELECT * fromProductWHEREProtype>1;--Compare Queries > < >= <= = <> (not equal)SELECT * fromProductWHEREProtypebetween 1 and 2;--query Protype between 1 and 2 (equivalent to >=1 and <=2)SELECT * fromProductWHEREProtype>=1 andProtype<=2;--the difference between null and ' (empty string)--null with IS null/is not nul--empty string with = '/<> 'SELECT * fromProductWHEREProtype is NULL;--query protype is nullSELECT * fromProductWHEREProtype is not NULL;--query Protype not mull.SELECT * fromProductWHEREProtype= "';--query Protype is an empty stringSELECT * fromProductWHEREProtype<> "';--Query Protype is not an empty string--query that product is not emptySELECT * fromProductWHEREProtype is not NULL andProtype<> "';--find products with Sony in all products--%: denotes any character--_: Represents a characterSELECT * fromProductWHEREPro_name like '% sony%';--inquire about total sales of ProtypeSELECT SUM(Protype) fromproduct;--Query the maximum value of Protype salesSELECT MAX(Protype) fromproduct;--minimum value for query Protype salesSELECT MIN(Protype) fromproduct;--find the average of sales for ProtypeSELECT AVG(Protype) fromproduct;--There are several products that query product--Note: The count () function counts the number of data that does not contain null--Use count statistics for the number of records to use fields that do not contain null valuesSELECT COUNT(*) fromProduct
MySQL result set data query (FOCUS)