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

Summary: in this tutorial, you will learn how toMySQL SELECTstatement 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

AAffA0nNPuCLAAAAAElFTkSuQmCC

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

The SELECTstatement also allows you to query partial data of a table by specifying a list of comma-separated columns in the SELECTclause. For example, if you want to view only first name, last name and job title of the employees,  you use the following query:SELECT lastname,        firstname,        jobtitle FROM employees

AAffA0nNPuCLAAAAAElFTkSuQmCC

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

Related Tutorials

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值