Mysql基礎知識2:
數據庫查詢語言(DQL):select
數據庫定義語言(DDL):create database、drop database 、create table、drop table、alter
數據庫操作語言(DML):update 、insert 、delete
一、DDL之操作數據庫:
1、添加數據庫:create database 庫名;
2、刪除數據庫:drop database 庫名;
3、查詢指定庫的詳細信息:
(1)show create database 庫名;
(2)show databases; 查看MySQL下所有的庫
(3)select database(); 查看當前用戶鏈接的是那個數據庫
(4)desc 表名; 查看表中的字段
(5)show create table 表名 查看指定表的SQL信息
(6)rename table 舊表名 to 新表名 對已經存在的表進行重命名
(7)alter table 表名 add 字段名 數據類型; 向已存在的表中添加字段信息
(8) alter table 表名 drop 被刪除的字段名; 刪除指定表中的指定字段
(9)alter table 表名 change 舊字段名 新字段名 新字段類型; 對表中字段進行重命名