mysql基本语法
2014-09-02 15:01
253 查看
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;
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;
相关文章推荐
- MySQL中create table语句的基本语法是
- mysql 基本语法介绍
- Mysql基本语法
- MySQL的一些基本语法(3)-查看表结构
- MySQL的一些基本语法(2)
- MySql基本语法参考
- MySQL的一些基本语法(8)-插入更新和删除数据
- Mysql 之Trigger基本语法
- mysql基本语法
- MySQL的一些基本语法(6)-触发器
- MySQL中SELECT语句的基本语法
- MySQL 最基本的SQL语法/语句
- SQL分类”及“Mysql基本语法
- mysql 基本语法
- Mysql基本语法(-)
- mysql存储过程基本语法和函数
- MySQL的一些基本语法
- PHP与MySQL连接及SQL语言基本语法
- MySQL中create table语句的基本语法
- MySQL的一些基本语法(7)-查询数据