Athena-ydy

1.DQL语言的学习(查询)

语法:
select 查询列表 from 表名;
类似于system.out.println(打印东西);
特点:
1.查询列表可以是:表中的字段,常量值,表达式,函数 
2.查询的结果是一个虚拟的表格 

mysql自带的workbench为初学者提供了两个实验用的数据库sakila和world

在查询数据之前,首先要转到所要查询的数据库

使用USE 数据库名 语句

#查询表中单个字段

select actor_id from actor;

#查询表中多个字段

select first_name,last_name from actor;

#查询表中所有字段

法一:select xxx,xxx,xxx,.....from actor;(无需手动输入,直接在对应列表名中双击)

法二:select * from actor;

注意:如果字段名和关键字一样,为了便于区分,可以加上反引号

#查询常量值

select 100;

select \'ok\';

#查询表达式

select 100*98;

#查询函数

select version();

 

 

 

 

分类:

技术点:

相关文章:

  • 2021-11-18
  • 2021-11-18
  • 2021-09-26
  • 2021-07-21
  • 2021-11-30
  • 2021-11-18
  • 2021-11-18
  • 2021-10-31
猜你喜欢
  • 2021-11-18
  • 2021-11-18
  • 2021-11-18
  • 2021-04-10
  • 2021-10-01
  • 2021-10-27
  • 2021-08-23
相关资源
相似解决方案