语法:
1.修改字段数据类型:alter table 表名 modify 字段名 新数据类型;
2.启动数据库:net start mysql
3.登入数据库:mysql -h localhost -u root -p
4.关闭数据库:net stop mysql
5.查看数据库:show databases;
6.创建数据库:create database 数据库名;
7.删除数据库:drop database 数据库名;8:50 2018/4/17
8.使用数据库:use 数据库名;
9.创建表:create table 表名(字段名 数据类型,字段名2,数据类型,);
10.查看表结构:desc 表名;
11.删除表中一条数据:delete from 表名 where id="";
12.修改表名:alter table 旧表名 rename to 新的;
13.修改字段名:alter table表名cha nge 旧段名 新的数据类型;
14.查看表:show tables
15.在表中添加字段:alt0er table 表名 add 新段名 数据类型;
16.修改update 表名 set 所修改的字段名=所要的 where 主键列=指定;
17.检查数据库名称是否存在,不存在创建该数据库,存在就不创建:
oreate database if not exists库名;
18.获取当前使用的数据库: select database();| select scblehema();
19.判断数据库存在就删除: drop database if exists 库名;
20.查看单个或多个字段内的数据:select 字段名,字段名2…from 表名;
21.带有条件查询:select * from 表名 where 字段名=条件;
21.使用in关键字查询指定记录:
select * from 表名 where 字段名 in(条件);(可以有多个条件,用逗号隔开。)
22.删除字段: alter table 表名 drop 字段名;
23.使用not in关键字查询:select * from 表名 where 字段名 not in (条件);(查询所不能满足条件的数据,多个条件可以用逗号隔开)
24.更改数据:update 表名 set 字段名=所要更改的 where 主键列=指定列;
25.清除数据:delete from 表名 where 主键列=指定列;