I learned SQL query statements at Cloud and college today.
Query statements
Select field name from table name where condition (condition can not be written)
Example: select name, gender, salary from dbo. Staff
If all fields are available * instead
where represents the query condition
Select name, gender, salary from dbo. Staff where gender = ' male ' and salary not between 2500
Delete from T1
Delete Deletes the record in the table, the table exists
drop table T1
drop table to delete the structure and contents of tables
Select COUNT (Distinct (warehouse number)) as warehouse number from staff
Select SUM (wages) as the total wage from staff
Select MAX (payroll) as highest wage from employee
Select min (wages) as minimum wage from staff
Select AVG (payroll) as average salary from staff
Count is count, sum sum, max Max, Min Min, avg averaging
There are two types of SQL annotations:
One is to use--
The second is to use/**/
Between and indicates in what interval
Like Fuzzy Lookup
Select warehouse Number, MAX (payroll) as different warehouse maximum wage from employee where sex! = ' woman ' GROUP by warehouse number
Where is used with the group by keyword, where filters the data before grouping
Having a data filter after grouping the Select warehouse number, AVG (payroll) as different warehouses of goods are paid from the employee group by warehouse number having AVG (salary) >1700
Group BY is a group
Select name, gender, salary from employee order by sex, payroll desc
Order BY IS sort
UPDATE statement
Update warehouse set area =950 where city = ' Jinan '
SELECT DISTINCT (city) from dbo. Warehouse--Remove Duplicate column values
Select warehouse Number, CONVERT (char (10), creation time, 111) as creation time from warehouse
Time Format:
SQL query Statements