小标
2019-01-04
来源 :
阅读 1815
评论 0
摘要:本文主要向大家介绍了MySQL数据库之使用mysql的select语句查询结果集 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。
本文主要向大家介绍了MySQL数据库之使用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:
SELECT chooses which columns of the table you want to get the data.
FROM specifies the table from which you get the data.
JOIN gets data from multiple table based on certain join conditions.
WHERE filters rows to select.
GROUP BY group rows to apply aggregate functions on each group.
HAVING filters group based on groups defined by GROUP BY clause.
ORDER BY specifies the order of the returned result set.
LIMIT constrains number of returned rows.
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
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 name, last name and job title of the employees, you use the following query:
SELECT lastname, firstname, jobtitle FROM employees
In this tutorial, you’ve learned about the basic MySQL SELECT statement to query data from a database table in MySQL
本文由职坐标整理并发布,希望对同学们学习MySQL有所帮助,更多内容请关注职坐标数据库MySQL数据库频道!
喜欢 | 0
不喜欢 | 0
您输入的评论内容中包含违禁敏感词
我知道了

请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号