为了账号安全,请及时绑定邮箱和手机立即绑定

使用mysql的select语句查询结果集

标签:
MySQL

Summary: in this tutorial, you will learn how to MySQL SELECT statement to query data from a database table.

The MySQL SELECT statement allows you to retrieve zero or more rows from tables or views. The SELECT statement is the one of the most commonly used queries in MySQL.

The SELECT statement returns a result that is a combination of columns and rows, which is also known as a result set.

MySQL SELECT syntax

The following illustrates the syntax of the SELECT statement:

SELECT column_1,column_2... FROM table_1 [INNER | LEFT |RIGHT] JOIN table_2 ON conditions WHERE conditions GROUP BY group  HAVING group_conditions ORDER BY column_1 [ASC | DESC] LIMIT offset, row_count

The SELECT statement is composed of several clauses:

You will learn about each clause in more detail in the next tutorial. In this tutorial, we are going to focus on the simple form of the SELECT statement.

MySQL SELECT Examples

To select all columns and rows from the employees table, you use the following query:

SELECT * FROM employees

mysql select

The asterisk (*) notation is a shorthand of selecting all columns in the table.

The SELECT statement also allows you to query partial data of a table by specifying a list of comma-separated columns in the SELECT clause. For example, if you want to view only first namelast name and job title of the employees,  you use the following query:

SELECT lastname,        firstname,        jobtitle FROM employees

mysql select columns

In this tutorial, you’ve learned about the basic MySQL SELECT statement to query data from a database table in MySQL

Related Tutorials

原文链接:http://outofmemory.cn/mysql/mysql-select-statement-query-data

点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消