2021-09-14

mysql基础语句

	建库 
	Create database 名字
	id是整数   不用加引号
	插入insert into stu (id ,name);
	values (2,名字);
	删除行记录
	Delete from stu; 从哪张表删除
	Delete from stu where age =18: 删除表里年龄18的记录
	修改 把表里的年龄修改为16
	语法语句
	update stu set age =16
	把 李三的年龄改为16
	Update stu set age = 16 where id =1 (条件不充分)
	Update stu set age = 16 where name=‘李三’
	查询这张表的所有记录
	Select * from stu;#星号代表所有
语句一:select count(*) from T; 
作用:查询T表中数据的行数。 
语句二:select * from T; 
作用:查询T表中所有的数据。
	查询出所有年龄为18的学生的学号 名字
	Select * from stu where age = 18
多表查询
两个表里 
查询 所有表的name score
Select stu,name from stu,couse where stu ,id=course,id 
	找出表里得所有记录
	Select*from stu ;
	查出表里的记录所有数目
	Select count(*) from stu 
	查出表里年龄最大的
	Select Max(age) from stu
	找出表里所有年龄最大的记录
	1.select * from stu where age =(select max (age) from stu);
	2.select id,name,age where age =(select max (age)form stu);
	Hive数据库查询
	Show :查看数据库,表,视图
	Hive>Show database like ‘h*’; #;#like 模糊查询
	Hive> use hive;
	Hive>Show tables in hive like “u”;#查看数据库hive 中以u开头的所有表和视图
	查找z 开头的所有名称文件 
	Hive > select * from stu where name like “z%”;
	 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值