DDL:數(shù)據(jù)定義語言
create尔破,drop,alter
1.針對庫的操作:
創(chuàng)建庫
create database if not exists bgx2 collate utf8_general_ci charset utf8;
刪庫
drop database bgx;
修改庫:
alter database bgx1 charset utf8;
2.針對表的操作:
建表:
create table oldtian2( id int, name varchar(10), gender enum('m','f','oldtian'));
刪除表:
drop table oldtian1;
修改表:
alter table student (add,modify,change,rename) 字段 varchar(10);
DCL:數(shù)據(jù)控制語言
grant,revoke
創(chuàng)建遠程登錄用戶:
grant all on *.* to root@'%' identified by '123';
收回某用戶的權限
revoke select on *.* from root@'%';
DML:數(shù)據(jù)操作語言
insert,update,delete
插入一條數(shù)據(jù)
insert into oldtian5(name,age,gender) values('bgx',18,'f');
修改數(shù)據(jù)
update bgx1.oldtian5 set gender='m' where id=7;
刪除某行
delete from bgx1.oldtian5 where id=13
DQL:數(shù)據(jù)查詢語言
select
查詢,接多條件
select gender,age from bgx1.oldtian5 where age=18 and gender='f';
update:修改數(shù)據(jù)