一、基本操作
注:test为表名
1、新增
create table test(
id int not null,
name varchar(50) not null);
2、删除
drop table test;
3、修改
(1)添加列
alter table test add column 列名 varchar(20) not null
(2)修改列
alter table test change column 列名 列属性 新属性 ;
(3)删除列
alter table test drop column 列名;
4、查询
desc test;
本文介绍了如何使用SQL进行基础操作,包括创建、删除、修改表结构,以及添加、修改和删除列。详细讲解了`CREATE TABLE`、`DROP TABLE`、`ALTER TABLE`命令,并展示了查询数据的基本方法。是数据库管理员和开发者必备的基础教程。
360

被折叠的 条评论
为什么被折叠?



