SQL增删改 mysql增删改 sql教程(三)

1.创建数据库

create database dataBaseName;
# 创建学生信息表
create database studentInfo;

2.应用数据库

# use databaseName;
use studentInfo;

3. 删除数据库

drop databaseName;

4.创建数据表

# create table tablename (column_1 int primary key, column_2 varchar(20) nut null, column_3 varchar nut null );
create table student ( id int auto_increment primary key, name varchar(20) not null, age int not null );

5.插入数据

# insert into (column_1, column2)values ( value, value);
insert into student(id, name, age) values(202101, 'ghostdot', 18);

6.修改数据

# update tableName set column_1 = value, columne = value where clause;
update student set name = 'ghost' where id = 2020101;

7. 删除数据

# delete from tableName where clause;
delete from student where name = 'ghost';

8.数据查询教程:

基础查询
https://www.cnblogs.com/ghostdot/p/12523864.html
高级查询
https://www.cnblogs.com/ghostdot/p/12543002.html
posted @ 2020-03-23 14:06  ghostdot  阅读(120)  评论(0编辑  收藏  举报