Select*fromStudent;+--------+--------+--------+|Name |RollNo|Grade |+ --------+--------+--------+|Gaurav|100 |B.tech||Aarav |150 |M.SC"/> Select*fromStudent;+--------+--------+--------+|Name |RollNo|Grade |+ --------+--------+--------+|Gaurav|100 |B.tech||Aarav |150 |M.SC">

Home  >  Article  >  Database  >  How to combine ROW selection and COLUMN selection in MySQL?

How to combine ROW selection and COLUMN selection in MySQL?

WBOY
WBOYforward
2023-09-02 18:09:031343browse

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)

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)

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete