Home > Database > Mysql Tutorial > body text

How to combine ROW selection and COLUMN selection in MySQL?

WBOY
Release: 2023-09-02 18:09:03
forward
1306 people have browsed it

MySQL 中如何将 ROW 选择和 COLUMN 选择结合起来?

To combine row selection with column selection, we can use the "WHERE" clause. For example, we have the following table -

mysql> Select * from Student;
+--------+--------+--------+
| Name   | RollNo | Grade  |
+--------+--------+--------+
| Gaurav | 100    | B.tech |
| Aarav  | 150    | M.SC   |
| Aryan  | 165    | M.tech |
+--------+--------+--------+
3 rows in set (0.00 sec)
Copy after login

Now, the following query will show how to combine row selection with column selection using WHERE clause.

mysql> Select Name, RollNo, Grade from Student where Grade='M.Sc' or Grade='B.Tech';
+--------+--------+--------+
| Name   | RollNo | Grade  |
+--------+--------+--------+
| Gaurav | 100    | B.tech |
| Aarav  | 150    | M.SC   |
+--------+--------+--------+
2 rows in set (0.00 sec)
Copy after login

The above is the detailed content of How to combine ROW selection and COLUMN selection in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!