結(jié)構(gòu)化查詢語言(Structured Query Language)簡稱SQL,結(jié)構(gòu)化查詢語言是一種數(shù)據(jù)庫查詢和程序設(shè)計(jì)語言,用于存取數(shù)據(jù)以及查詢、更新和管理關(guān)系數(shù)據(jù)庫系統(tǒng);
sql語句就是對(duì)數(shù)據(jù)庫進(jìn)行操作的一種語言。(推薦學(xué)習(xí):MySQL視頻教程)
程序功能
創(chuàng)建數(shù)據(jù)庫
CREATE DATABASE database-name
刪除數(shù)據(jù)庫
drop database dbname
創(chuàng)建新表
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
刪除新表
drop table tabname
常見語句
更新:update table1 set field1=value1 where 范圍
查找:select * from table1 where field1 like ’%value1%’ (所有包含‘value1’這個(gè)模式的字符串)
排序:select * from table1 order by field1,field2 [desc]
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最?。簊elect min(field1) as minvalue from table1[separator]