mysql的简单语句
1. 查询并显示每张表所添加的数据
Show databases;
Use productorder
Show tables;
Select * from order1;
3 .customer表:将马云的邮政编码改为:110120 ,地址改为:北边小湖边
update customer set czip='110120'andcaddress='北边小湖边' where cname='马云'
3. product表:将产品编号为2的产品描述改为:我世界最牛的手机,手机中的大哥大
alter table product modify column int comment '我是世界上最牛的手机,手机中的大哥大';
1 )创建表的时候写注释
create table test1
(
field_name int comment '字段的注释'
)comment='表的注释';
2) 修改表的注释
alter table test1 comment '修改后的表的注释';
3 )修改字段的注释
alter table test1 modify column field_name int comment '修改后的字段注释';
--注意:字段名和字段类型照写就行
4 )查看表注释的方法
--在生成的SQL语句中看
show create table test1;
--在元数据的表里面看
use information_schema;
select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
5 )查看字段注释的方法
--show
show full columns from test1;
--在元数据的表里面看
select * from COLUMNS where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
2) 删除new_vendor表中所有数据
delete from table new_vendor;把表一起删除
drop table new_vendor;
查询工资大于等于5000的员工信息
select * from employee wheresalary>5000;
查询工资大于等于7000,职位是经理的员工信息