mysql基本语法

1、创建数据库
create database if not exists db_name;
2、使用数据库
use db_name;
3、删除数据库
drop database db_name;
4、创建表 例如创建学生信息表
create table student_info
(
stu_id smallint unsigned not null auto_increment,
stu_name varchar(30) not null,
stu_sex char(2) not null,
stu_age int not null,
stu_address varchar(100),
primary key(stu_id)
);
5、修改表 例如增加入学日期
alter table student_info add stu_entrance data;
6、删除表 
drop table if exists student_info;
7、插入
insert into student_info(stu_id,stu_name,stu_sex,stu_age) values(100,'aa','m',18)
8、更新
update student_info set stu_age=22 where stu_id=100;
9、删除
delete from student_info where stu_id=100;
10、查询
select * from student_info;
select stu_id,stu_name from student_info;
select stu_age from student_info where stu_age>20;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值