Structured Query Language (Structured Query Language), referred to as SQL, is a database query and programming language used to access data and query, update and manage relational database systems;
The sql statement is a language used to operate the database. (Recommended learning: MySQL video tutorial)
Program function
Create database
CREATE DATABASE database-name
Delete database
drop database dbname
Create new table
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
Delete new table
drop table tabname
Common statements
Update: update table1 set field1=value1 where range
Search: select * from table1 where field1 like '%value1%' (all strings containing the pattern 'value1')
Sort: select * from table1 order by field1,field2 [desc ]
Sum: select sum(field1) as sumvalue from table1
Average: select avg(field1) as avgvalue from table1
Maximum: select max(field1) as maxvalue from table1
Minimum: select min(field1) as minvalue from table1[separator]
For more MySQL-related technical articles, please visit the MySQL Tutorial column to learn!
The above is the detailed content of What is sql statement. For more information, please follow other related articles on the PHP Chinese website!